]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
Move content of 00test module into the test subdir
authorVictor Lowther <victor.lowther@gmail.com>
Sun, 24 May 2009 05:29:46 +0000 (22:29 -0700)
committerHarald Hoyer <harald@redhat.com>
Mon, 25 May 2009 15:49:56 +0000 (17:49 +0200)
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 [deleted file]
test/TEST-10-RAID/copy-root.sh [new file with mode: 0755]
test/TEST-10-RAID/create-root.sh [new file with mode: 0755]
test/TEST-10-RAID/halt.sh [new file with mode: 0755]
test/TEST-10-RAID/test.sh

diff --git a/modules.d/00test/install b/modules.d/00test/install
deleted file mode 100755 (executable)
index f534a1c..0000000
+++ /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 (executable)
index 0000000..fe9f57a
--- /dev/null
@@ -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 (executable)
index 0000000..b6f4912
--- /dev/null
@@ -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
diff --git a/test/TEST-10-RAID/halt.sh b/test/TEST-10-RAID/halt.sh
new file mode 100755 (executable)
index 0000000..5d51e8b
--- /dev/null
@@ -0,0 +1,5 @@
+#!/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 a854a4e2daf91d71b54c1e00cbcf60ddb90c66b0..e344ecf860111af7582317225d193a6979b9cb8f 100755 (executable)
@@ -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
\ No newline at end of file
+. $testdir/test-functions