]>
Commit | Line | Data |
---|---|---|
c9f0e1f9 | 1 | #!/bin/bash |
4a4c8823 | 2 | TEST_DESCRIPTION="root filesystem on an encrypted LVM PV on a RAID-5" |
c00f04f5 | 3 | |
58c13eeb DD |
4 | KVERSION=${KVERSION-$(uname -r)} |
5 | ||
65bedc83 | 6 | # Uncomment this to debug failures |
fa7ada31 | 7 | #DEBUGFAIL="rd.shell" |
c00f04f5 | 8 | test_run() { |
cf522919 | 9 | DISKIMAGE=$TESTDIR/TEST-10-RAID-root.img |
0be1785a HH |
10 | $testdir/run-qemu \ |
11 | -hda $DISKIMAGE \ | |
12 | -m 256M -nographic \ | |
58c13eeb | 13 | -net none -kernel /boot/vmlinuz-$KVERSION \ |
fa7ada31 | 14 | -append "root=/dev/dracut/root rw quiet rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.debug $DEBUGFAIL" \ |
0be1785a | 15 | -initrd $TESTDIR/initramfs.testing |
ceaf49d7 | 16 | grep -m 1 -q dracut-root-block-success $DISKIMAGE || return 1 |
c00f04f5 HH |
17 | } |
18 | ||
19 | test_setup() { | |
cf522919 | 20 | DISKIMAGE=$TESTDIR/TEST-10-RAID-root.img |
33310321 | 21 | # Create the blank file to use as a root filesystem |
0be1785a | 22 | rm -f $DISKIMAGE |
ceaf49d7 | 23 | dd if=/dev/null of=$DISKIMAGE bs=1M seek=40 |
c00f04f5 | 24 | |
58c13eeb | 25 | kernel=$KVERSION |
33310321 | 26 | # Create what will eventually be our root filesystem onto an overlay |
c00f04f5 | 27 | ( |
0be1785a | 28 | initdir=$TESTDIR/overlay/source |
96d22bd7 | 29 | (mkdir -p "$initdir"; cd "$initdir"; mkdir -p dev sys proc etc var/run tmp run) |
552ecca6 | 30 | . $basedir/dracut-functions.sh |
c00f04f5 | 31 | dracut_install sh df free ls shutdown poweroff stty cat ps ln ip route \ |
96d22bd7 HH |
32 | mount dmesg ifconfig dhclient mkdir cp ping dhclient |
33 | for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do | |
34 | [ -f ${_terminfodir}/l/linux ] && break | |
35 | done | |
36 | dracut_install -o ${_terminfodir}/l/linux | |
552ecca6 | 37 | inst ./test-init.sh /sbin/init |
c00f04f5 HH |
38 | inst "$basedir/modules.d/40network/dhclient-script" "/sbin/dhclient-script" |
39 | inst "$basedir/modules.d/40network/ifup" "/sbin/ifup" | |
40 | dracut_install grep | |
ceaf49d7 | 41 | dracut_install /lib/systemd/systemd-shutdown |
c00f04f5 | 42 | find_binary plymouth >/dev/null && dracut_install plymouth |
8a080127 PS |
43 | cp -a /etc/ld.so.conf* $initdir/etc |
44 | sudo ldconfig -r "$initdir" | |
c00f04f5 | 45 | ) |
3b403b32 | 46 | |
fe9143d9 VL |
47 | # second, install the files needed to make the root filesystem |
48 | ( | |
0be1785a | 49 | initdir=$TESTDIR/overlay |
552ecca6 | 50 | . $basedir/dracut-functions.sh |
3b403b32 | 51 | dracut_install sfdisk mke2fs poweroff cp umount |
0b53ca70 | 52 | inst_hook initqueue 01 ./create-root.sh |
778d2ba2 | 53 | inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules |
fe9143d9 | 54 | ) |
3b403b32 | 55 | |
c00f04f5 | 56 | # create an initramfs that will create the target root filesystem. |
33310321 VL |
57 | # We do it this way so that we do not risk trashing the host mdraid |
58 | # devices, volume groups, encrypted partitions, etc. | |
552ecca6 | 59 | $basedir/dracut.sh -l -i $TESTDIR/overlay / \ |
e2dbd86f | 60 | -m "dash crypt lvm mdraid udev-rules base rootfs-block kernel-modules" \ |
778d2ba2 | 61 | -d "piix ide-gd_mod ata_piix ext2 sd_mod" \ |
2f02ae9d | 62 | --nomdadmconf \ |
0be1785a HH |
63 | -f $TESTDIR/initramfs.makeroot $KVERSION || return 1 |
64 | rm -rf $TESTDIR/overlay | |
c00f04f5 | 65 | # Invoke KVM and/or QEMU to actually create the target filesystem. |
0be1785a HH |
66 | $testdir/run-qemu \ |
67 | -hda $DISKIMAGE \ | |
68 | -m 256M -nographic -net none \ | |
c00f04f5 | 69 | -kernel "/boot/vmlinuz-$kernel" \ |
8eb16b08 | 70 | -append "root=/dev/dracut/root rw rootfstype=ext2 quiet console=ttyS0,115200n81 selinux=0" \ |
0be1785a | 71 | -initrd $TESTDIR/initramfs.makeroot || return 1 |
ceaf49d7 | 72 | grep -m 1 -q dracut-root-block-created $DISKIMAGE || return 1 |
0be1785a | 73 | |
1a0c05b8 | 74 | ( |
0be1785a | 75 | initdir=$TESTDIR/overlay |
552ecca6 | 76 | . $basedir/dracut-functions.sh |
1a0c05b8 | 77 | dracut_install poweroff shutdown |
0b53ca70 | 78 | inst_hook emergency 000 ./hard-off.sh |
552ecca6 | 79 | inst ./cryptroot-ask.sh /sbin/cryptroot-ask |
778d2ba2 | 80 | inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules |
1a0c05b8 | 81 | ) |
552ecca6 | 82 | sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \ |
9c111e59 | 83 | -o "plymouth network" \ |
5db73403 | 84 | -a "debug" \ |
778d2ba2 | 85 | -d "piix ide-gd_mod ata_piix ext2 sd_mod" \ |
0be1785a | 86 | -f $TESTDIR/initramfs.testing $KVERSION || return 1 |
c00f04f5 HH |
87 | } |
88 | ||
89 | test_cleanup() { | |
0be1785a | 90 | return 0 |
c00f04f5 HH |
91 | } |
92 | ||
fe9143d9 | 93 | . $testdir/test-functions |