summaryrefslogtreecommitdiffstats
path: root/test/TEST-40-NBD
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-03 14:01:35 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-03 14:01:35 +0000
commite6f2eaf47a177a8eca054d1d70a1b6287e8c3521 (patch)
treec5719e819a9e37df4b54affd61438f382ec38a8f /test/TEST-40-NBD
parentAdding upstream version 060+5. (diff)
downloaddracut-upstream/102.tar.xz
dracut-upstream/102.zip
Adding upstream version 102.upstream/102
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-xtest/TEST-40-NBD/client-init.sh2
-rwxr-xr-xtest/TEST-40-NBD/create-client-root.sh6
-rwxr-xr-xtest/TEST-40-NBD/create-encrypted-root.sh10
-rwxr-xr-xtest/TEST-40-NBD/create-server-root.sh6
-rwxr-xr-xtest/TEST-40-NBD/finished-false.sh2
-rwxr-xr-xtest/TEST-40-NBD/hard-off.sh3
-rwxr-xr-xtest/TEST-40-NBD/test.sh297
7 files changed, 89 insertions, 237 deletions
diff --git a/test/TEST-40-NBD/client-init.sh b/test/TEST-40-NBD/client-init.sh
index c5c57a2..9de7436 100755
--- a/test/TEST-40-NBD/client-init.sh
+++ b/test/TEST-40-NBD/client-init.sh
@@ -9,7 +9,7 @@ exec > /dev/console 2>&1
while read -r dev fs fstype opts rest || [ -n "$dev" ]; do
[ "$dev" = "rootfs" ] && continue
[ "$fs" != "/" ] && continue
- echo "nbd-OK $fstype $opts" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker
+ echo "nbd-OK $fstype $opts" | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none
echo "nbd-OK $fstype $opts"
break
done < /proc/mounts
diff --git a/test/TEST-40-NBD/create-client-root.sh b/test/TEST-40-NBD/create-client-root.sh
index a214f38..a2114a8 100755
--- a/test/TEST-40-NBD/create-client-root.sh
+++ b/test/TEST-40-NBD/create-client-root.sh
@@ -11,14 +11,14 @@ udevadm control --reload
set -e
udevadm settle
-mkfs.ext4 -L dracut /dev/disk/by-id/ata-disk_root
+mkfs.ext4 -q -L dracut /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root
mkdir -p /root
-mount -t ext4 /dev/disk/by-id/ata-disk_root /root
+mount -t ext4 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root /root
cp -a -t /root /source/*
mkdir -p /root/run
umount /root
{
echo "dracut-root-block-created"
echo "ID_FS_UUID=$ID_FS_UUID"
-} | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker
+} | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none
poweroff -f
diff --git a/test/TEST-40-NBD/create-encrypted-root.sh b/test/TEST-40-NBD/create-encrypted-root.sh
index 0ea90e3..c4b12c2 100755
--- a/test/TEST-40-NBD/create-encrypted-root.sh
+++ b/test/TEST-40-NBD/create-encrypted-root.sh
@@ -13,15 +13,15 @@ udevadm settle
set -ex
printf test > keyfile
-cryptsetup -q luksFormat /dev/disk/by-id/ata-disk_root /keyfile
+cryptsetup -q luksFormat /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root /keyfile
echo "The passphrase is test"
-cryptsetup luksOpen /dev/disk/by-id/ata-disk_root dracut_crypt_test < /keyfile
+cryptsetup luksOpen /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root 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
lvm vgchange -ay
udevadm settle
-mkfs.ext4 -L dracut -j /dev/dracut/root
+mkfs.ext4 -q -L dracut -j /dev/dracut/root
mkdir -p /sysroot
mount -t ext4 /dev/dracut/root /sysroot
cp -a -t /sysroot /source/*
@@ -32,10 +32,10 @@ udevadm settle
cryptsetup luksClose /dev/mapper/dracut_crypt_test
udevadm settle
sleep 1
-eval "$(udevadm info --query=property --name=/dev/disk/by-id/ata-disk_root | while read -r line || [ -n "$line" ]; do [ "$line" != "${line#*ID_FS_UUID*}" ] && echo "$line"; done)"
+eval "$(udevadm info --query=property --name=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root | while read -r line || [ -n "$line" ]; do [ "$line" != "${line#*ID_FS_UUID*}" ] && echo "$line"; done)"
{
echo "dracut-root-block-created"
echo "ID_FS_UUID=$ID_FS_UUID"
-} | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker
+} | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none
sync
poweroff -f
diff --git a/test/TEST-40-NBD/create-server-root.sh b/test/TEST-40-NBD/create-server-root.sh
index de4d670..d0c5c30 100755
--- a/test/TEST-40-NBD/create-server-root.sh
+++ b/test/TEST-40-NBD/create-server-root.sh
@@ -12,15 +12,15 @@ udevadm settle
set -e
udevadm settle
-mkfs.ext4 -L dracut /dev/disk/by-id/ata-disk_root
+mkfs.ext4 -q -L dracut /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root
mkdir -p /root
-mount -t ext4 /dev/disk/by-id/ata-disk_root /root
+mount -t ext4 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root /root
cp -a -t /root /source/*
mkdir -p /root/run
umount /root
{
echo "dracut-root-block-created"
echo "ID_FS_UUID=$ID_FS_UUID"
-} | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker
+} | dd oflag=direct,dsync of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none
sync
poweroff -f
diff --git a/test/TEST-40-NBD/finished-false.sh b/test/TEST-40-NBD/finished-false.sh
deleted file mode 100755
index ecdbef9..0000000
--- a/test/TEST-40-NBD/finished-false.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-exit 1
diff --git a/test/TEST-40-NBD/hard-off.sh b/test/TEST-40-NBD/hard-off.sh
deleted file mode 100755
index 01acb19..0000000
--- a/test/TEST-40-NBD/hard-off.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-getargbool 0 rd.shell || poweroff -f
-getargbool 0 failme && poweroff -f
diff --git a/test/TEST-40-NBD/test.sh b/test/TEST-40-NBD/test.sh
index 7fd1efc..e935f53 100755
--- a/test/TEST-40-NBD/test.sh
+++ b/test/TEST-40-NBD/test.sh
@@ -27,18 +27,17 @@ run_server() {
echo "NBD TEST SETUP: Starting DHCP/NBD server"
declare -a disk_args=()
- # shellcheck disable=SC2034
declare -i disk_index=0
- qemu_add_drive_args disk_index disk_args "$TESTDIR"/unencrypted.img unencrypted
- qemu_add_drive_args disk_index disk_args "$TESTDIR"/encrypted.img encrypted
- qemu_add_drive_args disk_index disk_args "$TESTDIR"/server.img serverroot
+ qemu_add_drive disk_index disk_args "$TESTDIR"/unencrypted.img unencrypted
+ qemu_add_drive disk_index disk_args "$TESTDIR"/encrypted.img encrypted
+ qemu_add_drive disk_index disk_args "$TESTDIR"/server.img serverroot
"$testdir"/run-qemu \
"${disk_args[@]}" \
-serial "${SERIAL:-"file:$TESTDIR/server.log"}" \
-net nic,macaddr=52:54:00:12:34:56,model=e1000 \
-net socket,listen=127.0.0.1:12340 \
- -append "panic=1 oops=panic softlockup_panic=1 rd.luks=0 systemd.crash_reboot quiet root=/dev/disk/by-id/ata-disk_serverroot rootfstype=ext4 rw console=ttyS0,115200n81 selinux=0 $SERVER_DEBUG" \
+ -append "panic=1 oops=panic softlockup_panic=1 rd.luks=0 systemd.crash_reboot quiet root=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_serverroot rootfstype=ext4 rw console=ttyS0,115200n81 selinux=0 $SERVER_DEBUG" \
-initrd "$TESTDIR"/initramfs.server \
-pidfile "$TESTDIR"/server.pid -daemonize || return 1
chmod 644 "$TESTDIR"/server.pid || return 1
@@ -74,14 +73,14 @@ client_test() {
declare -a disk_args=()
declare -i disk_index=0
- qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker
+ qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker
test_marker_reset
"$testdir"/run-qemu \
"${disk_args[@]}" \
-net nic,macaddr="$mac",model=e1000 \
-net socket,connect=127.0.0.1:12340 \
- -append "panic=1 oops=panic softlockup_panic=1 systemd.crash_reboot rd.shell=0 $cmdline $DEBUGFAIL rd.auto rd.info rd.retry=10 ro console=ttyS0,115200n81 selinux=0 " \
+ -append "$cmdline rd.auto ro" \
-initrd "$TESTDIR"/initramfs.testing
# shellcheck disable=SC2181
@@ -165,7 +164,7 @@ client_run() {
# Encrypted root handling via LVM/LUKS over NBD
- # shellcheck disable=SC1090
+ # shellcheck source=$TESTDIR/luks.uuid
. "$TESTDIR"/luks.uuid
client_test "NBD root=LABEL=dracut netroot=nbd:IP:port" \
@@ -188,73 +187,32 @@ client_run() {
make_encrypted_root() {
rm -fr "$TESTDIR"/overlay
- kernel=$KVERSION
# Create what will eventually be our root filesystem onto an overlay
- (
- # shellcheck disable=SC2030
- export initdir=$TESTDIR/overlay/source
- # shellcheck disable=SC1090
- . "$PKGLIBDIR"/dracut-init.sh
- mkdir -p "$initdir"
- (
- cd "$initdir" || exit
- mkdir -p dev sys proc etc run var/run tmp
- )
-
- inst_multiple sh df free ls shutdown poweroff stty cat ps ln ip \
- mount dmesg mkdir cp ping dd sync
- for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
- [ -f ${_terminfodir}/l/linux ] && break
- done
- inst_multiple -o ${_terminfodir}/l/linux
-
- inst_simple "${PKGLIBDIR}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh"
- inst_simple "${PKGLIBDIR}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh"
- inst_binary "${PKGLIBDIR}/dracut-util" "/usr/bin/dracut-util"
- ln -s dracut-util "${initdir}/usr/bin/dracut-getarg"
- ln -s dracut-util "${initdir}/usr/bin/dracut-getargs"
-
- inst ./client-init.sh /sbin/init
- inst_simple /etc/os-release
- find_binary plymouth > /dev/null && inst_multiple plymouth
- cp -a /etc/ld.so.conf* "$initdir"/etc
- ldconfig -r "$initdir"
- )
+ "$DRACUT" -l --keep --tmpdir "$TESTDIR" \
+ -m "test-root" \
+ -I "ip grep" \
+ -i "${basedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh" \
+ -i "${basedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh" \
+ --no-hostonly --no-hostonly-cmdline --nohardlink \
+ -f "$TESTDIR"/initramfs.root "$KVERSION" || return 1
+ mkdir -p "$TESTDIR"/overlay/source && mv "$TESTDIR"/dracut.*/initramfs/* "$TESTDIR"/overlay/source && rm -rf "$TESTDIR"/dracut.*
+ cp ./client-init.sh "$TESTDIR"/overlay/source/sbin/init
# second, install the files needed to make the root filesystem
- (
- # shellcheck disable=SC2030
- # shellcheck disable=SC2031
- export initdir=$TESTDIR/overlay
- # shellcheck disable=SC1090
- . "$PKGLIBDIR"/dracut-init.sh
- (
- cd "$initdir" || exit
- mkdir -p dev sys proc etc tmp var run root
- ln -s ../run var/run
- )
- inst_multiple mkfs.ext4 poweroff cp umount dd sync
- inst_hook shutdown-emergency 000 ./hard-off.sh
- inst_hook emergency 000 ./hard-off.sh
- inst_hook initqueue 01 ./create-encrypted-root.sh
- inst_hook initqueue/finished 01 ./finished-false.sh
- )
-
# create an initramfs that will create the target root filesystem.
# We do it this way so that we do not risk trashing the host mdraid
# devices, volume groups, encrypted partitions, etc.
"$DRACUT" -l -i "$TESTDIR"/overlay / \
- -m "dash crypt lvm mdraid kernel-modules qemu" \
- -d "piix ide-gd_mod ata_piix ext4 sd_mod" \
+ -m "test-makeroot crypt lvm mdraid" \
+ -i ./create-encrypted-root.sh /lib/dracut/hooks/initqueue/01-create-encrypted-root.sh \
--no-hostonly-cmdline -N \
-f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1
rm -rf -- "$TESTDIR"/overlay
declare -a disk_args=()
- # shellcheck disable=SC2034
declare -i disk_index=0
- qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker 1
- qemu_add_drive_args disk_index disk_args "$TESTDIR"/encrypted.img root 120
+ qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker 1
+ qemu_add_drive disk_index disk_args "$TESTDIR"/encrypted.img root 120
# Invoke KVM and/or QEMU to actually create the target filesystem.
"$testdir"/run-qemu \
@@ -267,72 +225,31 @@ make_encrypted_root() {
make_client_root() {
rm -fr "$TESTDIR"/overlay
- kernel=$KVERSION
- (
- mkdir -p "$TESTDIR"/overlay/source
- # shellcheck disable=SC2030
- # shellcheck disable=SC2031
- export initdir=$TESTDIR/overlay/source
- # shellcheck disable=SC1090
- . "$PKGLIBDIR"/dracut-init.sh
- mkdir -p "$initdir"
- (
- cd "$initdir" || exit
- mkdir -p dev sys proc etc run var/run tmp
- )
- inst_multiple sh ls shutdown poweroff stty cat ps ln ip \
- dmesg mkdir cp ping dd mount sync
- for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
- [ -f ${_terminfodir}/l/linux ] && break
- done
- inst_multiple -o ${_terminfodir}/l/linux
-
- inst_simple "${PKGLIBDIR}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh"
- inst_simple "${PKGLIBDIR}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh"
- inst_binary "${PKGLIBDIR}/dracut-util" "/usr/bin/dracut-util"
- ln -s dracut-util "${initdir}/usr/bin/dracut-getarg"
- ln -s dracut-util "${initdir}/usr/bin/dracut-getargs"
-
- inst ./client-init.sh /sbin/init
- inst_simple /etc/os-release
- inst_multiple -o {,/usr}/etc/nsswitch.conf
- inst /etc/passwd /etc/passwd
- inst /etc/group /etc/group
- for i in /usr/lib*/libnss_files* /lib*/libnss_files*; do
- [ -e "$i" ] || continue
- inst "$i"
- done
- cp -a /etc/ld.so.conf* "$initdir"/etc
- ldconfig -r "$initdir"
- )
+ "$DRACUT" -l --keep --tmpdir "$TESTDIR" \
+ -m "test-root" \
+ -I "ip" \
+ -i "${basedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh" \
+ -i "${basedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh" \
+ --no-hostonly --no-hostonly-cmdline --nohardlink \
+ -f "$TESTDIR"/initramfs.root "$KVERSION" || return 1
+ mkdir -p "$TESTDIR"/overlay/source && mv "$TESTDIR"/dracut.*/initramfs/* "$TESTDIR"/overlay/source && rm -rf "$TESTDIR"/dracut.*
+ cp ./client-init.sh "$TESTDIR"/overlay/source/sbin/init
# second, install the files needed to make the root filesystem
- (
- # shellcheck disable=SC2030
- # shellcheck disable=SC2031
- export initdir=$TESTDIR/overlay
- # shellcheck disable=SC1090
- . "$PKGLIBDIR"/dracut-init.sh
- inst_multiple sfdisk mkfs.ext4 poweroff cp umount sync dd
- inst_hook initqueue 01 ./create-client-root.sh
- inst_hook initqueue/finished 01 ./finished-false.sh
- )
-
# create an initramfs that will create the target root filesystem.
# We do it this way so that we do not risk trashing the host mdraid
# devices, volume groups, encrypted partitions, etc.
"$DRACUT" -l -i "$TESTDIR"/overlay / \
- -m "dash rootfs-block kernel-modules qemu" \
- -d "piix ide-gd_mod ata_piix ext4 sd_mod" \
+ -m "test-makeroot" \
+ -i ./create-client-root.sh /lib/dracut/hooks/initqueue/01-create-client-root.sh \
--nomdadmconf \
--no-hostonly-cmdline -N \
-f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1
declare -a disk_args=()
- # shellcheck disable=SC2034
declare -i disk_index=0
- qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker 1
- qemu_add_drive_args disk_index disk_args "$TESTDIR"/unencrypted.img root 120
+ qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker 1
+ qemu_add_drive disk_index disk_args "$TESTDIR"/unencrypted.img root 120
# Invoke KVM and/or QEMU to actually create the target filesystem.
"$testdir"/run-qemu \
@@ -345,90 +262,51 @@ make_client_root() {
make_server_root() {
rm -fr "$TESTDIR"/overlay
- # shellcheck disable=SC2031
- export kernel=$KVERSION
- (
- mkdir -p "$TESTDIR"/overlay/source
- # shellcheck disable=SC2030
- # shellcheck disable=SC2031
- export initdir=$TESTDIR/overlay/source
- # shellcheck disable=SC1090
- . "$PKGLIBDIR"/dracut-init.sh
- mkdir -p "$initdir"
- (
- cd "$initdir" || exit
- mkdir -p run dev sys proc etc var var/lib/dhcpd tmp etc/nbd-server
- ln -s ../run var/run
- )
- cat > "$initdir/etc/nbd-server/config" << EOF
+
+ cat > /tmp/config << EOF
[generic]
[raw]
-exportname = /dev/disk/by-id/ata-disk_unencrypted
+exportname = /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_unencrypted
port = 2000
bs = 4096
[encrypted]
-exportname = /dev/disk/by-id/ata-disk_encrypted
+exportname = /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_encrypted
port = 2001
bs = 4096
EOF
- inst_multiple sh ls shutdown poweroff stty cat ps ln ip \
- dmesg mkdir cp ping grep \
- sleep nbd-server chmod modprobe vi pidof
- for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do
- [ -f ${_terminfodir}/l/linux ] && break
- done
- inst_multiple -o ${_terminfodir}/l/linux
- instmods nfsd sunrpc ipv6 lockd af_packet 8021q ipvlan macvlan
- type -P dhcpd > /dev/null && inst_multiple dhcpd
- inst ./server-init.sh /sbin/init
- inst_simple /etc/os-release
- inst ./hosts /etc/hosts
- inst ./dhcpd.conf /etc/dhcpd.conf
- inst_multiple -o {,/usr}/etc/nsswitch.conf
- inst /etc/passwd /etc/passwd
- inst /etc/group /etc/group
- _nsslibs=$(
- cat "$dracutsysrootdir"/{,usr/}etc/nsswitch.conf 2> /dev/null \
- | sed -e '/^#/d' -e 's/^.*://' -e 's/\[NOTFOUND=return\]//' \
- | tr -s '[:space:]' '\n' | sort -u | tr -s '[:space:]' '|'
- )
- _nsslibs=${_nsslibs#|}
- _nsslibs=${_nsslibs%|}
-
- inst_libdir_file -n "$_nsslibs" 'libnss_*.so*'
-
- cp -a /etc/ld.so.conf* "$initdir"/etc
- ldconfig -r "$initdir"
- dracut_kernel_post
- )
- # second, install the files needed to make the root filesystem
- (
- # shellcheck disable=SC2030
- # shellcheck disable=SC2031
- export initdir=$TESTDIR/overlay
- # shellcheck disable=SC1090
- . "$PKGLIBDIR"/dracut-init.sh
- inst_multiple sfdisk mkfs.ext4 poweroff cp umount sync dd sync
- inst_hook initqueue 01 ./create-server-root.sh
- inst_hook initqueue/finished 01 ./finished-false.sh
- )
+ "$DRACUT" -l --keep --tmpdir "$TESTDIR" \
+ -m "test-root network-legacy" \
+ -d "nfsd sunrpc ipv6 lockd af_packet 8021q ipvlan macvlan" \
+ -I "ip grep sleep nbd-server chmod modprobe vi pidof" \
+ -i "${basedir}/modules.d/99base/dracut-lib.sh" "/lib/dracut-lib.sh" \
+ -i "${basedir}/modules.d/99base/dracut-dev-lib.sh" "/lib/dracut-dev-lib.sh" \
+ --install-optional "/etc/netconfig dhcpd /etc/group /etc/nsswitch.conf /etc/rpc /etc/protocols /etc/services /usr/etc/nsswitch.conf /usr/etc/rpc /usr/etc/protocols /usr/etc/services" \
+ -i /tmp/config /etc/nbd-server/config \
+ -i "./hosts" "/etc/hosts" \
+ -i "./dhcpd.conf" "/etc/dhcpd.conf" \
+ --no-hostonly --no-hostonly-cmdline --nohardlink \
+ -f "$TESTDIR"/initramfs.root "$KVERSION" || return 1
+ mkdir -p "$TESTDIR"/overlay/source && mv "$TESTDIR"/dracut.*/initramfs/* "$TESTDIR"/overlay/source && rm -rf "$TESTDIR"/dracut.*
+
+ mkdir -p -- "$TESTDIR"/overlay/source/var/lib/dhcpd "$TESTDIR"/overlay/source/etc/nbd-server
+ cp ./server-init.sh "$TESTDIR"/overlay/source/sbin/init
+ # second, install the files needed to make the root filesystem
# create an initramfs that will create the target root filesystem.
# We do it this way so that we do not risk trashing the host mdraid
# devices, volume groups, encrypted partitions, etc.
- "$DRACUT" -l -i "$TESTDIR"/overlay / \
- -m "dash rootfs-block kernel-modules qemu" \
- -d "piix ide-gd_mod ata_piix ext4 sd_mod" \
+ "$DRACUT" -N -l -i "$TESTDIR"/overlay / \
+ -m "test-makeroot" \
+ -i ./create-server-root.sh /lib/dracut/hooks/initqueue/01-create-server-root.sh \
--nomdadmconf \
--no-hostonly-cmdline -N \
-f "$TESTDIR"/initramfs.makeroot "$KVERSION" || return 1
declare -a disk_args=()
- # shellcheck disable=SC2034
declare -i disk_index=0
- qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker 1
- qemu_add_drive_args disk_index disk_args "$TESTDIR"/server.img root 120
+ qemu_add_drive disk_index disk_args "$TESTDIR"/marker.img marker 1
+ qemu_add_drive disk_index disk_args "$TESTDIR"/server.img root 240
# Invoke KVM and/or QEMU to actually create the target filesystem.
"$testdir"/run-qemu \
@@ -446,47 +324,26 @@ test_setup() {
rm -fr "$TESTDIR"/overlay
# Make the test image
- (
- # shellcheck disable=SC2031
- # shellcheck disable=SC2030
- export initdir=$TESTDIR/overlay
- # shellcheck disable=SC1090
- . "$PKGLIBDIR"/dracut-init.sh
- inst_multiple poweroff shutdown dd
- inst_hook shutdown-emergency 000 ./hard-off.sh
- inst ./cryptroot-ask.sh /sbin/cryptroot-ask
-
- # inst ./debug-shell.service /lib/systemd/system/debug-shell.service
- # mkdir -p "${initdir}/lib/systemd/system/sysinit.target.wants"
- # ln -fs ../debug-shell.service "${initdir}/lib/systemd/system/sysinit.target.wants/debug-shell.service"
-
- # shellcheck disable=SC1090
- . "$TESTDIR"/luks.uuid
- mkdir -p "$initdir"/etc
- echo "luks-$ID_FS_UUID /dev/nbd0 /etc/key" > "$initdir"/etc/crypttab
- echo -n test > "$initdir"/etc/key
- inst_simple ./client.link /etc/systemd/network/01-client.link
- )
- "$DRACUT" -l -i "$TESTDIR"/overlay / \
- -o "plymouth iscsi nfs" \
- -a "debug watchdog ${USE_NETWORK}" \
- --no-hostonly-cmdline -N \
- -f "$TESTDIR"/initramfs.testing "$KVERSION" || return 1
-
- (
- # shellcheck disable=SC2031
- export initdir="$TESTDIR"/overlay
- # shellcheck disable=SC1090
- . "$PKGLIBDIR"/dracut-init.sh
- rm "$initdir"/etc/systemd/network/01-client.link
- inst_simple ./server.link /etc/systemd/network/01-server.link
- inst_hook pre-mount 99 ./wait-if-server.sh
- )
- "$DRACUT" -l -i "$TESTDIR"/overlay / \
- -a "rootfs-block debug kernel-modules network network-legacy" \
+ # shellcheck source=$TESTDIR/luks.uuid
+ . "$TESTDIR"/luks.uuid
+
+ echo "luks-$ID_FS_UUID /dev/nbd0 /etc/key" > /tmp/crypttab
+ echo -n test > /tmp/key
+
+ test_dracut \
+ -a "${USE_NETWORK}" \
+ -i "./cryptroot-ask.sh" "/sbin/cryptroot-ask" \
+ -i "./client.link" "/etc/systemd/network/01-client.link" \
+ -i "/tmp/crypttab" "/etc/crypttab" \
+ -i "/tmp/key" "/etc/key" \
+ "$TESTDIR"/initramfs.testing
+
+ "$DRACUT" -N -l -i "$TESTDIR"/overlay / \
+ -a "test rootfs-block debug kernel-modules network-legacy" \
-d "af_packet piix ide-gd_mod ata_piix ext4 sd_mod e1000 drbg" \
- --no-hostonly-cmdline -N \
+ -i "./server.link" "/etc/systemd/network/01-server.link" \
+ -i "./wait-if-server.sh" "/lib/dracut/hooks/pre-mount/99-wait-if-server.sh" \
-f "$TESTDIR"/initramfs.server "$KVERSION" || return 1
rm -rf -- "$TESTDIR"/overlay