+++ /dev/null
-#!/bin/sh
-
-trap 'poweroff -f' EXIT
-set -e
-
-mkfs.ext4 -q -L ' rdinit=/bin/sh' /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root
-mkdir -p /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" | dd oflag=direct of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none
-sync /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker
-poweroff -f
}
test_setup() {
- # Create what will eventually be our root filesystem onto an overlay
+ # Create client root filesystem
call_dracut --tmpdir "$TESTDIR" \
--add-confdir test-root \
-f "$TESTDIR"/initramfs.root
- mkdir -p "$TESTDIR"/overlay/source
- mv "$TESTDIR"/dracut.*/initramfs/* "$TESTDIR"/overlay/source
- rm -rf "$TESTDIR"/dracut.*
-
- # 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.
- call_dracut -i "$TESTDIR"/overlay / \
- --add-confdir "test-makeroot" \
- -i ./create-root.sh /lib/dracut/hooks/initqueue/01-create-root.sh \
- -f "$TESTDIR"/initramfs.makeroot
-
- declare -a disk_args=()
- qemu_add_drive disk_args "$TESTDIR"/marker.img marker 1
- qemu_add_drive disk_args "$TESTDIR"/root.img root 1
-
- # Invoke KVM and/or QEMU to actually create the target filesystem.
- "$testdir"/run-qemu \
- "${disk_args[@]}" \
- -append "root=/dev/fakeroot quiet" \
- -initrd "$TESTDIR"/initramfs.makeroot
- test_marker_check dracut-root-block-created
- rm -- "$TESTDIR"/marker.img
+ build_ext4_image "$TESTDIR"/dracut.*/initramfs/ "$TESTDIR"/root.img ' rdinit=/bin/sh'
# systemd-analyze.sh calls man indirectly
# make the man command succeed always
+++ /dev/null
-#!/bin/sh
-
-trap 'poweroff -f' EXIT
-set -e
-
-mkfs.ext4 -q -L dracut /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root
-mkdir -p /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" | dd oflag=direct of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none
-sync /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker
-poweroff -f
}
test_setup() {
- # Create what will eventually be our root filesystem onto an overlay
+ # Create client root filesystem
call_dracut --tmpdir "$TESTDIR" \
--add-confdir test-root \
-f "$TESTDIR"/initramfs.root
- mkdir -p "$TESTDIR"/overlay/source
- mv "$TESTDIR"/dracut.*/initramfs/* "$TESTDIR"/overlay/source
- rm -rf "$TESTDIR"/dracut.*
-
- # 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.
- call_dracut -i "$TESTDIR"/overlay / \
- --add-confdir test-makeroot \
- -i ./create-root.sh /lib/dracut/hooks/initqueue/01-create-root.sh \
- -f "$TESTDIR"/initramfs.makeroot
-
- declare -a disk_args=()
- qemu_add_drive disk_args "$TESTDIR"/marker.img marker 1
- qemu_add_drive disk_args "$TESTDIR"/root.img root 1
-
- # Invoke KVM and/or QEMU to actually create the target filesystem.
- "$testdir"/run-qemu \
- "${disk_args[@]}" \
- -append "root=/dev/fakeroot quiet" \
- -initrd "$TESTDIR"/initramfs.makeroot
- test_marker_check dracut-root-block-created
- rm -- "$TESTDIR"/marker.img
+ build_ext4_image "$TESTDIR"/dracut.*/initramfs/ "$TESTDIR"/root.img dracut
# initrd for required kernel modules
# Improve boot time by generating two initrds. Do not re-compress kernel modules
+++ /dev/null
-#!/bin/sh
-
-trap 'poweroff -f' EXIT
-set -e
-
-mkfs.ext4 -q -L dracut /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root
-mkdir -p /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
-mkfs.xfs -q /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_mnt
-echo "dracut-root-block-created" | dd oflag=direct of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none
-sync /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker
-poweroff -f
}
test_setup() {
- # Create what will eventually be our root filesystem onto an overlay
+ # Create client root filesystem
call_dracut --tmpdir "$TESTDIR" \
--no-kernel \
--add "systemd-udevd systemd-journald systemd-tmpfiles systemd-ldconfig systemd-ask-password shutdown" \
# make sure /lib/modules directory exists inside the rootfs
mkdir -p "$TESTDIR"/overlay/source/lib/modules "$TESTDIR"/overlay/source/mnt
- # 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.
- call_dracut -i "$TESTDIR"/overlay / \
- --add-confdir "test-makeroot" \
- -I "mkfs.xfs" \
- -i ./create-root.sh /lib/dracut/hooks/initqueue/01-create-root.sh \
- -f "$TESTDIR"/initramfs.makeroot
+ build_ext4_image "$TESTDIR/overlay/source" "$TESTDIR"/root.img dracut
- declare -a disk_args=()
- qemu_add_drive disk_args "$TESTDIR"/marker.img marker 1
- qemu_add_drive disk_args "$TESTDIR"/root.img root 1
- qemu_add_drive disk_args "$TESTDIR"/mnt.img mnt 1
-
- # Invoke KVM and/or QEMU to actually create the target filesystem.
- "$testdir"/run-qemu \
- "${disk_args[@]}" \
- -append "root=/dev/fakeroot quiet" \
- -initrd "$TESTDIR"/initramfs.makeroot
- test_marker_check dracut-root-block-created
- rm -- "$TESTDIR"/marker.img
+ rm -f "$TESTDIR/mnt.img"
+ truncate -s 512M "$TESTDIR/mnt.img"
+ mkfs.xfs -q "$TESTDIR/mnt.img"
test_dracut \
--add-drivers xfs \
trap 'poweroff -f' EXIT
set -ex
-mkfs.ext4 -q -L singleroot -F /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_singleroot
-mkdir -p /sysroot
-mount -t ext4 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_singleroot /sysroot
-cp -a -t /sysroot /source/*
-umount /sysroot
mdadm --create /dev/md0 --run --level=stripe --raid-devices=2 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_raid0-1 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_raid0-2
mdadm -W /dev/md0 || :
lvm pvcreate -ff -y /dev/md0
+++ /dev/null
-#!/bin/sh
-
-trap 'poweroff -f' EXIT
-mkfs.ext4 -q -L dracut /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root
-mkdir -p /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" | dd oflag=direct of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none
-sync /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker
-poweroff -f
}
test_setup() {
- # Create what will eventually be the client root filesystem onto an overlay
+ # Create client root filesystem
call_dracut --tmpdir "$TESTDIR" \
--add-confdir test-root \
-I "ip grep setsid" \
mkdir -p -- "$TESTDIR"/overlay/source/var/lib/nfs/rpc_pipefs
inst_init ./client-init.sh "$TESTDIR"/overlay/source
+ build_ext4_image "$TESTDIR/overlay/source" "$TESTDIR"/singleroot.img singleroot
+
# 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.
declare -a disk_args=()
qemu_add_drive disk_args "$TESTDIR"/marker.img marker 1
- qemu_add_drive disk_args "$TESTDIR"/singleroot.img singleroot 1
qemu_add_drive disk_args "$TESTDIR"/raid0-1.img raid0-1 1
qemu_add_drive disk_args "$TESTDIR"/raid0-2.img raid0-2 1
test_marker_check dracut-root-block-created
rm -- "$TESTDIR"/marker.img
- # Create what will eventually be the server root filesystem onto an overlay
+ # Create server root filesystem
call_dracut --tmpdir "$TESTDIR" \
--add-confdir test-root \
-a "$USE_NETWORK" \
mkdir -p "$TESTDIR"/overlay/source/var/lib/dhcpd
inst_init ./server-init.sh "$TESTDIR"/overlay/source
- # 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.
- call_dracut -i "$TESTDIR"/overlay / \
- --add-confdir test-makeroot \
- -i ./create-server-root.sh /lib/dracut/hooks/initqueue/01-create-server-root.sh \
- -f "$TESTDIR"/initramfs.makeroot
- rm -rf -- "$TESTDIR"/overlay
-
- declare -a disk_args=()
- qemu_add_drive disk_args "$TESTDIR"/marker.img marker 1
- qemu_add_drive disk_args "$TESTDIR"/server.img root 1
-
- # Invoke KVM and/or QEMU to actually create the target filesystem.
- "$testdir"/run-qemu \
- "${disk_args[@]}" \
- -append "root=/dev/dracut/root rw quiet" \
- -initrd "$TESTDIR"/initramfs.makeroot
- test_marker_check dracut-root-block-created
- rm -- "$TESTDIR"/marker.img
+ build_ext4_image "$TESTDIR/overlay/source" "$TESTDIR"/server.img dracut
# Make server's dracut image
call_dracut \
trap 'poweroff -f' EXIT
set -ex
-mkfs.ext4 -q -L singleroot -F /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_singleroot
-mkdir -p /sysroot
-mount -t ext4 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_singleroot /sysroot
-cp -a -t /sysroot /source/*
-umount /sysroot
mdadm --create /dev/md0 --run --level=stripe --raid-devices=2 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_raid0-1 /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_raid0-2
mdadm -W /dev/md0 || :
lvm pvcreate -ff -y /dev/md0
+++ /dev/null
-#!/bin/sh
-
-trap 'poweroff -f' EXIT
-mkfs.ext4 -q -L dracut /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root
-mkdir -p /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" | dd oflag=direct of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none
-sync /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker
-poweroff -f
}
test_setup() {
- # Create what will eventually be our root filesystem onto an overlay
+ # Create client root filesystem
rm -rf -- "$TESTDIR"/overlay
call_dracut --keep --tmpdir "$TESTDIR" \
--add-confdir test-root \
mkdir -p -- "$TESTDIR"/overlay/source/var/lib/nfs/rpc_pipefs
inst_init ./client-init.sh "$TESTDIR"/overlay/source
+ build_ext4_image "$TESTDIR/overlay/source" "$TESTDIR"/singleroot.img singleroot
+
# 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.
declare -a disk_args=()
qemu_add_drive disk_args "$TESTDIR"/marker.img marker 1
- qemu_add_drive disk_args "$TESTDIR"/singleroot.img singleroot 1
qemu_add_drive disk_args "$TESTDIR"/raid0-1.img raid0-1 1
qemu_add_drive disk_args "$TESTDIR"/raid0-2.img raid0-2 1
test_marker_check dracut-root-block-created
rm -- "$TESTDIR"/marker.img
+ # Create server root filesystem
rm -rf -- "$TESTDIR"/overlay
call_dracut --tmpdir "$TESTDIR" \
--add-confdir test-root \
mkdir -p -- "$TESTDIR"/overlay/source/var/lib/dhcpd "$TESTDIR"/overlay/source/etc/iscsi
inst_init ./server-init.sh "$TESTDIR"/overlay/source
- # 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.
- call_dracut -i "$TESTDIR"/overlay / \
- --add-confdir test-makeroot \
- -i ./create-server-root.sh /lib/dracut/hooks/initqueue/01-create-server-root.sh \
- -f "$TESTDIR"/initramfs.makeroot
- rm -rf -- "$TESTDIR"/overlay
-
- declare -a disk_args=()
- qemu_add_drive disk_args "$TESTDIR"/marker.img marker 1
- qemu_add_drive disk_args "$TESTDIR"/server.img root 1
-
- # Invoke KVM and/or QEMU to actually create the target filesystem.
- "$testdir"/run-qemu \
- "${disk_args[@]}" \
- -append "root=/dev/dracut/root rw rootfstype=ext4 quiet" \
- -initrd "$TESTDIR"/initramfs.makeroot
- test_marker_check dracut-root-block-created
- rm -- "$TESTDIR"/marker.img
+ build_ext4_image "$TESTDIR/overlay/source" "$TESTDIR"/server.img dracut
# Make client's dracut image
test_dracut \
+++ /dev/null
-#!/bin/sh
-
-trap 'poweroff -f' EXIT
-set -e
-
-mkfs.ext4 -q -L dracut /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root
-mkdir -p /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 of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none
-sync /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker
-poweroff -f
+++ /dev/null
-#!/bin/sh
-
-trap 'poweroff -f' EXIT
-set -e
-
-mkfs.ext4 -q -L dracut /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_root
-mkdir -p /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 of=/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker status=none
-sync /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_marker
-poweroff -f
rm -rf "$TESTDIR"/dracut.*
inst_init ./client-init.sh "$TESTDIR"/overlay/source
- # 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.
- call_dracut -i "$TESTDIR"/overlay / \
- --add-confdir test-makeroot \
- -i ./create-client-root.sh /lib/dracut/hooks/initqueue/01-create-client-root.sh \
- -f "$TESTDIR"/initramfs.makeroot
-
- declare -a disk_args=()
- qemu_add_drive disk_args "$TESTDIR"/marker.img marker 1
- qemu_add_drive disk_args "$TESTDIR"/unencrypted.img root 1
-
- # Invoke KVM and/or QEMU to actually create the target filesystem.
- "$testdir"/run-qemu \
- "${disk_args[@]}" \
- -append "root=/dev/dracut/root rw quiet" \
- -initrd "$TESTDIR"/initramfs.makeroot
- test_marker_check dracut-root-block-created
+ build_ext4_image "$TESTDIR/overlay/source" "$TESTDIR"/unencrypted.img dracut
rm -fr "$TESTDIR"/overlay
}
mkdir -p -- "$TESTDIR"/overlay/source/var/lib/dhcpd "$TESTDIR"/overlay/source/etc/nbd-server
inst_init ./server-init.sh "$TESTDIR"/overlay/source
- # 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.
- call_dracut -i "$TESTDIR"/overlay / \
- --add-confdir test-makeroot \
- -i ./create-server-root.sh /lib/dracut/hooks/initqueue/01-create-server-root.sh \
- -f "$TESTDIR"/initramfs.makeroot
-
- declare -a disk_args=()
- qemu_add_drive disk_args "$TESTDIR"/marker.img marker 1
- qemu_add_drive disk_args "$TESTDIR"/server.img root 1
-
- # Invoke KVM and/or QEMU to actually create the target filesystem.
- "$testdir"/run-qemu \
- "${disk_args[@]}" \
- -append "root=/dev/dracut/root rw rootfstype=ext4 quiet" \
- -initrd "$TESTDIR"/initramfs.makeroot
- test_marker_check dracut-root-block-created
+ build_ext4_image "$TESTDIR/overlay/source" "$TESTDIR"/server.img dracut
rm -fr "$TESTDIR"/overlay
}