Move content of 00test module into the test subdir

The last changes made the 00test module really awkward anyways, so just
hack the test module into the initramfs in a slight more brutal fashion.
This commit is contained in:
Victor Lowther 2009-05-23 22:29:46 -07:00 committed by Harald Hoyer
parent 0c2e3d1221
commit fe9143d9ca
5 changed files with 41 additions and 14 deletions

View File

@ -1,5 +0,0 @@
#!/bin/sh
dracut_install sfdisk mke2fs poweroff cp umount e2mkdir
inst_hook pre-pivot 02 "$moddir/halt.sh"
inst_hook pre-pivot 01 "$moddir/copy-root.sh"
inst_hook pre-mount 01 "$moddir/create-root.sh"

2
test/TEST-10-RAID/copy-root.sh Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh
cp -a -t "$NEWROOT" /source/*

View File

@ -0,0 +1,19 @@
#!/bin/sh
sfdisk -C 640 -H 2 -S 32 -L /dev/sda <<EOF
,213
,213
,213
;
EOF
mdadm --create /dev/md0 --run --auto=yes --level=5 --raid-devices=3 /dev/sda1 /dev/sda2 /dev/sda3
echo -n test >keyfile
cryptsetup -q luksFormat /dev/md0 /keyfile
echo "The passphrase is test"
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
[ -b /dev/dracut/root ] || emergency_shell
mke2fs /dev/dracut/root
e2mkdir /dev/dracut/root:/proc

5
test/TEST-10-RAID/halt.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/sh
umount "$NEWROOT"
lvm lvchange -a n /dev/dracut/root
cryptsetup luksClose /dev/mapper/dracut_crypt_test
poweroff -f

View File

@ -1,7 +1,5 @@
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 \
@ -14,7 +12,7 @@ test_setup() {
# This script creates a root filesystem on an encrypted LVM PV
dd if=/dev/zero of=root.ext2 bs=1M count=20
initdir=mnt
initdir=overlay/source
kernel=$(uname -r)
(
. $basedir/dracut-functions
@ -27,14 +25,22 @@ test_setup() {
find_binary plymouth >/dev/null && dracut_install plymouth
(cd "$initdir"; mkdir -p dev sys proc etc var/run tmp )
)
targetfs="$initdir"
unset initdir
# second, install the files needed to make the root filesystem
(
initdir=overlay
. $basedir/dracut-functions
dracut_install sfdisk mke2fs poweroff cp umount e2mkdir
inst_simple ./halt.sh /pre-pivot/02halt.sh
inst_simple ./copy-root.sh /pre-pivot/01copy-root.sh
inst_simple ./create-root.sh /pre-mount/01create-root.sh
)
# create an initramfs that will create the target root filesystem.
# We do it this way because creating it directly in the host OS
# results in cryptsetup not being able to unlock the LVM PV.
# Probably a bug in cryptsetup, but...
$basedir/dracut -l -i "$targetfs" /source \
$basedir/dracut -l -i overlay / \
-m "dash kernel-modules test crypt lvm mdraid udev-rules base rootfs-block" \
-d "ata_piix ext2 sd_mod" \
-f initramfs.makeroot || return 1
@ -49,8 +55,8 @@ test_setup() {
}
test_cleanup() {
rm -fr mnt
rm -fr overlay mnt
rm -f root.ext2 initramfs.makeroot initramfs.testing
}
. $testdir/test-functions
. $testdir/test-functions