comparison packaging/linux-installer.inc.in @ 935:e977f7a0e8fd

Cleanup temporary stuff (like shar lockdir) always (even when interrupted) on exit.
author Sascha Wilde <wilde@intevation.de>
date Fri, 22 Aug 2014 18:03:52 +0200
parents 1cc9faa572fd
children f6b52f60f643
comparison
equal deleted inserted replaced
934:519b14c5260d 935:e977f7a0e8fd
175 extra_bin_path=`mktemp --tmpdir -d tmpbin.XXXXXXXXXX` 175 extra_bin_path=`mktemp --tmpdir -d tmpbin.XXXXXXXXXX`
176 } 176 }
177 177
178 cleanup() 178 cleanup()
179 { 179 {
180 rm -rf "$extra_bin_path" 180 getxt "Cleaning up temporary stuff ...\n"
181 # remove temporary directories,
182 # $lock_dir is generate by the shar
183 for dir in "${instcfg[PREFIX]}/$lock_dir" "$extra_bin_path" ; do
184 [ -d "$dir" ] &&
185 rm -rf "$dir"
186 done
181 } 187 }
182 188
183 write_instcfg() 189 write_instcfg()
184 { 190 {
185 install -d `dirname "$instcfg_file"` 191 install -d `dirname "$instcfg_file"`
431 fi 437 fi
432 } 438 }
433 439
434 #====================================================================== 440 #======================================================================
435 # main() 441 # main()
442 trap cleanup EXIT
436 443
437 parse_args "$@" 444 parse_args "$@"
438 init_vars 445 init_vars
439 check_priv 446 check_priv
440 read_oldinstcfg 447 read_oldinstcfg
510 setup_startmenu 517 setup_startmenu
511 518
512 getxt "Writing installation configuration to: %s ...\n" "$instcfg_file" 519 getxt "Writing installation configuration to: %s ...\n" "$instcfg_file"
513 write_instcfg 520 write_instcfg
514 521
515 getxt "Cleaning up temporary stuff ...\n" 522 # cleanup
516 cleanup 523 # is called implicitly at exit via trap...
517 exit 0 524 exit 0

http://wald.intevation.org/projects/trustbridge/