]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
host-only checks corrected and kernel_only mode
authorHarald Hoyer <harald@redhat.com>
Wed, 22 Feb 2012 18:07:39 +0000 (19:07 +0100)
committerHarald Hoyer <harald@redhat.com>
Wed, 22 Feb 2012 18:29:57 +0000 (19:29 +0100)
In kernel_only mode, we don't want to write /etc/cmdline.d

Correctly return the check functions, so we have a valid return of
for_each_host_dev_fs().

mdraid and dmraid functions had wrong checkings for the filesystem
type.

modules.d/90crypt/module-setup.sh
modules.d/90dmraid/module-setup.sh
modules.d/90lvm/module-setup.sh
modules.d/90mdraid/module-setup.sh

index 5db25f85bf899daf9b30fc88a0c428a279f46449..8fdf32b8f11bb7e3f79fa854fa123c30b520190f 100755 (executable)
@@ -11,7 +11,7 @@ check() {
 
     check_crypt() {
         local dev=$1 fs=$2
-        [[ $fs = "crypto_LUKS" ]] || continue
+        [[ $fs = "crypto_LUKS" ]] || return 1
         ID_FS_UUID=$(udevadm info --query=property --name=$dev \
             | while read line; do
                 [[ ${line#ID_FS_UUID} = $line ]] && continue
@@ -19,13 +19,15 @@ check() {
                 echo $ID_FS_UUID
                 break
                 done)
-        [[ ${ID_FS_UUID} ]] || continue
-        echo " rd.luks.uuid=luks-${ID_FS_UUID} " >> "${initdir}/etc/cmdline.d/90crypt.conf"
+        [[ ${ID_FS_UUID} ]] || return 1
+        if ! [[ $kernel_only ]]; then
+            echo " rd.luks.uuid=luks-${ID_FS_UUID} " >> "${initdir}/etc/cmdline.d/90crypt.conf"
+        fi
+        return 0
     }
 
     [[ $hostonly ]] || [[ $mount_needs ]] && {
-        for_each_host_dev_fs check_crypt
-        [ -f "${initdir}/etc/cmdline.d/90crypt.conf" ] || return 1
+        for_each_host_dev_fs check_crypt || return 1
     }
 
     return 0
index d7834d1e80c06d9edb4d87322cc4831c685ac515..786cf252a3cf8c32c23c95a329630712068cba78 100755 (executable)
@@ -13,8 +13,7 @@ check() {
 
     check_dmraid() {
         local dev=$1 fs=$2 holder DEVPATH DM_NAME
-        [[ "$fs" = "linux_raid_member" ]] && continue
-        [[ "$fs" = "${fs%%_raid_member}" ]] && continue
+        [[ "$fs" = "${fs%%_raid_member}" ]] && return 1
 
         DEVPATH=$(udevadm info --query=property --name=$dev \
             | while read line; do
@@ -34,13 +33,15 @@ check() {
                     done)
         done
 
-        [[ ${DM_NAME} ]] || continue
-        echo " rd.dm.uuid=${DM_NAME} " >> "${initdir}/etc/cmdline.d/90dmraid.conf"
+        [[ ${DM_NAME} ]] || return 1
+        if ! [[ $kernel_only ]]; then
+            echo " rd.dm.uuid=${DM_NAME} " >> "${initdir}/etc/cmdline.d/90dmraid.conf"
+        fi
+        return 0
     }
 
     [[ $hostonly ]] || [[ $mount_needs ]] && {
-        for_each_host_dev_fs check_dmraid
-        [ -f "${initdir}/etc/cmdline.d/90dmraid.conf" ] || return 1
+        for_each_host_dev_fs check_dmraid || return 1
     }
 
     return 0
index fd488350c2a8bf388a0be14de8df423767d91ad4..c40dd29371df704cbec4063a75e350c652f620d5 100755 (executable)
@@ -14,16 +14,18 @@ check() {
         unset DM_VG_NAME
         unset DM_LV_NAME
         eval $(udevadm info --query=property --name=$1|egrep '(DM_VG_NAME|DM_LV_NAME)=')
-        [[ ${DM_VG_NAME} ]] && [[ ${DM_LV_NAME} ]] || return
+        [[ ${DM_VG_NAME} ]] && [[ ${DM_LV_NAME} ]] || return 1
         if ! strstr " ${_activated[*]} " " ${DM_VG_NAME}/${DM_LV_NAME} "; then
-            echo " rd.lvm.lv=${DM_VG_NAME}/${DM_LV_NAME} " >> "${initdir}/etc/cmdline.d/90lvm.conf"
+            if ! [[ $kernel_only ]]; then
+                echo " rd.lvm.lv=${DM_VG_NAME}/${DM_LV_NAME} " >> "${initdir}/etc/cmdline.d/90lvm.conf"
+            fi
             push _activated "${DM_VG_NAME}/${DM_LV_NAME}"
         fi
+        return 0
     }
 
     [[ $hostonly ]] || [[ $mount_needs ]] && {
-        for_each_host_dev_fs check_lvm
-        [ -f "${initdir}/etc/cmdline.d/90lvm.conf" ] || return 1
+        for_each_host_dev_fs check_lvm || return 1
     }
 
     return 0
index f8a481134accb6bcf156fc79283a211be6074477..90092a7ee2caa01633bcb2abd2bfdbc39f89f408 100755 (executable)
@@ -12,35 +12,25 @@ check() {
 
     check_mdraid() {
         local dev=$1 fs=$2 holder DEVPATH MD_UUID
-        [[ "$fs" = "linux_raid_member" ]] && continue
-        [[ "$fs" = "${fs%%_raid_member}" ]] && continue
+        [[ "$fs" = "${fs%%_raid_member}" ]] && return 1
 
-        DEVPATH=$(udevadm info --query=property --name=$dev \
+        MD_UUID=$(/sbin/mdadm --examine --export $dev \
             | while read line; do
-                [[ ${line#DEVPATH} = $line ]] && continue
+                [[ ${line#MD_UUID} = $line ]] && continue
                 eval "$line"
-                echo $DEVPATH
+                echo $MD_UUID
                 break
                 done)
 
-        for holder in /sys/$DEVPATH/holders/*; do
-            [[ -e $holder ]] || continue
-            MD_UUID=$(udevadm info --query=property --path=$holder \
-                | while read line; do
-                    [[ ${line#MD_UUID} = $line ]] && continue
-                    eval "$line"
-                    echo $MD_UUID
-                    break
-                    done)
-        done
-
-        [[ ${MD_UUID} ]] || continue
-        echo " rd.md.uuid=${MD_UUID} " >> "${initdir}/etc/cmdline.d/90mdraid.conf"
+        [[ ${MD_UUID} ]] || return 1
+        if ! [[ $kernel_only ]]; then
+            echo " rd.md.uuid=${MD_UUID} " >> "${initdir}/etc/cmdline.d/90mdraid.conf"
+        fi
+        return 0
     }
 
     [[ $hostonly ]] || [[ $mount_needs ]] && {
-        for_each_host_dev_fs check_mdraid
-        [[ -f "${initdir}/etc/cmdline.d/90mdraid.conf" ]] || return 1
+        for_each_host_dev_fs check_mdraid || return 1
     }
 
     return 0