From: Victor Lowther Date: Thu, 21 May 2009 02:55:13 +0000 (-0700) Subject: Create test image on an md array and improve cryptroot handling X-Git-Tag: 0.1~210 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4957ab92f23245a260ef96026ccee7cafd6e104d;p=thirdparty%2Fdracut.git Create test image on an md array and improve cryptroot handling If we purport to test booting to an md raid, we may as well test it. We do not need the plymouth module and the normal crypt module to include duplicate functionality. --- diff --git a/Makefile b/Makefile index bd57c96e4..d46dc8aac 100644 --- a/Makefile +++ b/Makefile @@ -23,6 +23,7 @@ clean: rm -f modules.d/99base/switch_root rm -f test-*.img rm -f test/initramfs.* + rm -f test/root.ext2 archive: dracut-$(VERSION)-$(GITVERSION).tar.bz2 diff --git a/modules.d/00test/create-root.sh b/modules.d/00test/create-root.sh index c756f4f5f..29c6f95c2 100755 --- a/modules.d/00test/create-root.sh +++ b/modules.d/00test/create-root.sh @@ -1,14 +1,15 @@ #!/bin/sh -sfdisk /dev/sda <keyfile -cryptsetup -q luksFormat /dev/sda1 /keyfile +cryptsetup -q luksFormat /dev/md0 /keyfile echo "The passphrase is test" -cryptsetup luksOpen /dev/sda1 dracut_crypt_test /dev/console 2>&1 +{ flock -s 9; + /sbin/cryptsetup luksOpen -T1 $1 $2 /dev/console 2>&1 } 9>/.console.lock diff --git a/modules.d/90crypt/install b/modules.d/90crypt/install index a1e7b0197..fcaaa6082 100755 --- a/modules.d/90crypt/install +++ b/modules.d/90crypt/install @@ -2,4 +2,4 @@ inst cryptsetup instmods dm_crypt cbc aes sha256 xts inst_rules "$moddir/63-luks.rules" -inst "$moddir"/cryptroot-ask.sh /lib/udev/cryptroot-ask +inst "$moddir"/cryptroot-ask.sh /sbin/cryptroot-ask diff --git a/modules.d/90mdraid/70-mdadm.rules b/modules.d/90mdraid/70-mdadm.rules index bd116338c..ae54c96de 100644 --- a/modules.d/90mdraid/70-mdadm.rules +++ b/modules.d/90mdraid/70-mdadm.rules @@ -2,5 +2,11 @@ # automatically cause mdadm to be run. # See udev(8) for syntax -SUBSYSTEM=="block", ACTION=="add|change", ENV{ID_FS_TYPE}=="linux_raid*", \ - RUN+="/sbin/mdadm -I --auto=yes $root/%k" +SUBSYSTEM!="block", GOTO="raid_end" +ACTION!="add|change", GOTO="raid_end" +KERNEL=="md/*", GOTO="raid_end" + +KERNEL!="sr*", IMPORT{program}="vol_id --export $tempnode" +ENV{ID_FS_TYPE}=="linux_raid_member", RUN+="/sbin/mdadm -IR $root/%k" + +LABEL="raid_end" diff --git a/modules.d/90mdraid/install b/modules.d/90mdraid/install index 41982f9b2..1885f7ca5 100755 --- a/modules.d/90mdraid/install +++ b/modules.d/90mdraid/install @@ -1,8 +1,11 @@ #!/bin/bash dracut_install mdadm +inst /etc/passwd +inst /etc/group +instmods =drivers/md [ -x /sbin/mdmon ] && dracut_install mdmon inst_rules "$moddir/70-mdadm.rules" -[ -f /etc/mdadm/mdadm.conf ] && inst /etc/mdadm/mdadm.conf "$initdir" /etc/mdadm.conf -[ -f /etc/mdadm.conf ] && inst /etc/mdadm.conf "$initdir" +[ -f /etc/mdadm/mdadm.conf ] && inst /etc/mdadm/mdadm.conf /etc/mdadm.conf +[ -f /etc/mdadm.conf ] && inst /etc/mdadm.conf inst_hook pre-pivot 30 "$moddir/mdmon-pre-pivot.sh" diff --git a/test/make-test-root b/test/make-test-root index fdc14dffd..93d9e0f15 100755 --- a/test/make-test-root +++ b/test/make-test-root @@ -25,7 +25,7 @@ unset initdir # results in cryptsetup not being able to unlock the LVM PV. # Probably a bug in cryptsetup, but... ./dracut -l -i "$targetfs" /source \ - -m "dash kernel-modules test crypt lvm udev-rules base rootfs-block" \ + -m "dash kernel-modules test crypt lvm mdraid udev-rules base rootfs-block" \ -d "ata_piix ext2 sd_mod" \ -f test/initramfs.makeroot