]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
Update check scripts in modules to make them work again.
authorVictor Lowther <victor.lowther@gmail.com>
Sat, 30 May 2009 03:14:31 +0000 (22:14 -0500)
committerVictor Lowther <victor.lowther@gmail.com>
Sat, 30 May 2009 04:07:15 +0000 (23:07 -0500)
Also got rid of "dracutmodules=hostonly".  We have --hostonly, and it
does the same thing.

dracut
modules.d/10redhat-i18n/check
modules.d/40nfsroot/check
modules.d/90crypt/check
modules.d/90dmraid/check
modules.d/90kernel-modules-loaded/check
modules.d/90lvm/check
modules.d/90mdraid/check
modules.d/95udev-rules.ub810/check

diff --git a/dracut b/dracut
index dba68171741f722b0ff3b70674c396bf038c7197..f25cf850434a59e73f8aa4429b1f6075fbac4cde 100755 (executable)
--- a/dracut
+++ b/dracut
@@ -83,16 +83,9 @@ fi
 dracutfunctions=$dsrc/dracut-functions
 export dracutfunctions
 
-# this logic is weird and convoluted.  We should simplify it.
-# seriously, wtf?
+# This is kinda legacy -- eventually it should go away.
 case $dracutmodules in
-       ""|auto)
-               dracutmodules="all"
-               ;;
-       hostonly)
-               dracutmodules="all"
-               hostonly="-H"
-               ;;
+    ""|auto) dracutmodules="all" ;;
 esac
 
 [[ $2 ]] && kernel=$2 || kernel=$(uname -r)
@@ -118,15 +111,20 @@ for d in bin sbin usr/bin usr/sbin usr/lib etc proc sys sysroot tmp dev/pts var/
     mkdir -p "$initdir/$d"; 
 done
 
-# check all our modules to see if they should be sourced
+# check all our modules to see if they should be sourced.
+# This builds a list of modules that we will install next.
 check_modules
   
 #source our modules.
 for moddir in "$dsrc/modules.d"/[0-9][0-9]*; do
     mod=${moddir##*/}; mod=${mod#[0-9][0-9]}
-    strstr "$mods_to_load" " $mod " && . "$moddir/install"
+    if strstr "$mods_to_load" " $mod "; then
+       . "$moddir/install"
+       mods_to_load=${mods_to_load// $mod /}
+    fi
 done
 unset moddir
+echo $mods_to_load
 
 ## final stuff that has to happen
 
index 3e98c3694e5992375d2a7dd6f679c5b5997308bb..650cb40b24b160a3fa271e159ad3b224fa6cd642 100755 (executable)
@@ -1,2 +1,2 @@
-#!/bin/bash
+#!/bin/sh
 [ -f /etc/redhat-release ]
\ No newline at end of file
index 4abc23feae2a4a464a1d8638af5c1049094fe241..0625322ee8349f57e9ac251177a6e75a13cbd80d 100755 (executable)
@@ -1,5 +1,11 @@
 #!/bin/sh
+# We depend on network modules being loaded
 [ "$1" = "-d" ] && echo network
-[ "$1" = "-H" ] && ! egrep -q '/ nfs[34 ]' /proc/mounts && exit 1
+
+# If hostonly was requested, fail the check if we are not actually
+# booting from root.
+[ "$1" = "-h" ] && ! egrep -q '/ nfs[34 ]' /proc/mounts && exit 1
+
+# If our prerequisites are not met, fail anyways.
 which rpcbind rpc.statd mount.nfs mount.nfs4 umount >/dev/null 2>&1 || exit 1
 exit 0
index 8457f8536362269904a92bb94432fe6cf55ba3bd..2297e0f9877727f6527ee6ee3cc4820bf3aa15eb 100755 (executable)
@@ -1,8 +1,12 @@
 #!/bin/sh
 
+# if cryptsetup is not installed, then we cannot support encrypted devices.
 which cryptsetup >/dev/null 2>&1 || exit 1
 
-if [ "$1" = "-H" ]; then
+# hostonly checking should only return true if root is on a LUKS device
+# in some way, but I am too lazy to figure out how to do that.
+# Instead, fail if we do not have a LUKS device in use somewhere.
+if [ "$1" = "-h" ] ; then
     blkid | grep -q crypt_LUKS || exit 1
 fi
 
index 67051db885c1762ef6d346f3cb5ec5b62b86c8ea..45e14052e99ff30d7d3920f7b681c1eb4c97df4a 100755 (executable)
@@ -1,7 +1,13 @@
-#!/bin/sh
+#!/bin/bash
+
+# if we don't have dmraid installed on the host system, no point
+# in trying to support it in the initramfs.
 which dmraid >/dev/null 2>&1 || exit 1
 
-if [ "$1" = "-H" ]; then
+# Hostonly checking should really fail if the root device is not on a 
+# dmraid volume.  I am lazy.  Therefore, fail the hostonly check only
+# if we are not using dmraid right now.
+if [[ $1 = -h ]]; then
     dmraid -r | grep -q ok || exit 1
 fi
 
index 44be0a0103fb911ae49e2549de8e412f9ba91b2d..2d4bd6f4bffbced62135f2e713c538f6b3c4352c 100755 (executable)
@@ -1,3 +1,6 @@
 #!/bin/sh
 
-[ "$1" = "-H" ] && exit 1
+# Install all loaded modules in the initramfs if we are building a 
+# hostonly initramfs
+[[ $1 = -h ]]
+
index a5ce6a57248660264d80310b202c2c1c9a3d9386..35f9344a1fa0530ef74f40a162909dc5c35affa8 100755 (executable)
@@ -1,7 +1,12 @@
 #!/bin/sh
+
+# No point trying to support lvm if the binaries are missing
 which lvm >/dev/null 2>&1 || exit 1
 
-if [ "$1" = "-H" ]; then
+# We should really just check to see if root is on a logical volume
+# when running in hostonly mode. I am lazy. Therefore, fail the hostonly
+# check unless there is a logical volume in use somewhere.
+if [ "$1" = "-H" ] || [ "$1" = "--hostonly" ]; then
     blkid | grep -q lvm2pv || exit 1
 fi
 
index 0d0605a245e625a5c37d855d528ca5681b8fe906..f6a22f10eb4d3bdaf46874d10e2c32b3fc870662 100755 (executable)
@@ -1,7 +1,12 @@
-#!/bin/sh
+#!/bin/bash
+
+# No mdadm?  No mdraid support.
 which mdadm >/dev/null 2>&1 || exit 1
 
-if [ "$1" = "-H" ]; then
+# We were asked to run in hostonly mode, so pass the check only if there
+# is an mdraid volume in use somewhere. This should really check to see if
+# root is on an mdraid volume only, but I am lazy.
+if [[ $1 = -h ]]; then
     blkid | grep -q linux_raid || exit 1
 fi
 
index 36bad42ca3e26791c35be2b3e662af6b02a499b9..54501f341213f2689655d702e3bba04c1c4d4d22 100755 (executable)
@@ -1,2 +1,3 @@
 #!/bin/sh
+# if we are not running Ubuntu 8.10, then we don't need to load this module.
 [ -f /etc/lsb-release ] && grep -q "Ubuntu 8.10" /etc/lsb-release 2>/dev/null