From fe9143d9ca9a7c8142f111b261a1a5950c66ea44 Mon Sep 17 00:00:00 2001 From: Victor Lowther Date: Sat, 23 May 2009 22:29:46 -0700 Subject: [PATCH] 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. --- modules.d/00test/install | 5 ----- test/TEST-10-RAID/copy-root.sh | 2 ++ test/TEST-10-RAID/create-root.sh | 19 +++++++++++++++++++ test/TEST-10-RAID/halt.sh | 5 +++++ test/TEST-10-RAID/test.sh | 24 +++++++++++++++--------- 5 files changed, 41 insertions(+), 14 deletions(-) delete mode 100755 modules.d/00test/install create mode 100755 test/TEST-10-RAID/copy-root.sh create mode 100755 test/TEST-10-RAID/create-root.sh create mode 100755 test/TEST-10-RAID/halt.sh diff --git a/modules.d/00test/install b/modules.d/00test/install deleted file mode 100755 index f534a1c4..00000000 --- a/modules.d/00test/install +++ /dev/null @@ -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" \ No newline at end of file diff --git a/test/TEST-10-RAID/copy-root.sh b/test/TEST-10-RAID/copy-root.sh new file mode 100755 index 00000000..fe9f57ae --- /dev/null +++ b/test/TEST-10-RAID/copy-root.sh @@ -0,0 +1,2 @@ +#!/bin/sh +cp -a -t "$NEWROOT" /source/* \ No newline at end of file diff --git a/test/TEST-10-RAID/create-root.sh b/test/TEST-10-RAID/create-root.sh new file mode 100755 index 00000000..b6f49126 --- /dev/null +++ b/test/TEST-10-RAID/create-root.sh @@ -0,0 +1,19 @@ +#!/bin/sh +sfdisk -C 640 -H 2 -S 32 -L /dev/sda <keyfile +cryptsetup -q luksFormat /dev/md0 /keyfile +echo "The passphrase is test" +cryptsetup luksOpen /dev/md0 dracut_crypt_test /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 \ No newline at end of file +. $testdir/test-functions