diff --git a/modules.d/90crypt/parse-crypt.sh b/modules.d/90crypt/parse-crypt.sh index 94ad1f63..87e674a8 100755 --- a/modules.d/90crypt/parse-crypt.sh +++ b/modules.d/90crypt/parse-crypt.sh @@ -14,6 +14,10 @@ else LUKS=$(getargs rd.luks.uuid -d rd_LUKS_UUID) tout=$(getarg rd.luks.key.tout) + while read _mapper _dev _rest ; do + set_systemd_timeout_for_dev $_dev + done < /etc/crypttab + if [ -n "$LUKS" ]; then for luksid in $LUKS; do diff --git a/modules.d/90mdraid/mdraid_start.sh b/modules.d/90mdraid/mdraid_start.sh index 761e64f3..400ab5dc 100755 --- a/modules.d/90mdraid/mdraid_start.sh +++ b/modules.d/90mdraid/mdraid_start.sh @@ -27,6 +27,7 @@ _md_force_run() { _path_d="${_path_s%/*}/degraded" [ ! -r "$_path_d" ] && continue + > $hookdir/initqueue/work done } diff --git a/modules.d/98dracut-systemd/dracut-initqueue.sh b/modules.d/98dracut-systemd/dracut-initqueue.sh index 88cd1e05..af9cec2c 100755 --- a/modules.d/98dracut-systemd/dracut-initqueue.sh +++ b/modules.d/98dracut-systemd/dracut-initqueue.sh @@ -60,6 +60,7 @@ while :; do job=$job . $job udevadm settle --timeout=0 >/dev/null 2>&1 || main_loop=0 [ -f $hookdir/initqueue/work ] && main_loop=0 + [ $main_loop -eq 0 ] && break done fi diff --git a/modules.d/98dracut-systemd/rootfs-generator.sh b/modules.d/98dracut-systemd/rootfs-generator.sh index a68e73b8..2589919d 100755 --- a/modules.d/98dracut-systemd/rootfs-generator.sh +++ b/modules.d/98dracut-systemd/rootfs-generator.sh @@ -11,14 +11,15 @@ generator_wait_for_dev() _timeout=$(getarg rd.timeout) _timeout=${_timeout:-0} - [ -e "$hookdir/initqueue/finished/devexists-${_name}.sh" ] && return 0 + if ! [ -e "$hookdir/initqueue/finished/devexists-${_name}.sh" ]; then - printf '[ -e "%s" ]\n' $1 \ - >> "$hookdir/initqueue/finished/devexists-${_name}.sh" - { - printf '[ -e "%s" ] || ' $1 - printf 'warn "\"%s\" does not exist"\n' $1 - } >> "$hookdir/emergency/80-${_name}.sh" + printf '[ -e "%s" ]\n' $1 \ + >> "$hookdir/initqueue/finished/devexists-${_name}.sh" + { + printf '[ -e "%s" ] || ' $1 + printf 'warn "\"%s\" does not exist"\n' $1 + } >> "$hookdir/emergency/80-${_name}.sh" + fi _name=$(dev_unit_name "$1") if ! [ -L /run/systemd/generator/initrd.target.wants/${_name}.device ]; then diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh index 14deb18c..6498f9d0 100755 --- a/modules.d/99base/dracut-lib.sh +++ b/modules.d/99base/dracut-lib.sh @@ -897,12 +897,10 @@ dev_unit_name() printf -- "%s" "$dev" } -# wait_for_dev <dev> -# -# Installs a initqueue-finished script, -# which will cause the main loop only to exit, -# if the device <dev> is recognized by the system. -wait_for_dev() +# set_systemd_timeout_for_dev <dev> +# Set 'rd.timeout' as the systemd timeout for <dev> + +set_systemd_timeout_for_dev() { local _name local _needreload @@ -917,19 +915,6 @@ wait_for_dev() _timeout=$(getarg rd.timeout) _timeout=${_timeout:-0} - _name="$(str_replace "$1" '/' '\x2f')" - - type mark_hostonly >/dev/null 2>&1 && mark_hostonly "$hookdir/initqueue/finished/devexists-${_name}.sh" - - [ -e "${PREFIX}$hookdir/initqueue/finished/devexists-${_name}.sh" ] && return 0 - - printf '[ -e "%s" ]\n' $1 \ - >> "${PREFIX}$hookdir/initqueue/finished/devexists-${_name}.sh" - { - printf '[ -e "%s" ] || ' $1 - printf 'warn "\"%s\" does not exist"\n' $1 - } >> "${PREFIX}$hookdir/emergency/80-${_name}.sh" - if [ -n "$DRACUT_SYSTEMD" ]; then _name=$(dev_unit_name "$1") if ! [ -L ${PREFIX}/etc/systemd/system/initrd.target.wants/${_name}.device ]; then @@ -954,6 +939,36 @@ wait_for_dev() fi fi } +# wait_for_dev <dev> +# +# Installs a initqueue-finished script, +# which will cause the main loop only to exit, +# if the device <dev> is recognized by the system. +wait_for_dev() +{ + local _name + local _noreload + + if [ "$1" = "-n" ]; then + _noreload=-n + shift + fi + + _name="$(str_replace "$1" '/' '\x2f')" + + type mark_hostonly >/dev/null 2>&1 && mark_hostonly "$hookdir/initqueue/finished/devexists-${_name}.sh" + + [ -e "${PREFIX}$hookdir/initqueue/finished/devexists-${_name}.sh" ] && return 0 + + printf '[ -e "%s" ]\n' $1 \ + >> "${PREFIX}$hookdir/initqueue/finished/devexists-${_name}.sh" + { + printf '[ -e "%s" ] || ' $1 + printf 'warn "\"%s\" does not exist"\n' $1 + } >> "${PREFIX}$hookdir/emergency/80-${_name}.sh" + + set_systemd_timeout_for_dev $_noreload $1 +} cancel_wait_for_dev() {