Blame 1991-feat-dmsquash-live-add-new-dmsquash-live-autooverlay.patch

Neal Gompa e2800e
From 732361736810166aeba87616c93206b3e252aabe Mon Sep 17 00:00:00 2001
Neal Gompa e2800e
From: Matt Coleman <matt@datto.com>
Neal Gompa e2800e
Date: Fri, 23 Sep 2022 19:28:25 -0400
Neal Gompa e2800e
Subject: [PATCH] feat(dmsquash-live): add new dmsquash-live-autooverlay module
Neal Gompa e2800e
Neal Gompa e2800e
(cherry picked from commit a3c67d27e75223bb45df19f850d246ced9a09938)
Neal Gompa e2800e
---
Neal Gompa e2800e
 man/dracut.cmdline.7.asc                      |   4 +
Neal Gompa e2800e
 .../create-overlay-genrules.sh                |  10 ++
Neal Gompa e2800e
 .../create-overlay.sh                         | 119 ++++++++++++++++++
Neal Gompa e2800e
 .../module-setup.sh                           |  25 ++++
Neal Gompa e2800e
 pkgbuild/dracut.spec                          |   3 +-
Neal Gompa e2800e
 test/TEST-16-DMSQUASH/create-root.sh          |  12 +-
Neal Gompa e2800e
 test/TEST-16-DMSQUASH/test-init.sh            |   6 +
Neal Gompa e2800e
 test/TEST-16-DMSQUASH/test.sh                 |  38 +++++-
Neal Gompa e2800e
 test/container/Dockerfile-Arch                |   4 +-
Neal Gompa e2800e
 test/container/Dockerfile-Debian              |   1 +
Neal Gompa e2800e
 test/container/Dockerfile-Fedora-latest       |   1 +
Neal Gompa e2800e
 test/container/Dockerfile-OpenSuse-latest     |   2 +-
Neal Gompa e2800e
 12 files changed, 216 insertions(+), 9 deletions(-)
Neal Gompa e2800e
 create mode 100755 modules.d/90dmsquash-live-autooverlay/create-overlay-genrules.sh
Neal Gompa e2800e
 create mode 100755 modules.d/90dmsquash-live-autooverlay/create-overlay.sh
Neal Gompa e2800e
 create mode 100755 modules.d/90dmsquash-live-autooverlay/module-setup.sh
Neal Gompa e2800e
Neal Gompa e2800e
diff --git a/man/dracut.cmdline.7.asc b/man/dracut.cmdline.7.asc
Neal Gompa e2800e
index fda62fd1..40d13d83 100644
Neal Gompa e2800e
--- a/man/dracut.cmdline.7.asc
Neal Gompa e2800e
+++ b/man/dracut.cmdline.7.asc
Neal Gompa e2800e
@@ -1161,6 +1161,10 @@ rd.live.overlay=/dev/sdb1:persistent-overlay.img
Neal Gompa e2800e
 rd.live.overlay=UUID=99440c1f-8daa-41bf-b965-b7240a8996f4
Neal Gompa e2800e
 --
Neal Gompa e2800e
 
Neal Gompa e2800e
+**rd.live.overlay.cowfs=**__[btrfs|ext4|xfs]__::
Neal Gompa e2800e
+Specifies the filesystem to use when formatting the overlay partition.
Neal Gompa e2800e
+The default is ext4.
Neal Gompa e2800e
+
Neal Gompa e2800e
 **rd.live.overlay.size=**__<size_MiB>__::
Neal Gompa e2800e
 Specifies a non-persistent Device-mapper overlay size in MiB.  The default is
Neal Gompa e2800e
 _32768_.
