add hostonly check procedure
authorHarald Hoyer <harald@redhat.com>
Sat, 7 Mar 2009 13:01:32 +0000 (14:01 +0100)
committerHarald Hoyer <harald@redhat.com>
Sat, 7 Mar 2009 13:01:32 +0000 (14:01 +0100)
dracut
modules.d/90crypt/check
modules.d/90dmraid/check
modules.d/90kernel-modules-loaded/check
modules.d/90lvm/check [new file with mode: 0755]
modules.d/90mdraid/check [new file with mode: 0755]
modules.d/95udev-rules.ub810/check

diff --git a/dracut b/dracut
index 2911c9f..1172ebb 100755 (executable)
--- a/dracut
+++ b/dracut
@@ -18,6 +18,7 @@ while (($# > 0)); do
        -v|--verbose) set -x;;
        -c|--conf) conffile="$2"; shift;;
        -l|--local) allowlocal="yes" ;;
+       -h|--hostonly) hostonly="-h" ;;
        --skip-missing) skipmissing="yes" ;;
        *) break ;;
     esac
@@ -31,6 +32,8 @@ done
 
 [[ $allowlocal && -f dracut-functions ]] && dsrc="." || dsrc=/usr/lib/dracut
 . $dsrc/dracut-functions
+dracutfunctions=$dsrc/dracut-functions
+export dracutfunctions
 
 [[ $dracutmodules ]] || dracutmodules="auto" 
 [[ $dracutmodules = "auto" ]] && {
@@ -38,6 +41,11 @@ done
     skipmissing="yes"
 }
 
+[[ $dracutmodules = "hostonly" ]] && {
+    dracutmodules="all"
+    skipmissing="yes"
+    hostonly="-h"
+}
 
 [[ $2 ]] && kernel=$2 || kernel=$(uname -r)
 [[ $1 ]] && outfile=$(readlink -f $1) || outfile="/boot/initrd-$kernel.img"
@@ -68,7 +76,7 @@ can_source_module() {
     esac
 
     [[ $skipmissing ]] && [[ -x $1/check ]] && {
-        return $("$1/check" >/dev/null 2>&1);
+        return $("$1/check" $hostonly >/dev/null 2>&1;)
     }
 
     [[ $skipmissing ]] || return 1
index 736198e..505142e 100755 (executable)
@@ -1,3 +1,11 @@
 #!/bin/sh
-grep -q '^dm_crypt' /proc/modules || exit 1
-awk '/^dm_crypt/ {if ($3 > 0) exit 0; else exit 1;}' /proc/modules
\ No newline at end of file
+
+[[ $dracutfunctions ]] && . $dracutfunctions
+
+find_binary cryptsetup || exit 1
+
+if [ "$1" = "-h" ]; then
+    blkid | grep -q crypt_LUKS || exit 1
+fi
+
+exit 0
index 632c28b..ee5c326 100755 (executable)
@@ -1,3 +1,11 @@
 #!/bin/sh
-grep -q '^dm_mod' /proc/modules || exit 1
-awk '/^dm_mod/ {if ($3 > 0) exit 0; else exit 1;}' /proc/modules
\ No newline at end of file
+
+[[ $dracutfunctions ]] && . $dracutfunctions
+
+dmraid=$(find_binary dmraid) || exit 1
+
+if [ "$1" = "-h" ]; then
+    $dmraid -r | grep -q ok || exit 1
+fi
+
+exit 0
\ No newline at end of file
index 2bb8d86..2160f4d 100755 (executable)
@@ -1,3 +1,3 @@
 #!/bin/sh
 
-exit 1
+[ "$1" != "-h" ] && exit 1
diff --git a/modules.d/90lvm/check b/modules.d/90lvm/check
new file mode 100755 (executable)
index 0000000..a8b1e5d
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+[[ $dracutfunctions ]] && . $dracutfunctions
+
+find_binary lvm || exit 1
+
+if [ "$1" = "-h" ]; then
+    blkid | grep -q lvm2pv || exit 1
+fi
+
+exit 0
diff --git a/modules.d/90mdraid/check b/modules.d/90mdraid/check
new file mode 100755 (executable)
index 0000000..414cc2b
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+[[ $dracutfunctions ]] && . $dracutfunctions
+
+find_binary mdadm || exit 1
+
+if [ "$1" = "-h" ]; then
+    blkid | grep -q linux_raid || exit 1
+fi
+
+exit 0
index 2bb8d86..318185f 100755 (executable)
@@ -1,3 +1,4 @@
 #!/bin/sh
 
-exit 1
+[ -f /etc/lsb-release ] && \ 
+grep -q 'DISTRIB_DESCRIPTION="Ubuntu 8.10"' /etc/lsb-release
\ No newline at end of file