diff --git a/dracut-functions.sh b/dracut-functions.sh index 245c69cb6..eaeb1c4e2 100755 --- a/dracut-functions.sh +++ b/dracut-functions.sh @@ -607,9 +607,9 @@ for_each_host_dev_and_slaves_all() { local _dev local _ret=1 - [[ "${host_devs[*]}" ]] || return 2 + [[ "${host_devs[*]}" ]] || [[ "${user_devs[*]}" ]] || return 2 - for _dev in "${host_devs[@]}"; do + for _dev in "${host_devs[@]}" "${user_devs[@]}"; do [[ -b $_dev ]] || continue if check_block_and_slaves_all "$_func" "$(get_maj_min "$_dev")"; then _ret=0 @@ -622,9 +622,9 @@ for_each_host_dev_and_slaves() { local _func="$1" local _dev - [[ "${host_devs[*]}" ]] || return 2 + [[ "${host_devs[*]}" ]] || [[ "${user_devs[*]}" ]] || return 2 - for _dev in "${host_devs[@]}"; do + for _dev in "${host_devs[@]}" "${user_devs[@]}"; do [[ -b $_dev ]] || continue check_block_and_slaves "$_func" "$(get_maj_min "$_dev")" && return 0 done diff --git a/dracut.sh b/dracut.sh index 20935c6f9..0e3d0d8b1 100755 --- a/dracut.sh +++ b/dracut.sh @@ -328,6 +328,16 @@ push_host_devs() { done } +# Fills up user_devs stack variable and makes sure there are no duplicates +push_user_devs() { + local _dev + for _dev in "$@"; do + [[ -z $_dev ]] && continue + [[ " ${user_devs[*]} " == *" $_dev "* ]] && return + user_devs+=("$_dev") + done +} + check_conf_file() { if grep -H -e '^[^#]*[+]=\("[^ ]\|.*[^ ]"\)' "$@"; then printf '\ndracut[W]: +=" ": should have surrounding white spaces!\n' >&2 @@ -1698,7 +1708,7 @@ for line in "${fstab_lines[@]}"; do push_host_devs "$mp" done fi - push_host_devs "$dev" + push_user_devs "$dev" host_fs_types["$dev"]="$3" done @@ -1710,12 +1720,12 @@ for f in $add_fstab; do done for dev in $add_device; do - push_host_devs "$dev" + push_user_devs "$dev" done if ((${#add_device_l[@]})); then add_device+=" ${add_device_l[*]} " - push_host_devs "${add_device_l[@]}" + push_user_devs "${add_device_l[@]}" fi if [[ $hostonly ]] && [[ $hostonly_default_device != "no" ]]; then @@ -1841,7 +1851,7 @@ _get_fs_type() { return 1 } -for dev in "${host_devs[@]}"; do +for dev in "${host_devs[@]}" "${user_devs[@]}"; do _get_fs_type "$dev" check_block_and_slaves_all _get_fs_type "$(get_maj_min "$dev")" done @@ -1867,7 +1877,7 @@ export initdir dracutbasedir \ omit_drivers mdadmconf lvmconf root_devs \ use_fstab fstab_lines libdirs fscks nofscks ro_mnt \ stdloglvl sysloglvl fileloglvl kmsgloglvl logfile \ - host_fs_types host_devs swap_devs sshkey add_fstab \ + host_fs_types host_devs user_devs swap_devs sshkey add_fstab \ DRACUT_VERSION \ prefix filesystems drivers \ hostonly_cmdline loginstall \ diff --git a/modules.d/99base/module-setup.sh b/modules.d/99base/module-setup.sh index 13639bd45..2290beb80 100755 --- a/modules.d/99base/module-setup.sh +++ b/modules.d/99base/module-setup.sh @@ -72,7 +72,7 @@ install() { ## save host_devs which we need bring up if [[ $hostonly_cmdline == "yes" ]]; then - if [[ -n ${host_devs[*]} ]]; then + if [[ -n ${host_devs[*]} ]] || [[ -n ${user_devs[*]} ]]; then dracut_need_initqueue fi if [[ -f $initdir/lib/dracut/need-initqueue ]] || ! dracut_module_included "systemd"; then @@ -105,6 +105,22 @@ install() { *) ;; esac done + + for _dev in "${user_devs[@]}"; do + + case "$_dev" in + /dev/?*) wait_for_dev "$_dev" 0 ;; + *) ;; + esac + + _pdev=$(get_persistent_dev "$_dev") + [[ $_dev == "$_pdev" ]] && continue + + case "$_pdev" in + /dev/?*) wait_for_dev "$_pdev" 0 ;; + *) ;; + esac + done ) fi fi