Neal Gompa e2800e
diff --git a/modules.d/90dmsquash-live-autooverlay/create-overlay-genrules.sh b/modules.d/90dmsquash-live-autooverlay/create-overlay-genrules.sh
Neal Gompa e2800e
new file mode 100755
Neal Gompa e2800e
index 00000000..ed168d9f
Neal Gompa e2800e
--- /dev/null
Neal Gompa e2800e
+++ b/modules.d/90dmsquash-live-autooverlay/create-overlay-genrules.sh
Neal Gompa e2800e
@@ -0,0 +1,10 @@
Neal Gompa e2800e
+#!/bin/sh
Neal Gompa e2800e
+
Neal Gompa e2800e
+# shellcheck disable=SC2154
Neal Gompa e2800e
+case "$root" in
Neal Gompa e2800e
+    live:/dev/*)
Neal Gompa e2800e
+        printf 'SYMLINK=="%s", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/create-overlay %s"\n' \
Neal Gompa e2800e
+            "${root#live:/dev/}" "${root#live:}" >> /etc/udev/rules.d/95-create-overlay.rules
Neal Gompa e2800e
+        wait_for_dev -n "${root#live:}"
Neal Gompa e2800e
+        ;;
Neal Gompa e2800e
+esac
Neal Gompa e2800e
diff --git a/modules.d/90dmsquash-live-autooverlay/create-overlay.sh b/modules.d/90dmsquash-live-autooverlay/create-overlay.sh
Neal Gompa e2800e
new file mode 100755
Neal Gompa e2800e
index 00000000..c89bda2b
Neal Gompa e2800e
--- /dev/null
Neal Gompa e2800e
+++ b/modules.d/90dmsquash-live-autooverlay/create-overlay.sh
Neal Gompa e2800e
@@ -0,0 +1,119 @@
Neal Gompa e2800e
+#!/bin/sh
Neal Gompa e2800e
+
Neal Gompa e2800e
+type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
Neal Gompa e2800e
+
Neal Gompa e2800e
+if getargbool 0 rd.live.debug -n -y rdlivedebug; then
Neal Gompa e2800e
+    exec > /tmp/create-overlay.$$.out
Neal Gompa e2800e
+    exec 2>> /tmp/create-overlay.$$.out
Neal Gompa e2800e
+    set -x
Neal Gompa e2800e
+fi
Neal Gompa e2800e
+
Neal Gompa e2800e
+gatherData() {
Neal Gompa e2800e
+    overlay=$(getarg rd.live.overlay)
Neal Gompa e2800e
+    if [ -z "$overlay" ]; then
Neal Gompa e2800e
+        info "Skipping overlay creation: kernel command line parameter 'rd.live.overlay' is not set"
Neal Gompa e2800e
+        exit 0
Neal Gompa e2800e
+    fi
Neal Gompa e2800e
+    # shellcheck disable=SC2086
Neal Gompa e2800e
+    if ! str_starts ${overlay} LABEL=; then
Neal Gompa e2800e
+        die "Overlay creation failed: the partition must be set by LABEL in the 'rd.live.overlay' kernel parameter"
Neal Gompa e2800e
+    fi
Neal Gompa e2800e
+
Neal Gompa e2800e
+    overlayLabel=${overlay#LABEL=}
Neal Gompa e2800e
+    # shellcheck disable=SC2086
Neal Gompa e2800e
+    if [ -b /dev/disk/by-label/${overlayLabel} ]; then
Neal Gompa e2800e
+        info "Skipping overlay creation: overlay already exists"
Neal Gompa e2800e
+        exit 0
Neal Gompa e2800e
+    fi
Neal Gompa e2800e
+
Neal Gompa e2800e
+    filesystem=$(getarg rd.live.overlay.cowfs)
Neal Gompa e2800e
+    [ -z "$filesystem" ] && filesystem="ext4"
Neal Gompa e2800e
+    if [ "$filesystem" != "ext4" ] && [ "$filesystem" != "xfs" ] && [ "$filesystem" != "btrfs" ]; then
Neal Gompa e2800e
+        die "Overlay creation failed: only ext4, xfs, and btrfs are supported in the 'rd.live.overlay.cowfs' kernel parameter"
Neal Gompa e2800e
+    fi
Neal Gompa e2800e
+
Neal Gompa e2800e
+    live_dir=$(getarg rd.live.dir)
Neal Gompa e2800e
+    [ -z "$live_dir" ] && live_dir="LiveOS"
Neal Gompa e2800e
+
Neal Gompa e2800e
+    [ -z "$1" ] && exit 1
Neal Gompa e2800e
+    rootDevice=$1
Neal Gompa e2800e
+
Neal Gompa e2800e
+    # The kernel command line's 'root=' parameter was parsed into the $root variable by the dmsquash-live module.
Neal Gompa e2800e
+    # $root contains the path to a symlink within /dev/disk/by-label, which points to a partition.
Neal Gompa e2800e
+    # This script needs that partition's parent block device.
Neal Gompa e2800e
+    # shellcheck disable=SC2046
Neal Gompa e2800e
+    # shellcheck disable=SC2086
Neal Gompa e2800e
+    rootDeviceAbsolutePath=$(readlink -f ${rootDevice})
Neal Gompa e2800e
+    rootDeviceSysfsPath=/sys/class/block/${rootDeviceAbsolutePath##*/}
Neal Gompa e2800e
+    if [ -f "${rootDeviceSysfsPath}/partition" ]; then
Neal Gompa e2800e
+        # shellcheck disable=SC2086
Neal Gompa e2800e
+        partition=$(cat ${rootDeviceSysfsPath}/partition)
Neal Gompa e2800e
+    else
Neal Gompa e2800e
+        partition=0
Neal Gompa e2800e
+    fi
Neal Gompa e2800e
+    # shellcheck disable=SC2086
Neal Gompa e2800e
+    readonly=$(cat ${rootDeviceSysfsPath}/ro)
Neal Gompa e2800e
+    # shellcheck disable=SC2086
Neal Gompa e2800e
+    if [ "$partition" != "1" ] || [ "$readonly" != "0" ]; then
Neal Gompa e2800e
+        info "Skipping overlay creation: unpartitioned or read-only media detected"
Neal Gompa e2800e
+        exit 0
Neal Gompa e2800e
+    fi
Neal Gompa e2800e
+    # shellcheck disable=SC2046
Neal Gompa e2800e
+    # shellcheck disable=SC2086
Neal Gompa e2800e
+    fullDriveSysfsPath=$(readlink -f ${rootDeviceSysfsPath}/..)
Neal Gompa e2800e
+    blockDevice=/dev/${fullDriveSysfsPath##*/}
Neal Gompa e2800e
+    currentPartitionCount=$(grep --count -E "${blockDevice#/dev/}[0-9]+" /proc/partitions)
Neal Gompa e2800e
+
Neal Gompa e2800e
+    # shellcheck disable=SC2086
Neal Gompa e2800e
+    freeSpaceStart=$(parted --script ${blockDevice} unit % print free \
Neal Gompa e2800e
+        | awk -v x=${currentPartitionCount} '$1 == x {getline; print $1}')
Neal Gompa e2800e
+    if [ -z "$freeSpaceStart" ]; then
Neal Gompa e2800e
+        info "Skipping overlay creation: there is no free space after the last partition"
Neal Gompa e2800e
+        exit 0
Neal Gompa e2800e
+    fi
Neal Gompa e2800e
+    partitionStart=$((${freeSpaceStart%.*} + 1))
Neal Gompa e2800e
+    if [ $partitionStart -eq 100 ]; then
Neal Gompa e2800e
+        info "Skipping overlay creation: there is not enough free space after the last partition"
Neal Gompa e2800e
+        exit 0
Neal Gompa e2800e
+    fi
Neal Gompa e2800e
+
Neal Gompa e2800e
+    overlayPartition=${blockDevice}$((currentPartitionCount + 1))
Neal Gompa e2800e
+
Neal Gompa e2800e
+    label=$(blkid --match-tag LABEL --output value "$rootDevice")
Neal Gompa e2800e
+    uuid=$(blkid --match-tag UUID --output value "$rootDevice")
Neal Gompa e2800e
+    if [ -z "$label" ] || [ -z "$uuid" ]; then
Neal Gompa e2800e
+        die "Overlay creation failed: failed to look up root device label and UUID"
Neal Gompa e2800e
+    fi
Neal Gompa e2800e
+}
Neal Gompa e2800e
+
Neal Gompa e2800e
+createPartition() {
Neal Gompa e2800e
+    # shellcheck disable=SC2086
Neal Gompa e2800e
+    parted --script --align optimal ${blockDevice} mkpart primary ${partitionStart}% 100%
Neal Gompa e2800e
+}
Neal Gompa e2800e
+
Neal Gompa e2800e
+createFilesystem() {
Neal Gompa e2800e
+    # shellcheck disable=SC2086
Neal Gompa e2800e
+    mkfs.${filesystem} -L ${overlayLabel} ${overlayPartition}
Neal Gompa e2800e
+
Neal Gompa e2800e
+    baseDir=/run/initramfs/create-overlayfs
Neal Gompa e2800e
+    mkdir -p ${baseDir}
Neal Gompa e2800e
+    # shellcheck disable=SC2086
Neal Gompa e2800e
+    mount -t auto ${overlayPartition} ${baseDir}
Neal Gompa e2800e
+
Neal Gompa e2800e
+    mkdir -p ${baseDir}/${live_dir}/ovlwork
Neal Gompa e2800e
+    # shellcheck disable=SC2086
Neal Gompa e2800e
+    mkdir ${baseDir}/${live_dir}/overlay-${label}-${uuid}
Neal Gompa e2800e
+
Neal Gompa e2800e
+    umount ${baseDir}
Neal Gompa e2800e
+    rm -r ${baseDir}
Neal Gompa e2800e
+}
Neal Gompa e2800e
+
Neal Gompa e2800e
+main() {
Neal Gompa e2800e
+    gatherData "$1"
Neal Gompa e2800e
+    createPartition
Neal Gompa e2800e
+    udevsettle
Neal Gompa e2800e
+    createFilesystem
Neal Gompa e2800e
+    udevsettle
Neal Gompa e2800e
+}
Neal Gompa e2800e
+
Neal Gompa e2800e
+main "$1"
Neal Gompa e2800e
diff --git a/modules.d/90dmsquash-live-autooverlay/module-setup.sh b/modules.d/90dmsquash-live-autooverlay/module-setup.sh
Neal Gompa e2800e
new file mode 100755
Neal Gompa e2800e
index 00000000..c3712eba
Neal Gompa e2800e
--- /dev/null
Neal Gompa e2800e
+++ b/modules.d/90dmsquash-live-autooverlay/module-setup.sh
Neal Gompa e2800e
@@ -0,0 +1,25 @@
Neal Gompa e2800e
+#!/bin/bash
Neal Gompa e2800e
+
Neal Gompa e2800e
+check() {
Neal Gompa e2800e
+    # including a module dedicated to live environments in a host-only initrd doesn't make sense
Neal Gompa e2800e
+    [[ $hostonly ]] && return 1
Neal Gompa e2800e
+    return 255
Neal Gompa e2800e
+}
Neal Gompa e2800e
+
Neal Gompa e2800e
+depends() {
Neal Gompa e2800e
+    echo dmsquash-live
Neal Gompa e2800e
+    return 0
Neal Gompa e2800e
+}
Neal Gompa e2800e
+
Neal Gompa e2800e
+installkernel() {
Neal Gompa e2800e
+    instmods btrfs ext4 xfs
Neal Gompa e2800e
+}
Neal Gompa e2800e
+
Neal Gompa e2800e
+install() {
Neal Gompa e2800e
+    inst_multiple awk blkid cat grep mkdir mount parted readlink rmdir tr umount
Neal Gompa e2800e
+    inst_multiple -o mkfs.btrfs mkfs.ext4 mkfs.xfs
Neal Gompa e2800e
+    # shellcheck disable=SC2154
Neal Gompa e2800e
+    inst_hook pre-udev 25 "$moddir/create-overlay-genrules.sh"
Neal Gompa e2800e
+    inst_script "$moddir/create-overlay.sh" "/sbin/create-overlay"
Neal Gompa e2800e
+    dracut_need_initqueue
Neal Gompa e2800e
+}
Neal Gompa e2800e
diff --git a/pkgbuild/dracut.spec b/pkgbuild/dracut.spec
Neal Gompa e2800e
index 71b7421c..0f3efda7 100644
Neal Gompa e2800e
--- a/pkgbuild/dracut.spec
Neal Gompa e2800e
+++ b/pkgbuild/dracut.spec
Neal Gompa e2800e
@@ -141,7 +141,7 @@ Requires: %{name} >= %{version}-%{dist_free_release}
Neal Gompa e2800e
 Requires: %{name} = %{version}-%{release}
