Skip to content

Commit 9a884b3

Browse files
LaszloGombosjohannbg
authored andcommitted
fix(dmsquash-live): permanent overlay on the same drive as LiveCD .iso
An example kernel command line arguments for this configuration iso-scan/filename=distro.iso root=live:CDLABEL=ISO rd.live.image rd.live.overlay=/dev/sda:/overlay.img iso-scan would mount /dev/sda first and keep it mounted. The change allows detecting if the permanent overlay drive is already mounted. It also ensures that the mount is writable, as permanent overlay requires writable storage.
1 parent ce55a85 commit 9a884b3

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

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

+8-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,14 @@ do_live_overlay() {
129129
# need to know where to look for the overlay
130130
if [ -z "$setup" -a -n "$devspec" -a -n "$pathspec" -a -n "$overlay" ]; then
131131
mkdir -m 0755 -p /run/initramfs/overlayfs
132-
mount -n -t auto "$devspec" /run/initramfs/overlayfs || :
132+
if ismounted "$devspec"; then
133+
devmnt=$(findmnt -e -v -n -o 'TARGET' --source "$devspec")
134+
# We need $devspec writable for overlay storage
135+
mount -o remount,rw "$devspec"
136+
mount --bind "$devmnt" /run/initramfs/overlayfs
137+
else
138+
mount -n -t auto "$devspec" /run/initramfs/overlayfs || :
139+
fi
133140
if [ -f /run/initramfs/overlayfs$pathspec -a -w /run/initramfs/overlayfs$pathspec ]; then
134141
OVERLAY_LOOPDEV=$(losetup -f --show ${readonly_overlay:+-r} /run/initramfs/overlayfs$pathspec)
135142
over=$OVERLAY_LOOPDEV

0 commit comments

Comments
 (0)