From: Laszlo Gombos Date: Fri, 3 Dec 2021 16:48:03 +0000 (-0500) Subject: fix(dmsquash-live): option to use overlayfs on a block device root X-Git-Tag: 056~47 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=813577e2ba034b448d2cf2d2857b2d20d56c0259;p=thirdparty%2Fdracut.git fix(dmsquash-live): option to use overlayfs on a block device root An example kernel command line option for this configuration root=/dev/sda1 ro rd.live.image rd.live.overlay.overlayfs=1 The change checks if $FSIMG is empty and adds a symlink from /run/rootfsbase to /run/initramfs/live and changes the place of the creation of the required mount point directories. --- diff --git a/modules.d/90dmsquash-live/dmsquash-live-root.sh b/modules.d/90dmsquash-live/dmsquash-live-root.sh index 82b7dedc3..fd8a858aa 100755 --- a/modules.d/90dmsquash-live/dmsquash-live-root.sh +++ b/modules.d/90dmsquash-live/dmsquash-live-root.sh @@ -210,8 +210,6 @@ do_live_overlay() { fi fi if [ -n "$overlayfs" ]; then - mkdir -m 0755 -p /run/overlayfs - mkdir -m 0755 -p /run/ovlwork if [ -n "$readonly_overlay" ] && ! [ -h /run/overlayfs-r ]; then info "No persistent overlay found." unset -v readonly_overlay @@ -368,7 +366,14 @@ fi ROOTFLAGS="$(getarg rootflags)" if [ -n "$overlayfs" ]; then - mkdir -m 0755 -p /run/rootfsbase + if [ -n "$FSIMG" ]; then + mkdir -m 0755 -p /run/rootfsbase + mount -r $FSIMG /run/rootfsbase + else + ln -sf /run/initramfs/live /run/rootfsbase + fi + mkdir -m 0755 -p /run/overlayfs + mkdir -m 0755 -p /run/ovlwork if [ -n "$reset_overlay" ] && [ -h /run/overlayfs ]; then ovlfs=$(readlink /run/overlayfs) info "Resetting the OverlayFS overlay directory." @@ -379,7 +384,6 @@ if [ -n "$overlayfs" ]; then else ovlfs=lowerdir=/run/rootfsbase fi - mount -r $FSIMG /run/rootfsbase if [ -z "$DRACUT_SYSTEMD" ]; then printf 'mount -t overlay LiveOS_rootfs -o%s,%s %s\n' "$ROOTFLAGS" \ "$ovlfs",upperdir=/run/overlayfs,workdir=/run/ovlwork \