[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1018239: live-boot: please add support for subroot= option



Package: live-boot
Version: 1:20220505
Severity: wishlist
Tags: patch
Control: found -1 1:20190614

	[Please do not Cc: me, for I’m “on the list,” so to say, and
	I try to reserve my inbox for private communication only.
	I’d have set up Mail-Followup-To:, but there doesn’t seem to
	be a way to make it point to the report being filed.]

	SquashFS support for file-level deduplication makes it more
	space-efficient to have several distinct Debian installs on
	a single SquashFS image, rather than have one image per
	install (as per the following syslinux.cfg example snippet.)

LABEL bookworm-2022-08-20
...
APPEND ... boot=live toram=6300e90c.squashfs ...

LABEL bookworm-2022-08-24
...
APPEND ... boot=live toram=6305aa79.squashfs ...

	This in turn can be used for tracking testing / unstable,
	or for having an image with conflicting packages installed
	(even though only one of any given set of such will be
	usable for a given boot.)

	Moreover, this allows for the SquashFS in question to be
	updated incrementally, rather than written anew each time,
	which is more friendly to flash-based storage devices; and
	also allows for booting into an earlier install should there
	be issues with the latest one.

	I hereby suggest that a subroot= option is implemented, to
	point to a subdirectory on the underlying read-only image to
	be used in place of its root; like, Syslinux-wise:

LABEL bookworm-2022-08-24
...
APPEND ... boot=live toram=bookworm.squashfs subroot=x6305aa79 ...

	The overlay will then use lowerdir=/run/live/rootfs/bookworm
	.squashfs/x6305aa79 in place of /run/live/rootfs/bookworm
	.squashfs .

	FWIW, I’m using this feature for all my ‘live’ images for
	a couple of years now, but my configurations are somewhat
	similar, so I can’t claim that I’ve tested it extensively.

	Also, while we’re at it, I’ve followed the surrounding
	code’s style and used:

   subroot=*) ROOTINFIX="${_PARAMETER#subroot=}" ...
   union=*)   UNIONTYPE="${_PARAMETER#union=}" ...

	But it sure is less redundant (and thus less error-prone)
	to use instead:

   subroot=*) ROOTINFIX="${_PARAMETER#*=}" ...
   union=*)   UNIONTYPE="${_PARAMETER#*=}" ...

	Note that in the latter case there’s only one place the
	option name needs to be changed (or aliases added), if
	ever need arises.

-- 
FSF associate member #7257  http://am-1.org/~ivan/
--- lib/live/boot/.9990-overlay.sh.~2022-08-23~	2022-05-05 10:16:56 +0000
+++ lib/live/boot/9990-overlay.sh	2022-08-23 22:45:09 +0000
@@ -83,7 +83,7 @@ setup_unionfs ()
 			if [ -d "${image}" ]
 			then
 				# it is a plain directory: do nothing
-				rootfslist="${image} ${rootfslist}"
+				rootfslist="${image}${ROOTINFIX:+/$ROOTINFIX} ${rootfslist}"
 			elif [ -f "${image}" ]
 			then
 				if losetup --help 2>&1 | grep -q -- "-r\b"
@@ -106,7 +106,7 @@ setup_unionfs ()
 				esac
 
 				mpoint=$(trim_path "${croot}/${imagename}")
-				rootfslist="${mpoint} ${rootfslist}"
+				rootfslist="${mpoint}${ROOTINFIX:+/$ROOTINFIX} ${rootfslist}"
 				mount_options=""
 
 				# Setup dm-verity support if a device has it supported
@@ -188,9 +188,9 @@ setup_unionfs ()
 		log_begin_msg "Mounting \"${image_directory}\" on \"${croot}/filesystem\""
 		mount -t $(get_fstype "${image_directory}") -o ro,noatime "${image_directory}" "${croot}/filesystem" || \
 			panic "Can not mount ${image_directory} on ${croot}/filesystem" && \
-			rootfslist="${croot}/filesystem ${rootfslist}"
+			rootfslist="${croot}/filesystem${ROOTINFIX:+/$ROOTINFIX} ${rootfslist}"
 		# probably broken:
-		mount -o bind ${croot}/filesystem $mountpoint
+		mount -o bind "${croot}/filesystem${ROOTINFIX:+/$ROOTINFIX}" "$mountpoint"
 		log_end_msg
 	fi
 
--- lib/live/boot/.9990-cmdline-old.~2022-08-23~	2022-05-05 10:16:56 +0000
+++ lib/live/boot/9990-cmdline-old	2022-08-23 22:45:10 +0000
@@ -257,6 +257,11 @@ Cmdline_old ()
 				export ROOT
 				;;
 
+			subroot=*)
+				ROOTINFIX="${_PARAMETER#subroot=}"
+				export ROOTINFIX
+				;;
+
 			union=*)
 				UNIONTYPE="${_PARAMETER#union=}"
 				export UNIONTYPE

Reply to: