]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
combine --skip-missing to /check infrastructure
authorSeewer Philippe <philippe.seewer@bfh.ch>
Sat, 7 Mar 2009 11:59:13 +0000 (12:59 +0100)
committerHarald Hoyer <harald@redhat.com>
Sat, 7 Mar 2009 12:10:03 +0000 (13:10 +0100)
This patch introduces --skip-missing to skip modules failing /check,
allowing to use the check infrastructure not only for
dracutmodules="auto".

Result: dracutmodules="auto" becomes obsolete, automatically setting
dracutmodules="all" and skipmissing="yes"

Patch is built on top of Harald Hoyers merge tree
(git://git.surfsite.org/pub/git/dracut.git)

dracut

diff --git a/dracut b/dracut
index d1167e53073671028bfebd94d1ec5f13d3850352..2911c9fb801f3021a2b77a085b638082f2da168a 100755 (executable)
--- a/dracut
+++ b/dracut
@@ -18,7 +18,7 @@ while (($# > 0)); do
        -v|--verbose) set -x;;
        -c|--conf) conffile="$2"; shift;;
        -l|--local) allowlocal="yes" ;;
-       --allow-missing) : ;;
+       --skip-missing) skipmissing="yes" ;;
        *) break ;;
     esac
     shift
@@ -32,7 +32,11 @@ done
 [[ $allowlocal && -f dracut-functions ]] && dsrc="." || dsrc=/usr/lib/dracut
 . $dsrc/dracut-functions
 
-[[ $dracutmodules ]] || dracutmodules="all" 
+[[ $dracutmodules ]] || dracutmodules="auto" 
+[[ $dracutmodules = "auto" ]] && {
+    dracutmodules="all"
+    skipmissing="yes"
+}
 
 
 [[ $2 ]] && kernel=$2 || kernel=$(uname -r)
@@ -59,12 +63,16 @@ can_source_module() {
     # $1 = location of module
     mod=${1##*/}; mod=${mod#[0-9][0-9]};
     case $dracutmodules in
-       all) return 0;;
-       auto) [[ -x $1/check ]] || return 0
-           "$1/check" >/dev/null 2>&1 && return 0 ;;
-       *) strstr "$dracutmodules " "$mod " && return 0;;
+       all) [[ $skipmissing ]] || return 0;;
+       *) strstr "$dracutmodules " "$mod " || return 1;;
     esac
-    return 1
+
+    [[ $skipmissing ]] && [[ -x $1/check ]] && {
+        return $("$1/check" >/dev/null 2>&1);
+    }
+
+    [[ $skipmissing ]] || return 1
+    return 0
 }
 
 # source all our modules