Browse Source

mknet.sh.in: remove in a crash

Michael Aldridge 7 years ago
parent
commit
c358b52780
1 changed files with 6 additions and 1 deletions
  1. 6 1
      mknet.sh.in

+ 6 - 1
mknet.sh.in

@@ -43,7 +43,12 @@ readonly CURDIR="$(pwd)"
 # Die is a function provided in lib.sh which handles the cleanup of
 # Die is a function provided in lib.sh which handles the cleanup of
 # the mounts and removal of temporary directories if the running
 # the mounts and removal of temporary directories if the running
 # program exists unexpectedly.
 # program exists unexpectedly.
-trap 'die "An unchecked exception has occured!"' INT TERM
+trap 'bailout' INT TERM
+
+bailout() {
+    [ -d "$BOOT_DIR" ] && rm -rf "$BOOT_DIR"
+    die "An unchecked exception has occured!"
+}
 
 
 usage() {
 usage() {
     cat <<_EOF
     cat <<_EOF