Blame 0007-dracut.sh-move-cleanup-trap-just-after-mktemp.patch

Harald Hoyer 52ce14
From d008b6b89f69772a119da779c9e934e9bdd426ec Mon Sep 17 00:00:00 2001
Harald Hoyer 52ce14
From: Harald Hoyer <harald@redhat.com>
Harald Hoyer 52ce14
Date: Sat, 9 Mar 2013 15:30:44 +0100
Harald Hoyer 52ce14
Subject: [PATCH] dracut.sh: move cleanup trap, just after mktemp
Harald Hoyer 52ce14
Harald Hoyer 52ce14
---
Harald Hoyer 52ce14
 dracut.sh | 10 +++++-----
Harald Hoyer 52ce14
 1 file changed, 5 insertions(+), 5 deletions(-)
Harald Hoyer 52ce14
Harald Hoyer 52ce14
diff --git a/dracut.sh b/dracut.sh
Harald Hoyer 52ce14
index 8f3e5d2..860cfb5 100755
Harald Hoyer 52ce14
--- a/dracut.sh
Harald Hoyer 52ce14
+++ b/dracut.sh
Harald Hoyer 52ce14
@@ -623,6 +623,11 @@ readonly initdir=$(mktemp --tmpdir="$TMPDIR/" -d -t initramfs.XXXXXX)
Harald Hoyer 52ce14
     exit 1
Harald Hoyer 52ce14
 }
Harald Hoyer 52ce14
 
Harald Hoyer 52ce14
+# clean up after ourselves no matter how we die.
Harald Hoyer 52ce14
+trap 'ret=$?;[[ $keep ]] && echo "Not removing $initdir." >&2 || { [[ $initdir ]] && rm -rf "$initdir";exit $ret; };' EXIT
Harald Hoyer 52ce14
+# clean up after ourselves no matter how we die.
Harald Hoyer 52ce14
+trap 'exit 1;' SIGINT
Harald Hoyer 52ce14
+
Harald Hoyer 52ce14
 export DRACUT_KERNEL_LAZY="1"
Harald Hoyer 52ce14
 export DRACUT_RESOLVE_LAZY="1"
Harald Hoyer 52ce14
 
Harald Hoyer 52ce14
@@ -742,11 +747,6 @@ elif [[ -f "$outfile" && ! -w "$outfile" ]]; then
Harald Hoyer 52ce14
     exit 1
Harald Hoyer 52ce14
 fi
Harald Hoyer 52ce14
 
Harald Hoyer 52ce14
-# clean up after ourselves no matter how we die.
Harald Hoyer 52ce14
-trap 'ret=$?;[[ $keep ]] && echo "Not removing $initdir." >&2 || rm -rf "$initdir";exit $ret;' EXIT
Harald Hoyer 52ce14
-# clean up after ourselves no matter how we die.
Harald Hoyer 52ce14
-trap 'exit 1;' SIGINT
Harald Hoyer 52ce14
-
Harald Hoyer 52ce14
 # Need to be able to have non-root users read stuff (rpcbind etc)
Harald Hoyer 52ce14
 chmod 755 "$initdir"
Harald Hoyer 52ce14