Skip to content

Commit 813577e

Browse files
LaszloGombosConan-Kudo
authored andcommitted
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.
1 parent 7de9ffc commit 813577e

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

modules.d/90dmsquash-live/dmsquash-live-root.sh

+8-4
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,6 @@ do_live_overlay() {
210210
fi
211211
fi
212212
if [ -n "$overlayfs" ]; then
213-
mkdir -m 0755 -p /run/overlayfs
214-
mkdir -m 0755 -p /run/ovlwork
215213
if [ -n "$readonly_overlay" ] && ! [ -h /run/overlayfs-r ]; then
216214
info "No persistent overlay found."
217215
unset -v readonly_overlay
@@ -368,7 +366,14 @@ fi
368366
ROOTFLAGS="$(getarg rootflags)"
369367

370368
if [ -n "$overlayfs" ]; then
371-
mkdir -m 0755 -p /run/rootfsbase
369+
if [ -n "$FSIMG" ]; then
370+
mkdir -m 0755 -p /run/rootfsbase
371+
mount -r $FSIMG /run/rootfsbase
372+
else
373+
ln -sf /run/initramfs/live /run/rootfsbase
374+
fi
375+
mkdir -m 0755 -p /run/overlayfs
376+
mkdir -m 0755 -p /run/ovlwork
372377
if [ -n "$reset_overlay" ] && [ -h /run/overlayfs ]; then
373378
ovlfs=$(readlink /run/overlayfs)
374379
info "Resetting the OverlayFS overlay directory."
@@ -379,7 +384,6 @@ if [ -n "$overlayfs" ]; then
379384
else
380385
ovlfs=lowerdir=/run/rootfsbase
381386
fi
382-
mount -r $FSIMG /run/rootfsbase
383387
if [ -z "$DRACUT_SYSTEMD" ]; then
384388
printf 'mount -t overlay LiveOS_rootfs -o%s,%s %s\n' "$ROOTFLAGS" \
385389
"$ovlfs",upperdir=/run/overlayfs,workdir=/run/ovlwork \

0 commit comments

Comments
 (0)