Neal Gompa e2800e
 %endif
Neal Gompa e2800e
 Requires: %{name}-network = %{version}-%{release}
Neal Gompa e2800e
-Requires: tar gzip coreutils bash device-mapper curl
Neal Gompa e2800e
+Requires: tar gzip coreutils bash device-mapper curl parted
Neal Gompa e2800e
 %if 0%{?fedora}
Neal Gompa e2800e
 Requires: fuse ntfs-3g
Neal Gompa e2800e
 %endif
Neal Gompa e2800e
@@ -464,6 +464,7 @@ echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/
Neal Gompa e2800e
 %files live
Neal Gompa e2800e
 %{dracutlibdir}/modules.d/99img-lib
Neal Gompa e2800e
 %{dracutlibdir}/modules.d/90dmsquash-live
Neal Gompa e2800e
+%{dracutlibdir}/modules.d/90dmsquash-live-autooverlay
Neal Gompa e2800e
 %{dracutlibdir}/modules.d/90dmsquash-live-ntfs
Neal Gompa e2800e
 %{dracutlibdir}/modules.d/90livenet
Neal Gompa e2800e
 
Neal Gompa e2800e
diff --git a/test/TEST-16-DMSQUASH/create-root.sh b/test/TEST-16-DMSQUASH/create-root.sh
Neal Gompa e2800e
index 9bc1aa5d..c11e17e0 100755
Neal Gompa e2800e
--- a/test/TEST-16-DMSQUASH/create-root.sh
Neal Gompa e2800e
+++ b/test/TEST-16-DMSQUASH/create-root.sh
Neal Gompa e2800e
@@ -11,9 +11,17 @@ udevadm control --reload
Neal Gompa e2800e
 set -e
