mirror of
https://github.com/dracutdevs/dracut.git
synced 2024-10-27 17:55:47 +03:00
dracut.sh: set $initdir early before sourcing dracut-functions.sh
This commit is contained in:
parent
99c7b70d1d
commit
26c231f13b
20
dracut.sh
20
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.
|
||||
|
Loading…
Reference in New Issue
Block a user