dd if=/dev/zero of="$TESTDIR"/root.img bs=200MiB count=1 status=none && sync
mkfs.ext4 -q -L dracut -d "$TESTDIR"/dracut.*/initramfs/ "$TESTDIR"/root.img && sync
- test_dracut \
- "$TESTDIR"/initramfs.testing
+ test_dracut
}
# shellcheck disable=SC1090
fi
test_dracut \
- -d "btrfs" \
- "$TESTDIR"/initramfs.testing
+ -d "btrfs"
}
# shellcheck disable=SC1090
if command -v ukify &> /dev/null; then
echo "Using ukify to create UKI"
test_dracut --no-uefi \
- --drivers 'squashfs' \
- "$TESTDIR"/initramfs.testing
+ --drivers 'squashfs'
ukify build \
--linux="$VMLINUZ" \
$(if command -v cryptsetup > /dev/null; then echo "-a crypt"; fi) \
$(if [ "$TEST_FSTYPE" = "zfs" ]; then echo "-a zfs"; else echo "--add-drivers ${TEST_FSTYPE}"; fi) \
-i "/tmp/crypttab" "/etc/crypttab" \
- -i "/tmp/key" "/etc/key" \
- "$TESTDIR"/initramfs.testing
+ -i "/tmp/key" "/etc/key"
}
# shellcheck disable=SC1090
echo "$MD_UUID" > "$TESTDIR"/mduuid
test_dracut \
- -a "lvm mdraid" \
- "$TESTDIR"/initramfs.testing
+ -a "lvm mdraid"
}
# shellcheck disable=SC1090
test_dracut \
-a "crypt lvm mdraid" \
-i "/tmp/crypttab" "/etc/crypttab" \
- -i "/tmp/key" "/etc/key" \
- "$TESTDIR"/initramfs.testing
+ -i "/tmp/key" "/etc/key"
}
# shellcheck disable=SC1090
test_dracut \
--no-hostonly \
- --modules "dmsquash-live-autooverlay" \
- "$TESTDIR"/initramfs.testing
+ --modules "dmsquash-live-autooverlay"
}
# shellcheck disable=SC1090
test_dracut \
--omit-drivers 'a b c d e f g h i j k l m n o p q r s t u v w x y z' \
-i ./systemd-analyze.sh /lib/dracut/hooks/pre-pivot/00-systemd-analyze.sh \
- -i "/bin/true" "/usr/bin/man" \
- "$TESTDIR"/initramfs.testing
+ -i "/bin/true" "/usr/bin/man"
}
# shellcheck disable=SC1090
# force add all available dracut modules that are dependent on systemd
test_dracut \
-a "dracut-systemd $dracut_modules" \
- --add-drivers "btrfs" \
- "$TESTDIR"/initramfs.testing
+ --add-drivers "btrfs"
if command -v mkosi-initrd &> /dev/null; then
mkosi-initrd --kernel-version "$KVERSION" -t directory -o mkosi -O "$TESTDIR"
# Make client's dracut image
test_dracut \
--no-hostonly --no-hostonly-cmdline \
- -a "dmsquash-live ${USE_NETWORK}" \
- "$TESTDIR"/initramfs.testing
+ -a "dmsquash-live ${USE_NETWORK}"
(
# shellcheck disable=SC2031
# Make client's dracut image
test_dracut \
--no-hostonly --no-hostonly-cmdline \
- -a "${USE_NETWORK}" \
- "$TESTDIR"/initramfs.testing
+ -a "${USE_NETWORK}"
(
# shellcheck disable=SC2031
# Make client's dracut image
test_dracut \
--no-hostonly --no-hostonly-cmdline \
- -a "${USE_NETWORK} ifcfg ${DEBUGFAIL:+debug}" \
- "$TESTDIR"/initramfs.testing
+ -a "${USE_NETWORK} ifcfg ${DEBUGFAIL:+debug}"
(
# shellcheck disable=SC2031
--no-hostonly --no-hostonly-cmdline \
--add "$USE_NETWORK" \
--include "./client.link" "/etc/systemd/network/01-client.link" \
- --kernel-cmdline "rw rd.auto" \
- "$TESTDIR"/initramfs.testing
+ --kernel-cmdline "rw rd.auto"
}
test_cleanup() {
test_dracut \
--no-hostonly --no-hostonly-cmdline \
--add "$USE_NETWORK" \
- -i "./client.link" "/etc/systemd/network/01-client.link" \
- "$TESTDIR"/initramfs.testing
+ -i "./client.link" "/etc/systemd/network/01-client.link"
# Make server's dracut image
"$DRACUT" -i "$TESTDIR"/overlay / \
-a "${USE_NETWORK}" \
-i "./client.link" "/etc/systemd/network/01-client.link" \
-i "/tmp/crypttab" "/etc/crypttab" \
- -i "/tmp/key" "/etc/key" \
- "$TESTDIR"/initramfs.testing
+ -i "/tmp/key" "/etc/key"
"$DRACUT" -N -i "$TESTDIR"/overlay / \
-a "test network-legacy ${SERVER_DEBUG:+debug}" \
"$DRACUT" \
"${TEST_DRACUT_ARGS_ARRAY[@]}" \
- "$@" || return 1
+ "$@" "$TESTDIR"/initramfs.testing || return 1
}
# Wait for the server QEMU has been started up.