Neal Gompa e2800e
 
Neal Gompa e2800e
 udevadm settle
Neal Gompa e2800e
-mkfs.ext4 -q -L dracut /dev/disk/by-id/ata-disk_root
Neal Gompa e2800e
+
Neal Gompa e2800e
+# create a single partition using 50% of the capacity of the image file created by test_setup() in test.sh
Neal Gompa e2800e
+sfdisk /dev/disk/by-id/ata-disk_root << EOF
Neal Gompa e2800e
+2048,161792
Neal Gompa e2800e
+EOF
Neal Gompa e2800e
+
Neal Gompa e2800e
+udevadm settle
Neal Gompa e2800e
+
Neal Gompa e2800e
+mkfs.ext4 -q -L dracut /dev/disk/by-id/ata-disk_root-part1
Neal Gompa e2800e
 mkdir -p /root
Neal Gompa e2800e
-mount /dev/disk/by-id/ata-disk_root /root
Neal Gompa e2800e
+mount /dev/disk/by-id/ata-disk_root-part1 /root
Neal Gompa e2800e
 mkdir -p /root/run /root/testdir
Neal Gompa e2800e
 echo "Creating squashfs"
Neal Gompa e2800e
 mksquashfs /source /root/testdir/rootfs.img -quiet
Neal Gompa e2800e
diff --git a/test/TEST-16-DMSQUASH/test-init.sh b/test/TEST-16-DMSQUASH/test-init.sh
Neal Gompa e2800e
index 068e8f38..959fa25f 100755
Neal Gompa e2800e
--- a/test/TEST-16-DMSQUASH/test-init.sh
Neal Gompa e2800e
+++ b/test/TEST-16-DMSQUASH/test-init.sh
Neal Gompa e2800e
@@ -9,6 +9,12 @@ exec > /dev/console 2>&1
Neal Gompa e2800e
 
