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