In case of "--no-hostonly-default-device", we do not need
the root device, thus add this check.
Also fixed the stale "root_dev" export.
Signed-off-by: Xunlei Pang <xlpang@redhat.com>
dracutmodules force_add_dracutmodules add_dracutmodules omit_dracutmodules \
mods_to_load \
fw_dir drivers_dir debug no_kernel kernel_only \
- omit_drivers mdadmconf lvmconf root_dev \
+ omit_drivers mdadmconf lvmconf root_devs \
use_fstab fstab_lines libdirs fscks nofscks ro_mnt \
stdloglvl sysloglvl fileloglvl kmsgloglvl logfile \
debug host_fs_types host_devs swap_devs sshkey add_fstab \
cmdline_rootfs() {
local _dev=/dev/block/$(find_root_block_device)
local _fstype _flags _subvol
+
+ # "--no-hostonly-default-device" can result in empty root_devs
+ if [ "${#root_devs[@]}" -eq 0 ]; then
+ return
+ fi
+
if [ -e $_dev ]; then
printf " root=%s" "$(shorten_persistent_dev "$(get_persistent_dev "$_dev")")"
_fstype="$(find_mp_fstype /)"