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