]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
rootfs-block/module-setup.sh: check root_devs in cmdline_rootfs() 269/head
authorXunlei Pang <xlpang@redhat.com>
Fri, 18 Aug 2017 02:40:27 +0000 (10:40 +0800)
committerXunlei Pang <xlpang@redhat.com>
Fri, 18 Aug 2017 06:44:19 +0000 (14:44 +0800)
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>
dracut.sh
modules.d/95rootfs-block/module-setup.sh

index 8d7ee70ae9670c5faa0733c97e7190c6497fe4cd..681a6b7ac714d21b3cf857e955b1bcef8668514a 100755 (executable)
--- a/dracut.sh
+++ b/dracut.sh
@@ -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 \
index 2b06bac233e4159456093717a734e68a39260057..987373b4f34ac5ff8cb4926dc6303b34eaecb223 100755 (executable)
@@ -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 /)"