From e314863e67ffb6202985cd368f9cf2111db816c3 Mon Sep 17 00:00:00 2001 From: Victor Lowther Date: Sat, 30 May 2009 16:16:34 -0500 Subject: [PATCH] Several updates to make dracut a bit more robust. First, add a check script to 99base to ensure that it will load its prerequisites. Second, disable the udev magic dracut normally uses when generating test images -- it was causing random failures when creating the test root filesystem, presumably due to race conditions between the rootfs creation scripts and udev. Third, consolidate the rootfs creation scripts into one script. --- modules.d/90kernel-modules/install | 3 ++- modules.d/99base/check | 3 +++ modules.d/99base/install | 4 +--- test/TEST-10-RAID/copy-root.sh | 2 -- test/TEST-10-RAID/create-root.sh | 22 +++++++++++++++++++--- test/TEST-10-RAID/halt.sh | 5 ----- test/TEST-10-RAID/test.sh | 5 +---- 7 files changed, 26 insertions(+), 18 deletions(-) create mode 100755 modules.d/99base/check delete mode 100755 test/TEST-10-RAID/copy-root.sh delete mode 100755 test/TEST-10-RAID/halt.sh diff --git a/modules.d/90kernel-modules/install b/modules.d/90kernel-modules/install index ebd3f1b49..d1c430e7b 100755 --- a/modules.d/90kernel-modules/install +++ b/modules.d/90kernel-modules/install @@ -1,6 +1,7 @@ #!/bin/bash # FIXME: hard-coded module list of doom. -instmods =ata =block sd_mod =fs +[[ $drivers ]] || drivers="=block sd_mod =fs" +instmods $drivers [ -f /etc/modprobe.conf ] && dracut_install /etc/modprobe.conf dracut_install $(find /etc/modprobe.d/ -type f -name '*.conf') diff --git a/modules.d/99base/check b/modules.d/99base/check new file mode 100755 index 000000000..5c3bc510f --- /dev/null +++ b/modules.d/99base/check @@ -0,0 +1,3 @@ +#!/bin/bash +[[ $1 = -d ]] && echo udev-rules kernel-modules +exit 0 \ No newline at end of file diff --git a/modules.d/99base/install b/modules.d/99base/install index 27b07a431..682004e2b 100755 --- a/modules.d/99base/install +++ b/modules.d/99base/install @@ -1,5 +1,5 @@ #!/bin/bash -dracut_install mount mknod mkdir modprobe pidof sleep chroot echo sed ls flock +dracut_install mount mknod mkdir modprobe pidof sleep chroot sed ls flock if [ ! -e "${initdir}/bin/sh" ]; then dracut_install bash (ln -s bash "${initdir}/bin/sh" || :) @@ -14,5 +14,3 @@ fi inst "$moddir/switch_root" "/sbin/switch_root" inst "$moddir/dracut-lib" "/lib/dracut-lib" inst_hook pre-pivot 50 "$moddir/selinux-loadpolicy.sh" -# Install any drivers specified from .conf or --drivers -instmods ${drivers} diff --git a/test/TEST-10-RAID/copy-root.sh b/test/TEST-10-RAID/copy-root.sh deleted file mode 100755 index d183aa65d..000000000 --- a/test/TEST-10-RAID/copy-root.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -cp -a -t "$NEWROOT" /source/* diff --git a/test/TEST-10-RAID/create-root.sh b/test/TEST-10-RAID/create-root.sh index 29f349c9a..89f1515a4 100755 --- a/test/TEST-10-RAID/create-root.sh +++ b/test/TEST-10-RAID/create-root.sh @@ -1,11 +1,20 @@ #!/bin/sh +# don't let udev and this script step on eachother's toes +for x in 63-luks.rules 64-lvm.rules 70-mdadm.rules 99-mount-rules; do + > "/etc/udev/rules.d/$x" +done +udevadm control --reload-rules +# save a partition at the beginning for future flagging purposes sfdisk -C 640 -H 2 -S 32 -L /dev/sda <keyfile cryptsetup -q luksFormat /dev/md0 /keyfile echo "The passphrase is test" @@ -13,6 +22,13 @@ cryptsetup luksOpen /dev/md0 dracut_crypt_test