]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
dracut.sh: move cleanup trap, just after mktemp
authorHarald Hoyer <harald@redhat.com>
Sat, 9 Mar 2013 14:30:44 +0000 (15:30 +0100)
committerHarald Hoyer <harald@redhat.com>
Sat, 9 Mar 2013 14:31:09 +0000 (15:31 +0100)
dracut.sh

index 8f3e5d214699e4885d967a6b9e139bb1d3e6a3cf..860cfb5c405f09ed30a404c711fdb3f4438223dc 100755 (executable)
--- a/dracut.sh
+++ b/dracut.sh
@@ -623,6 +623,11 @@ readonly initdir=$(mktemp --tmpdir="$TMPDIR/" -d -t initramfs.XXXXXX)
     exit 1
 }
 
+# clean up after ourselves no matter how we die.
+trap 'ret=$?;[[ $keep ]] && echo "Not removing $initdir." >&2 || { [[ $initdir ]] && rm -rf "$initdir";exit $ret; };' EXIT
+# clean up after ourselves no matter how we die.
+trap 'exit 1;' SIGINT
+
 export DRACUT_KERNEL_LAZY="1"
 export DRACUT_RESOLVE_LAZY="1"
 
@@ -742,11 +747,6 @@ elif [[ -f "$outfile" && ! -w "$outfile" ]]; then
     exit 1
 fi
 
-# clean up after ourselves no matter how we die.
-trap 'ret=$?;[[ $keep ]] && echo "Not removing $initdir." >&2 || rm -rf "$initdir";exit $ret;' EXIT
-# clean up after ourselves no matter how we die.
-trap 'exit 1;' SIGINT
-
 # Need to be able to have non-root users read stuff (rpcbind etc)
 chmod 755 "$initdir"