From: Harald Hoyer Date: Sat, 7 Mar 2009 13:01:32 +0000 (+0100) Subject: add hostonly check procedure X-Git-Tag: 0.1~303 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5cad5bb50e9775cc5c09aaa2d9c0dc4c605787d3;p=thirdparty%2Fdracut.git add hostonly check procedure --- diff --git a/dracut b/dracut index 2911c9fb8..1172ebbe1 100755 --- 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 diff --git a/modules.d/90crypt/check b/modules.d/90crypt/check index 736198e69..505142e8d 100755 --- a/modules.d/90crypt/check +++ b/modules.d/90crypt/check @@ -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 diff --git a/modules.d/90dmraid/check b/modules.d/90dmraid/check index 632c28bc9..ee5c3260c 100755 --- a/modules.d/90dmraid/check +++ b/modules.d/90dmraid/check @@ -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 diff --git a/modules.d/90kernel-modules-loaded/check b/modules.d/90kernel-modules-loaded/check index 2bb8d868b..2160f4d95 100755 --- a/modules.d/90kernel-modules-loaded/check +++ b/modules.d/90kernel-modules-loaded/check @@ -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 index 000000000..a8b1e5d0d --- /dev/null +++ b/modules.d/90lvm/check @@ -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 index 000000000..414cc2bbf --- /dev/null +++ b/modules.d/90mdraid/check @@ -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 diff --git a/modules.d/95udev-rules.ub810/check b/modules.d/95udev-rules.ub810/check index 2bb8d868b..318185fc7 100755 --- a/modules.d/95udev-rules.ub810/check +++ b/modules.d/95udev-rules.ub810/check @@ -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