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

Re: Persistence file on the same partition of the live filesystem



On 26/11/12 20:42, Daniel Baumann wrote:
On 11/26/2012 09:25 PM, David Hare wrote:
This subject has been raised before but didn't get much interest.

because it's a rather low priority thing, however, if you send patches..
i'll look at them.


I know, it's still low priority but remains on the "wishlist". Using live-boot_4.0~a7-1 I'm still able to mount the live-media partion RW without problems.. and use a persistence file on the same partition.

Attached is an updated patch to enable custom mount options for 4.0~a7-1. This time more attention is paid to simplifying it, with clearer notes and *not* altering any original code. It works.. at least here, using syslinux usb.

How I use it is by applying to /lib/live/boot/9990-misc-helpers.sh in a decompressed copy of the "live" intrd (then no need to change any actual package files).. boot with the new, recompressed initrd.

This was also tested successfully using, additionally, Peter Schaefer's patch for luks persist file (included here)

David Hare

4a5,39
> # PATCH + ####################################################
> #
> # This file has patched code added where marked "# PATCH +"
> # This allows custom mount options for the live-media partition
> # A persistence file on the live-media partition may then be used
> # No original code is modified nor removed
> #
> # Original file: /lib/live/boot/9990-misc-helpers.sh
> # Version: live-boot_4.0~a7-1
> #
> # David Hare, February 2013
> #
> # Using custom mount options:
> #
> # Example cmdline append for (root only) RW access:
> # " basemountmode=rw,noatime" (no quotes)
> #
> # RW access for users (vfat only):
> # " basemountmode=rw,noatime,umask=000" (no quotes)
> #
> # Then we can write to the device that contains the live-media
> # and use the same partition for a persistent loopback file
> #
> # If "basemountmode" is not specified at all:
> # the original script code runs unmodified (device is mounted "ro,noatime")
> 
> custom_mountmode=$(cat /proc/cmdline|grep -o "basemountmode=.*"|sed 's/ .*//'|sed 's/basemountmode=//')
> 
> if [ -n "${custom_mountmode}" ]; then
> echo "Custom mount options were selected"
> echo "The live-media device will be mounted ${custom_mountmode}"
> fi
> 
> # PATCH END ##################################################
> 
152a188,199
> 
> 
> # PATCH + ####################################################
> 
> # if "custom_mountmode" was set, remount /live/fromiso
> 
> if [ -n "${custom_mountmode}" ]; then
> mount -t ${fstype} -o remount,${custom_mountmode} "$ISO_DEVICE" /live/fromiso 
> fi
> 
> # PATCH end ##################################################
> 
221a269
> 
222a271,281
> 
> # PATCH + ####################################################
> 
> # If "custom_mountmode" was set, remount the live-media device
> 
> if [ -n "${custom_mountmode}" ]; then
> mount -t ${fstype} -o remount,${custom_mountmode} "${devname}" ${mountpoint} || continue 
> fi
> 
> # PATCH end ##################################################
> 
231a291,301
> 
> # PATCH + ####################################################
> 
> # If "custom_mountmode" was set, remount /live/findiso
> 
> if [ -n "${custom_mountmode}" ]; then
> mount -t ${fstype} -o remount,${custom_mountmode} "${devname}" /live/findiso 
> fi
> 
> # PATCH end ##################################################
> 
739a810,827
> 
> # PATCH + ####################################################
> 
> # (only if) "custom_mountmode" is set RW
> # set ${backing} and stop if live-media device is already mounted
> 
> if echo ${custom_mountmode}|grep -q rw; then
> 
> 	if [ "${old_backing}" = "/live/findiso" ] || [ "${old_backing}" = "/live/fromiso" ] || [ "${old_backing}" = "/live/medium" ]
> 	then
> 	backing=${old_backing}
> 	echo ${backing}
> 	return 0
> 	fi
> fi
> 
> # PATCH  END #################################################
> 	
961a1050,1065
> # PATCH + ####################################################
> 
> # Not to do with custom_mountmode:
> # Fix for live-media partition getting remounted on /live/persistence/ when using luks persistence file
> # Add these to the black_listed_devices
> 
> black_listed_devices="$(what_is_mounted_on /live/medium) $(what_is_mounted_on /live/fromiso) $(what_is_mounted_on /live/findiso)"
> 
> # If custom_mountmode is active, reset the blacklist.. A persistence file might be there
> 
> if echo ${custom_mountmode}|grep -q rw; then
> black_listed_devices=""
> fi
> 
> # PATCH END ##################################################
> 
1010a1115,1137
> 
> # PATCH + ###################################################
> 
> # Fix for luks persistence file (Peter Schaefer) 
> 
> 			        local loopdevice
> 				loopdevice=${result##*=}
> 			        if is_in_comma_sep_list luks ${PERSISTENCE_ENCRYPTION} && is_luks_partition ${loopdevice}
> 				then
> 				        local luksfile
> 					luksfile=""
> 					if luksfile=$(open_luks_device "${loopdevice}")
> 					then
> 					        result=${result%%=*}
> 						result="${result}=${luksfile}"
> 					else
> 					        losetup -d $loopdevice
> 						result=""
> 					fi
> 				fi
> 
> # PATCH END ##################################################
> 


Reply to: