]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
dracut.sh: set $initdir early before sourcing dracut-functions.sh
authorHarald Hoyer <harald@redhat.com>
Wed, 27 Jun 2012 12:17:46 +0000 (14:17 +0200)
committerHarald Hoyer <harald@redhat.com>
Fri, 29 Jun 2012 10:41:27 +0000 (12:41 +0200)
dracut.sh

index c56f17bae6ae3757fb0e692026f9f2ae6c5d71c7..0f475f5af97fd59b144fa5de2641a18ca39ed2f1 100755 (executable)
--- a/dracut.sh
+++ b/dracut.sh
@@ -465,12 +465,19 @@ fi
 [[ $hostonly = yes ]] && hostonly="-h"
 [[ $hostonly != "-h" ]] && unset hostonly
 
+readonly TMPDIR="$tmpdir"
+readonly initdir=$(mktemp --tmpdir="$TMPDIR/" -d -t initramfs.XXXXXX)
+[ -d "$initdir" ] || {
+    echo "dracut: mktemp --tmpdir=\"$TMPDIR/\" -d -t initramfs.XXXXXXfailed." >&2
+    exit 1
+}
+
 if [[ -f $dracutbasedir/dracut-functions.sh ]]; then
     . $dracutbasedir/dracut-functions.sh
 else
-    echo "Cannot find $dracutbasedir/dracut-functions.sh." >&2
-    echo "Are you running from a git checkout?" >&2
-    echo "Try passing -l as an argument to $0" >&2
+    echo "dracut: Cannot find $dracutbasedir/dracut-functions.sh." >&2
+    echo "dracut: Are you running from a git checkout?" >&2
+    echo "dracut: Try passing -l as an argument to $0" >&2
     exit 1
 fi
 
@@ -562,13 +569,6 @@ elif [[ -f "$outfile" && ! -w "$outfile" ]]; then
     exit 1
 fi
 
-readonly TMPDIR="$tmpdir"
-readonly initdir=$(mktemp --tmpdir="$TMPDIR/" -d -t initramfs.XXXXXX)
-[ -d "$initdir" ] || {
-    dfatal "mktemp failed."
-    exit 1
-}
-
 # 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.