`dracut-functions.sh` sources `dracut-logger.sh` which defines the
`dwarning` function. `dracut.sh` might call `dwarning` before
`dracut-functions.sh` is sourced.
`dracut-functions.sh` calls `find_binary` and `dlog_init` when sourced.
`find_binary` needs `dracutsysrootdir` set and `dlog_init` needs
`stdloglvl`, `sysloglvl`, `kmsgloglvl`, `maxloglvl`, `fileloglvl`,
`logfile`. Move sourcing `dracut-functions.sh` as early as possible, but
after setting those variables.
Follow-up for
8d9887b
Fixes: https://bugs.debian.org/1124479
[[ $sbat_l ]] && sbat="$sbat_l"
[[ $machine_id_l ]] && machine_id="$machine_id_l"
+# shellcheck source=./dracut-functions.sh
+. "$dracutbasedir"/dracut-functions.sh
+
if ! [[ $outfile ]]; then
if [[ $machine_id != "no" ]]; then
if [[ -d "${dracutsysrootdir-}"/efi/Default ]] \
dracutbasedir="$(readlink -f "$dracutbasedir")"
fi
-# shellcheck source=./dracut-functions.sh
-. "$dracutbasedir"/dracut-functions.sh
-
if ! [[ ${initdir-} ]]; then
dfatal "initdir not set"
exit 1