From: Benjamin Drung Date: Mon, 5 Jan 2026 23:32:20 +0000 (+0100) Subject: fix(dracut): source dracut-functions.sh before calling dwarning X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8552a0f;p=thirdparty%2Fdracut-ng.git fix(dracut): source dracut-functions.sh before calling dwarning `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 --- diff --git a/dracut.sh b/dracut.sh index d490c4e9e..d8dbcc5c8 100755 --- a/dracut.sh +++ b/dracut.sh @@ -1204,6 +1204,9 @@ drivers_dir="${drivers_dir%"${drivers_dir##*[!/]}"}" [[ $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 ]] \ @@ -1487,9 +1490,6 @@ if ! [[ ${dracutbasedir-} ]]; then dracutbasedir="$(readlink -f "$dracutbasedir")" fi -# shellcheck source=./dracut-functions.sh -. "$dracutbasedir"/dracut-functions.sh - if ! [[ ${initdir-} ]]; then dfatal "initdir not set" exit 1