]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
Several updates to make dracut a bit more robust.
authorVictor Lowther <victor.lowther@gmail.com>
Sat, 30 May 2009 21:16:34 +0000 (16:16 -0500)
committerVictor Lowther <victor.lowther@gmail.com>
Sat, 30 May 2009 21:53:12 +0000 (16:53 -0500)
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
modules.d/99base/check [new file with mode: 0755]
modules.d/99base/install
test/TEST-10-RAID/copy-root.sh [deleted file]
test/TEST-10-RAID/create-root.sh
test/TEST-10-RAID/halt.sh [deleted file]
test/TEST-10-RAID/test.sh

index ebd3f1b4983e8c300e9623ec0cb824bffa035f3c..d1c430e7b4d49e26d30d75727e429d4ce0b7e307 100755 (executable)
@@ -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 (executable)
index 0000000..5c3bc51
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/bash
+[[ $1 = -d ]] && echo udev-rules kernel-modules
+exit 0
\ No newline at end of file
index 27b07a4316f940b904a7513d6e3a4d0d83971f08..682004e2b227b9f0d03c2c55b14927e9514e19e5 100755 (executable)
@@ -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 (executable)
index d183aa6..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-cp -a -t "$NEWROOT" /source/*
index 29f349c9a9319f41a245ec758e367c2482a3570b..89f1515a4fb137e377a92a9b798908e9499588d5 100755 (executable)
@@ -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 <<EOF
+,1
 ,213
 ,213
 ,213
-;
 EOF
-mdadm --create /dev/md0 --run --auto=yes --level=5 --raid-devices=3 /dev/sda1 /dev/sda2 /dev/sda3
+mdadm --create /dev/md0 --run --auto=yes --level=5 --raid-devices=3 /dev/sda2 /dev/sda3 /dev/sda4
+# wait for the array to finish initailizing, otherwise this sometimes fails
+# randomly.
+mdadm -W /dev/md0
 echo -n test >keyfile
 cryptsetup -q luksFormat /dev/md0 /keyfile
 echo "The passphrase is test"
@@ -13,6 +22,13 @@ cryptsetup luksOpen /dev/md0 dracut_crypt_test </keyfile
 lvm pvcreate -ff  -y /dev/mapper/dracut_crypt_test
 lvm vgcreate dracut /dev/mapper/dracut_crypt_test
 lvm lvcreate -l 100%FREE -n root dracut
-udevadm settle --timeout=4
+lvm vgchange -ay
 [ -b /dev/dracut/root ] || emergency_shell
 mke2fs /dev/dracut/root
+mkdir -p /sysroot
+mount /dev/dracut/root /sysroot
+cp -a -t /sysroot /source/*
+umount /sysroot
+lvm lvchange -a n /dev/dracut/root
+cryptsetup luksClose /dev/mapper/dracut_crypt_test
+poweroff -f
diff --git a/test/TEST-10-RAID/halt.sh b/test/TEST-10-RAID/halt.sh
deleted file mode 100755 (executable)
index 5d51e8b..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-umount "$NEWROOT"
-lvm lvchange -a n /dev/dracut/root
-cryptsetup luksClose /dev/mapper/dracut_crypt_test
-poweroff -f
\ No newline at end of file
index 34507aab22802c64b85521ca88320f2bfc33f915..cc75ed3a33878f96ac70e57352006b67396f92ff 100755 (executable)
@@ -3,8 +3,7 @@ TEST_DESCRIPTION="root filesystem on an encrypted LVM PV"
 
 test_run() {
     $testdir/run-qemu -hda root.ext2 -m 512M -nographic \
-       -net nic,macaddr=52:54:00:12:34:57 -net socket,mcast=230.0.0.1:1234 \
-       -kernel /boot/vmlinuz-$(uname -r) \
+       -net none -kernel /boot/vmlinuz-$(uname -r) \
        -append "root=/dev/dracut/root rw console=ttyS0,115200n81" \
        -initrd initramfs.testing
 }
@@ -33,8 +32,6 @@ test_setup() {
        initdir=overlay
        . $basedir/dracut-functions
        dracut_install sfdisk mke2fs poweroff cp umount 
-       inst_simple ./halt.sh /pre-pivot/02halt.sh
-       inst_simple ./copy-root.sh /mount/01copy-root.sh
        inst_simple ./create-root.sh /pre-mount/01create-root.sh
     )