bacman: handle SIGHUP, SIGINT, SIGTERM signals

Trap SIGHUP, SIGINT, SIGTERM and remove working directories accordingly.

Signed-off-by: Gordian Edenhofer <gordian.edenhofer@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Gordian Edenhofer 2016-09-04 18:13:57 +02:00 committed by Allan McRae
parent 7568928e71
commit 52ec8dfffe
1 changed files with 10 additions and 0 deletions

View File

@ -33,6 +33,16 @@ ARGS=("$@")
m4_include(../scripts/library/output_format.sh)
# Lazy recursive clean up of temporary dirs
work_dir_root="${TMPDIR:-/tmp}/bacman"
clean_up() {
rm -rf "$work_dir_root".*
echo
exit
}
# Trap termination signals
trap clean_up SIGHUP SIGINT SIGTERM
#
# User Friendliness
#