Browse Source

Update check scripts in modules to make them work again.

Also got rid of "dracutmodules=hostonly".  We have --hostonly, and it
does the same thing.
master
Victor Lowther 15 years ago
parent
commit
66ac3cd1f0
  1. 20
      dracut
  2. 2
      modules.d/10redhat-i18n/check
  3. 8
      modules.d/40nfsroot/check
  4. 6
      modules.d/90crypt/check
  5. 10
      modules.d/90dmraid/check
  6. 5
      modules.d/90kernel-modules-loaded/check
  7. 7
      modules.d/90lvm/check
  8. 9
      modules.d/90mdraid/check
  9. 1
      modules.d/95udev-rules.ub810/check

20
dracut

@ -83,16 +83,9 @@ fi @@ -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/ @@ -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


2
modules.d/10redhat-i18n/check

@ -1,2 +1,2 @@ @@ -1,2 +1,2 @@
#!/bin/bash
#!/bin/sh
[ -f /etc/redhat-release ]

8
modules.d/40nfsroot/check

@ -1,5 +1,11 @@ @@ -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

6
modules.d/90crypt/check

@ -1,8 +1,12 @@ @@ -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


10
modules.d/90dmraid/check

@ -1,7 +1,13 @@ @@ -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


5
modules.d/90kernel-modules-loaded/check

@ -1,3 +1,6 @@ @@ -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 ]]


7
modules.d/90lvm/check

@ -1,7 +1,12 @@ @@ -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


9
modules.d/90mdraid/check

@ -1,7 +1,12 @@ @@ -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


1
modules.d/95udev-rules.ub810/check

@ -1,2 +1,3 @@ @@ -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

Loading…
Cancel
Save