Neal Gompa e2800e
 echo "dracut-root-block-success" | dd oflag=direct,dsync of=/dev/disk/by-id/ata-disk_marker
Neal Gompa e2800e
 
Neal Gompa e2800e
+if grep -qF ' rd.live.overlay=LABEL=persist ' /proc/cmdline; then
Neal Gompa e2800e
+    # Writing to a file in the root filesystem lets test_run() verify that the autooverlay module successfully created
Neal Gompa e2800e
+    # and formatted the overlay partition and that the dmsquash-live module used it when setting up the rootfs overlay.
Neal Gompa e2800e
+    echo "dracut-autooverlay-success" > /overlay-marker
Neal Gompa e2800e
+fi
Neal Gompa e2800e
+
Neal Gompa e2800e
 export TERM=linux
Neal Gompa e2800e
 export PS1='initramfs-test:\w\$ '
Neal Gompa e2800e
 [ -f /etc/mtab ] || ln -sfn /proc/mounts /etc/mtab
Neal Gompa e2800e
diff --git a/test/TEST-16-DMSQUASH/test.sh b/test/TEST-16-DMSQUASH/test.sh
Neal Gompa e2800e
index cf433489..a446b3c9 100755
Neal Gompa e2800e
--- a/test/TEST-16-DMSQUASH/test.sh
Neal Gompa e2800e
+++ b/test/TEST-16-DMSQUASH/test.sh
Neal Gompa e2800e
@@ -5,8 +5,9 @@ TEST_DESCRIPTION="live root on a squash filesystem"
Neal Gompa e2800e
 
