diff --git a/dracut.sh b/dracut.sh index c56f17ba..0f475f5a 100755 --- 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.