Skip to content

Commit

Permalink
fix(dmsquash-live): permanent overlay on the same drive as LiveCD .iso
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
LaszloGombos authored and johannbg committed Mar 1, 2022
1 parent ce55a85 commit 9a884b3
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion modules.d/90dmsquash-live/dmsquash-live-root.sh
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,14 @@ do_live_overlay() {
# need to know where to look for the overlay
if [ -z "$setup" -a -n "$devspec" -a -n "$pathspec" -a -n "$overlay" ]; then
mkdir -m 0755 -p /run/initramfs/overlayfs
mount -n -t auto "$devspec" /run/initramfs/overlayfs || :
if ismounted "$devspec"; then
devmnt=$(findmnt -e -v -n -o 'TARGET' --source "$devspec")
# We need $devspec writable for overlay storage
mount -o remount,rw "$devspec"
mount --bind "$devmnt" /run/initramfs/overlayfs
else
mount -n -t auto "$devspec" /run/initramfs/overlayfs || :
fi
if [ -f /run/initramfs/overlayfs$pathspec -a -w /run/initramfs/overlayfs$pathspec ]; then
OVERLAY_LOOPDEV=$(losetup -f --show ${readonly_overlay:+-r} /run/initramfs/overlayfs$pathspec)
over=$OVERLAY_LOOPDEV
Expand Down

0 comments on commit 9a884b3

Please sign in to comment.