Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/contrib/bacman.sh.in
diff options
context:
space:
mode:
authorGordian Edenhofer <gordian.edenhofer@gmail.com>2016-09-04 18:13:57 +0200
committerAllan McRae <allan@archlinux.org>2016-09-25 17:41:10 +1000
commit52ec8dfffee862511d07bbd98293c605ac075656 (patch)
treecbb68923dcdff4c773fc707bd6c29e5f93bf39a4 /contrib/bacman.sh.in
parent7568928e7152d0de4728fbb8b44b444e5affbfcb (diff)
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>
Diffstat (limited to 'contrib/bacman.sh.in')
-rw-r--r--contrib/bacman.sh.in10
1 files changed, 10 insertions, 0 deletions
diff --git a/contrib/bacman.sh.in b/contrib/bacman.sh.in
index 5e6fce56..e7a7f576 100644
--- a/contrib/bacman.sh.in
+++ b/contrib/bacman.sh.in
@@ -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
#