dracut.sh: set $initdir early before sourcing dracut-functions.sh

This commit is contained in:
Harald Hoyer 2012-06-27 14:17:46 +02:00
parent 99c7b70d1d
commit 26c231f13b

View File

@ -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.