Neal Gompa e2800e
 KVERSION="${KVERSION-$(uname -r)}"
Neal Gompa e2800e
 
Neal Gompa e2800e
-# Uncomment this to debug failures
Neal Gompa e2800e
-# DEBUGFAIL="rd.shell rd.debug loglevel=7"
Neal Gompa e2800e
+# Uncomment these to debug failures
Neal Gompa e2800e
+#DEBUGFAIL="rd.shell rd.debug rd.live.debug loglevel=7"
Neal Gompa e2800e
+#DEBUGTOOLS="setsid ls cat sfdisk"
Neal Gompa e2800e
 
Neal Gompa e2800e
 test_run() {
Neal Gompa e2800e
     dd if=/dev/zero of="$TESTDIR"/marker.img bs=1MiB count=1
Neal Gompa e2800e
@@ -23,6 +24,27 @@ test_run() {
Neal Gompa e2800e
         -initrd "$TESTDIR"/initramfs.testing
Neal Gompa e2800e
 
Neal Gompa e2800e
     grep -U --binary-files=binary -F -m 1 -q dracut-root-block-success -- "$TESTDIR"/marker.img || return 1
Neal Gompa e2800e
+
Neal Gompa e2800e
+    rootPartitions=$(sfdisk -d "$TESTDIR"/root.img | grep -c 'root\.img[0-9]')
Neal Gompa e2800e
+    [ "$rootPartitions" -eq 1 ] || return 1
Neal Gompa e2800e
+
Neal Gompa e2800e
+    "$testdir"/run-qemu \
Neal Gompa e2800e
+        "${disk_args[@]}" \
Neal Gompa e2800e
+        -boot order=d \
Neal Gompa e2800e
+        -append "rd.live.image rd.live.overlay.overlayfs=1 rd.live.overlay=LABEL=persist rd.live.dir=testdir root=LABEL=dracut console=ttyS0,115200n81 quiet selinux=0 rd.info rd.shell=0 panic=1 oops=panic softlockup_panic=1 $DEBUGFAIL" \
Neal Gompa e2800e
+        -initrd "$TESTDIR"/initramfs.testing-autooverlay
Neal Gompa e2800e
+
Neal Gompa e2800e
+    rootPartitions=$(sfdisk -d "$TESTDIR"/root.img | grep -c 'root\.img[0-9]')
Neal Gompa e2800e
+    [ "$rootPartitions" -eq 2 ] || return 1
Neal Gompa e2800e
+
Neal Gompa e2800e
+    (
Neal Gompa e2800e
+        # Ensure that this test works when run with the `V=1` parameter, which runs the script with `set -o pipefail`.
Neal Gompa e2800e
+        set +o pipefail
Neal Gompa e2800e
+
Neal Gompa e2800e
+        # Verify that the string "dracut-autooverlay-success" occurs in the second partition in the image file.
Neal Gompa e2800e
+        dd if="$TESTDIR"/root.img bs=1MiB skip=80 status=none \
Neal Gompa e2800e
+            | grep -U --binary-files=binary -F -m 1 -q dracut-autooverlay-success
Neal Gompa e2800e
+    ) || return 1
Neal Gompa e2800e
 }
Neal Gompa e2800e
 
Neal Gompa e2800e
 test_setup() {
Neal Gompa e2800e
@@ -49,7 +71,7 @@ test_setup() {
Neal Gompa e2800e
         ln -s dracut-util "${initdir}/usr/bin/dracut-getarg"
Neal Gompa e2800e
         ln -s dracut-util "${initdir}/usr/bin/dracut-getargs"
Neal Gompa e2800e
 
Neal Gompa e2800e
-        inst_multiple mkdir ln dd stty mount poweroff
Neal Gompa e2800e
+        inst_multiple mkdir ln dd stty mount poweroff grep "$DEBUGTOOLS"
Neal Gompa e2800e
 
Neal Gompa e2800e
         cp -a -- /etc/ld.so.conf* "$initdir"/etc
Neal Gompa e2800e
         ldconfig -r "$initdir"
Neal Gompa e2800e
@@ -113,6 +135,16 @@ test_setup() {
Neal Gompa e2800e
         --force "$TESTDIR"/initramfs.testing "$KVERSION" || return 1
Neal Gompa e2800e
 
Neal Gompa e2800e
     ls -sh "$TESTDIR"/initramfs.testing
Neal Gompa e2800e
+
Neal Gompa e2800e
+    "$basedir"/dracut.sh -l -i "$TESTDIR"/overlay / \
Neal Gompa e2800e
+        --modules "dmsquash-live-autooverlay qemu" \
Neal Gompa e2800e
+        --omit "rngd" \
Neal Gompa e2800e
+        --drivers "ext4 sd_mod" \
Neal Gompa e2800e
+        --no-hostonly --no-hostonly-cmdline \
Neal Gompa e2800e
+        --force "$TESTDIR"/initramfs.testing-autooverlay "$KVERSION" || return 1
Neal Gompa e2800e
+
Neal Gompa e2800e
+    ls -sh "$TESTDIR"/initramfs.testing-autooverlay
Neal Gompa e2800e
+
Neal Gompa e2800e
     rm -rf -- "$TESTDIR"/overlay
Neal Gompa e2800e
 }
Neal Gompa e2800e
 
Neal Gompa e2800e
diff --git a/test/container/Dockerfile-Arch b/test/container/Dockerfile-Arch
Neal Gompa e2800e
index 922b8ede..4112cc5b 100644
Neal Gompa e2800e
--- a/test/container/Dockerfile-Arch
Neal Gompa e2800e
+++ b/test/container/Dockerfile-Arch
Neal Gompa e2800e
@@ -9,10 +9,10 @@ RUN echo 'export DRACUT_NO_XATTR=1 KVERSION=$(cd /lib/modules; ls -1 | tail -1)'
Neal Gompa e2800e
 
Neal Gompa e2800e
 # Install needed packages for the dracut CI container
Neal Gompa e2800e
 RUN pacman --noconfirm -Sy \
Neal Gompa e2800e
-    linux dash strace dhclient asciidoc cpio pigz \
Neal Gompa e2800e
+    linux dash strace dhclient asciidoc cpio pigz squashfs-tools \
Neal Gompa e2800e
     qemu btrfs-progs mdadm dmraid nfs-utils nfsidmap lvm2 nbd \
Neal Gompa e2800e
     dhcp networkmanager multipath-tools vi tcpdump open-iscsi \
Neal Gompa e2800e
-    git shfmt shellcheck astyle which base-devel && yes | pacman  -Scc
Neal Gompa e2800e
+    git shfmt shellcheck astyle which base-devel glibc parted && yes | pacman -Scc
Neal Gompa e2800e
 
Neal Gompa e2800e
 RUN useradd -m build
Neal Gompa e2800e
 RUN su build -c 'cd && git clone https://aur.archlinux.org/perl-config-general.git && cd perl-config-general && makepkg -s --noconfirm'
Neal Gompa e2800e
diff --git a/test/container/Dockerfile-Debian b/test/container/Dockerfile-Debian
Neal Gompa e2800e
index b4c1704e..15eb9958 100644
Neal Gompa e2800e
--- a/test/container/Dockerfile-Debian
Neal Gompa e2800e
+++ b/test/container/Dockerfile-Debian
Neal Gompa e2800e
@@ -42,6 +42,7 @@ RUN apt-get update -y -qq && apt-get upgrade -y -qq && DEBIAN_FRONTEND=nonintera
Neal Gompa e2800e
     network-manager \
Neal Gompa e2800e
     nfs-common \
Neal Gompa e2800e
     open-iscsi \
Neal Gompa e2800e
+    parted \
Neal Gompa e2800e
     pigz \
Neal Gompa e2800e
     pkg-config \
Neal Gompa e2800e
     procps \
Neal Gompa e2800e
diff --git a/test/container/Dockerfile-Fedora-latest b/test/container/Dockerfile-Fedora-latest
Neal Gompa e2800e
index 87c749f9..a38a72ef 100644
Neal Gompa e2800e
--- a/test/container/Dockerfile-Fedora-latest
Neal Gompa e2800e
+++ b/test/container/Dockerfile-Fedora-latest
Neal Gompa e2800e
@@ -49,6 +49,7 @@ RUN dnf -y install --setopt=install_weak_deps=False \
Neal Gompa e2800e
     which \
Neal Gompa e2800e
     ShellCheck \
Neal Gompa e2800e
     shfmt \
Neal Gompa e2800e
+    parted \
Neal Gompa e2800e
     && dnf -y update && dnf clean all
Neal Gompa e2800e
 
Neal Gompa e2800e
 # Set default command
Neal Gompa e2800e
diff --git a/test/container/Dockerfile-OpenSuse-latest b/test/container/Dockerfile-OpenSuse-latest
Neal Gompa e2800e
index 637d50c6..9aaf07b1 100644
Neal Gompa e2800e
--- a/test/container/Dockerfile-OpenSuse-latest
Neal Gompa e2800e
+++ b/test/container/Dockerfile-OpenSuse-latest
Neal Gompa e2800e
@@ -13,7 +13,7 @@ RUN dnf -y install --setopt=install_weak_deps=False \
Neal Gompa e2800e
     strace libkmod-devel gcc bzip2 xz tar wget rpm-build make git bash-completion \
Neal Gompa e2800e
     sudo kernel dhcp-client qemu-kvm /usr/bin/qemu-system-$(uname -m) e2fsprogs \
Neal Gompa e2800e
     tcpdump iproute iputils kbd NetworkManager btrfsprogs tgt dbus-broker \
Neal Gompa e2800e
-    iscsiuio open-iscsi which ShellCheck procps pigz \
Neal Gompa e2800e
+    iscsiuio open-iscsi which ShellCheck procps pigz parted squashfs \
Neal Gompa e2800e
     && dnf -y update && dnf clean all
Neal Gompa e2800e
 
Neal Gompa e2800e
 RUN shfmt_version=3.2.4; wget "https://github.com/mvdan/sh/releases/download/v${shfmt_version}/shfmt_v${shfmt_version}_linux_amd64" -O /usr/local/bin/shfmt \
Neal Gompa e2800e
-- 
Neal Gompa e2800e
2.36.1
Neal Gompa e2800e