diff --git a/.github/labeler.yml b/.github/labeler.yml index 1c787a5888..fe69b8093f 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -141,6 +141,9 @@ multipath: nvdimm: - modules.d/90nvdimm/* +overlayfs: + - modules.d/90overlayfs/* + ppcmac: - modules.d/90ppcmac/* diff --git a/modules.d/90dmsquash-live/dmsquash-live-genrules.sh b/modules.d/90dmsquash-live/dmsquash-live-genrules.sh index afd9924f9d..8c7cad8fe8 100755 --- a/modules.d/90dmsquash-live/dmsquash-live-genrules.sh +++ b/modules.d/90dmsquash-live/dmsquash-live-genrules.sh @@ -15,7 +15,4 @@ case "$root" in /sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root "${root#live:}" fi ;; - nfs*) - cp /sbin/mount-overlayfs "$hookdir/mount/99-mount-overlayfs.sh" - ;; esac diff --git a/modules.d/90dmsquash-live/dmsquash-live-root.sh b/modules.d/90dmsquash-live/dmsquash-live-root.sh index 9ace8f7057..17dfbc7331 100755 --- a/modules.d/90dmsquash-live/dmsquash-live-root.sh +++ b/modules.d/90dmsquash-live/dmsquash-live-root.sh @@ -425,9 +425,6 @@ if [ -n "$overlayfs" ]; then else ln -sf /run/initramfs/live /run/rootfsbase fi - if [ -z "$DRACUT_SYSTEMD" ]; then - ln -sf /sbin/mount-overlayfs "$hookdir"/mount/01-$$-live.sh - fi else if [ -z "$DRACUT_SYSTEMD" ]; then [ -n "$ROOTFLAGS" ] && ROOTFLAGS="-o $ROOTFLAGS" diff --git a/modules.d/90dmsquash-live/module-setup.sh b/modules.d/90dmsquash-live/module-setup.sh index 98c2afcf1a..b905e3dde0 100755 --- a/modules.d/90dmsquash-live/module-setup.sh +++ b/modules.d/90dmsquash-live/module-setup.sh @@ -11,13 +11,13 @@ check() { depends() { # if dmsetup is not installed, then we cannot support fedora/red hat # style live images - echo dm rootfs-block img-lib + echo dm rootfs-block img-lib overlayfs return 0 } # called by dracut installkernel() { - instmods squashfs loop iso9660 overlay + instmods squashfs loop iso9660 } # called by dracut @@ -31,7 +31,6 @@ install() { inst_hook pre-pivot 20 "$moddir/apply-live-updates.sh" inst_script "$moddir/dmsquash-live-root.sh" "/sbin/dmsquash-live-root" inst_script "$moddir/iso-scan.sh" "/sbin/iso-scan" - inst_script "$moddir/mount-overlayfs.sh" "/sbin/mount-overlayfs" if dracut_module_included "systemd-initrd"; then inst_script "$moddir/dmsquash-generator.sh" "$systemdutildir"/system-generators/dracut-dmsquash-generator inst_simple "$moddir/checkisomd5@.service" "/etc/systemd/system/checkisomd5@.service" diff --git a/modules.d/90overlayfs/module-setup.sh b/modules.d/90overlayfs/module-setup.sh new file mode 100755 index 0000000000..27aa7cfa58 --- /dev/null +++ b/modules.d/90overlayfs/module-setup.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +check() { + [[ $hostonly ]] && return 1 + return 255 +} + +depends() { + echo base +} + +installkernel() { + instmods overlay +} + +install() { + inst_hook mount 01 "$moddir/mount-overlayfs.sh" +} diff --git a/modules.d/90dmsquash-live/mount-overlayfs.sh b/modules.d/90overlayfs/mount-overlayfs.sh similarity index 88% rename from modules.d/90dmsquash-live/mount-overlayfs.sh rename to modules.d/90overlayfs/mount-overlayfs.sh index fb27656699..7e2da1a804 100755 --- a/modules.d/90dmsquash-live/mount-overlayfs.sh +++ b/modules.d/90overlayfs/mount-overlayfs.sh @@ -2,8 +2,6 @@ type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh -PATH=/usr/sbin:/usr/bin:/sbin:/bin - getargbool 0 rd.live.overlay.overlayfs && overlayfs="yes" getargbool 0 rd.live.overlay.reset -d -y reset_overlay && reset_overlay="yes" getargbool 0 rd.live.overlay.readonly -d -y readonly_overlay && readonly_overlay="--readonly" || readonly_overlay="" @@ -19,9 +17,9 @@ if [ -n "$overlayfs" ]; then mkdir -m 0755 -p /run/overlayfs mkdir -m 0755 -p /run/ovlwork if [ -n "$reset_overlay" ] && [ -h /run/overlayfs ]; then - ovlfs=$(readlink /run/overlayfs) + ovlfsdir=$(readlink /run/overlayfs) info "Resetting the OverlayFS overlay directory." - rm -r -- "${ovlfs:?}"/* "${ovlfs:?}"/.* > /dev/null 2>&1 + rm -r -- "${ovlfsdir:?}"/* "${ovlfsdir:?}"/.* > /dev/null 2>&1 fi if [ -n "$readonly_overlay" ] && [ -h /run/overlayfs-r ]; then ovlfs=lowerdir=/run/overlayfs-r:/run/rootfsbase diff --git a/test/TEST-16-DMSQUASH/test.sh b/test/TEST-16-DMSQUASH/test.sh index 3e88859bae..33ef5aaf9a 100755 --- a/test/TEST-16-DMSQUASH/test.sh +++ b/test/TEST-16-DMSQUASH/test.sh @@ -17,6 +17,12 @@ test_run() { qemu_add_drive_args disk_index disk_args "$TESTDIR"/marker.img marker qemu_add_drive_args disk_index disk_args "$TESTDIR"/root.img root + "$testdir"/run-qemu \ + "${disk_args[@]}" \ + -boot order=d \ + -append "rd.live.overlay.overlayfs=1 root=LABEL=dracut console=ttyS0,115200n81 quiet selinux=0 rd.info rd.shell=0 panic=1 oops=panic softlockup_panic=1 $DEBUGFAIL" \ + -initrd "$TESTDIR"/initramfs.testing + "$testdir"/run-qemu \ "${disk_args[@]}" \ -boot order=d \ diff --git a/test/TEST-20-NFS/test.sh b/test/TEST-20-NFS/test.sh index 81e5710e7f..b513cbea00 100755 --- a/test/TEST-20-NFS/test.sh +++ b/test/TEST-20-NFS/test.sh @@ -182,6 +182,10 @@ test_nfsv3() { "root=dhcp" 192.168.50.3 wsize=4096 || return 1 client_test "NFSv3 Overlayfs root=nfs:..." 52:54:00:12:34:04 \ + "root=nfs:192.168.50.1:/nfs/client rd.live.overlay.overlayfs=1" \ + 192.168.50.1 -wsize=4096 || return 1 + + client_test "NFSv3 Live Overlayfs root=nfs:..." 52:54:00:12:34:04 \ "root=nfs:192.168.50.1:/nfs/client rd.live.image rd.live.overlay.overlayfs=1" \ 192.168.50.1 -wsize=4096 || return 1