rootfs-block/module-setup.sh: check root_devs in cmdline_rootfs()

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>
master
Xunlei Pang 2017-08-18 10:40:27 +08:00
parent 37f2fe55d1
commit 5634a31156
2 changed files with 7 additions and 1 deletions

View File

@ -1307,7 +1307,7 @@ export initdir dracutbasedir \
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 \

View File

@ -32,6 +32,12 @@ cmdline_journal() {
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 /)"