]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
dracut-functions: fix check=255 logic and dependencies
authorHarald Hoyer <harald@redhat.com>
Mon, 2 Aug 2010 07:40:18 +0000 (09:40 +0200)
committerHarald Hoyer <harald@redhat.com>
Mon, 2 Aug 2010 12:17:52 +0000 (14:17 +0200)
dracut-functions

index 40c4bef4659c451edb576168db3a5ec4adc7aa5e..199501627d55e2ca5ffe844a0b63c47a7322c653 100755 (executable)
@@ -482,7 +482,8 @@ inst_opt_decompress() {
 check_module_deps() {
     local moddir dep ret
     # if we are already set to be loaded, we do not have to be checked again.
-    strstr "$mods_to_load" " $1 " && return
+    strstr " $mods_to_load " " $1 " && return
+    strstr " $omit_dracutmodules " " $1 " && return 1
     # turn a module name into a directory, if we can.
     moddir=$(echo ${dracutbasedir}/modules.d/??${1})
     [[ -d $moddir && -x $moddir/install ]] || return 1
@@ -503,13 +504,14 @@ check_module_deps() {
 
 should_source_module() {
     local dep
+    local ret
     if [[ $kernel_only = yes ]]; then
         [[ -x $1/installkernel ]] && return 0
         return 1
     fi
     [[ -x $1/install ]] || [[ -x $1/installkernel ]] || return 1
     [[ -x $1/check ]] || return 0
-    "$1/check" $hostonly || return 1
+    "$1/check" $hostonly || continue
     for dep in $("$1/check" -d); do
        check_module_deps "$dep" && continue
        dwarning "Cannot load dracut module \"$mod\", dependencies failed."
@@ -523,13 +525,11 @@ check_modules() {
     for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
        local mod=${moddir##*/}; mod=${mod#[0-9][0-9]}
        # If we are already scheduled to be loaded, no need to check again.
-       strstr "$mods_to_load" " $mod " && continue
+       strstr " $mods_to_load " " $mod " && continue
        # This should never happen, but...
        [[ -d $moddir ]] || continue
 
-       strstr "$omit_dracutmodules" "$mod" && continue
-
-        if ! strstr "$dracutmodules $add_dracutmodules" "$mod"; then
+        if ! strstr " $dracutmodules $add_dracutmodules " " $mod "; then
             # module not in our list
            if [[ $dracutmodules = all ]]; then
                 # check, if we can install this module
@@ -538,6 +538,14 @@ check_modules() {
                 # skip this module
                 continue
             fi
+       else
+           if [ -x "$moddir/check" ] \
+                && "$moddir/check" -d > /dev/null 2>&1; then
+               check_module_deps "$mod" || {
+                   dwarning "Cannot load dracut module \"$mod\", dependencies failed."
+                    continue
+                }
+            fi
         fi
 
        mods_to_load+=" $mod "
@@ -546,8 +554,8 @@ check_modules() {
     modcheck=$add_dracutmodules
     [[ $dracutmodules != all ]] && modcheck="$m $dracutmodules"
     for mod in $modcheck; do
-        strstr "$mods_to_load" "$mod" && continue
-        strstr "$omit_dracutmodules" "$mod" && continue
+        strstr " $mods_to_load " " $mod " && continue
+        strstr " $omit_dracutmodules " " $mod " && continue
         dwarning "Dracut module \"$mod\" cannot be found."
     done
 }