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

Bug#656135: Add findiso boot parametre



El 07/04/12 09:22, intrigeri escribió:
Hi,

adrian15 wrote (06 Apr 2012 18:39:46 GMT) :
I've even improved the part about checking that the iso was mounted
that intrigeri pointed out at:
http://lists.debian.org/debian-live/2011/09/msg00067.html

So you have replaced

    grep -q /live/findiso /proc/mounts&&   umount /root/live/findiso

with

    [ ! -z ${mountpoint} ]&&   umount /root/live/findiso

It seems more fragile to me than what the original patch did (although
it did in a way I did not like); but maybe you can explain us why this
new check is sufficient and/or better suited than the old one?

Well, actually, I wanted to ask you what did you mean when you said
that exactly but I didn't think of sending you an email.

I suggested using the mountpoint *command* instead of the ugly
grep hack.

I can re-submit the patch without this change or try to implement
whatever you meant if you explain it.

Please do.

Ok. I have included mountpoint command (now the copy_exec part makes sense to me :)). And I have used it as requested.

Given the trivial changes I have done I have not tested it (not even sure how to test that).

I am supposing that mountpoint is an standard command that comes with Debian standard packages and thus you don't have to edit any build-depends variable on the package definition. If my supposition is false please complain.

adrian15
--
Support free software. Donate to Super Grub Disk. Apoya el software libre. Dona a Super Grub Disk. http://www.supergrubdisk.org/donate/
diff --git a/hooks/live b/hooks/live
index 40802d0..82eca8d 100755
--- a/hooks/live
+++ b/hooks/live
@@ -229,6 +229,13 @@ then
 	copy_exec /sbin/blockdev /sbin
 fi
 
+# Program: mountpoint
+if [ -x /bin/mountpoint ]
+then
+	[ "${QUIET}" ] || echo -n " "mountpoint
+	copy_exec /bin/mountpoint /bin
+fi
+
 # FUSE kernel module
 manual_add_modules fuse
 
diff --git a/manpages/en/live-boot.7 b/manpages/en/live-boot.7
index 6a46d9b..77ac29f 100644
--- a/manpages/en/live-boot.7
+++ b/manpages/en/live-boot.7
@@ -66,6 +66,8 @@ Target <target-name>
   Lun 0 Path=<path-to-your-live-image.iso>,Type=fileio,IOMode=ro
   # If you want to boot multiple machines you might want to look at tuning some parameters like
   # Wthreads or MaxConnections
+.IP "\fBfindiso\fR=\fI/PATH/TO/IMAGE\fI" 4
+Look for the specified ISO file on all disks where it usually looks for the .squashfs file (so you don't have to know the device name as in fromiso=....).
 .IP "\fBfromiso\fR=\fI/PATH/TO/IMAGE\fI" 4
 Allows to use a filesystem from within an iso image that's available on live-media.
 .IP "\fBignore_uuid\fR" 4
diff --git a/scripts/live b/scripts/live
index e248937..ebc3cb2 100755
--- a/scripts/live
+++ b/scripts/live
@@ -1357,6 +1357,21 @@ check_dev ()
 		mount -t ${fstype} -o ro,noatime "${devname}" ${mountpoint} || continue
 		[ -n "$devuid" ] && echo "$devuid" >> $tried
 
+		if [ -n "${FINDISO}" ]
+		then
+			if [ -f ${mountpoint}/${FINDISO} ]
+			then
+				umount ${mountpoint}
+				mkdir /live/findiso -p
+				mount -t ${fstype} -o ro,noatime "${devname}" /live/findiso
+				loopdevname=$(setup_loop "/live/findiso/${FINDISO}" "loop" "/sys/block/loop*" 0 "")
+				devname="${loopdevname}"
+				mount -t iso9660 -o ro,noatime "${devname}" ${mountpoint}
+			else
+				umount ${mountpoint}
+			fi
+		fi
+
 		if is_live_path ${mountpoint} && \
 			([ "${skip_uuid_check}" ] || matches_uuid ${mountpoint})
 		then
@@ -1643,6 +1658,22 @@ mountroot ()
 	# when booting FAI, this simple workaround solves it
 	ls /root/* >/dev/null 2>&1
 
+	# Move findiso directory to the new root filesystem so that programs there can get at it.
+	if [ -d /live/findiso -a ! -d /root/live/findiso ]
+	then
+		mkdir -p /root/live/findiso
+		mount -n --move /live/findiso /root/live/findiso
+	fi
+
+	# if we do not unmount the ISO we can't run "fsck /dev/ice" later on
+	# because the mountpoint is left behind in /proc/mounts, so let's get
+	# rid of it when running from RAM
+	if [ -n "$FINDISO" ] && [ "${TORAM}" ]
+	then
+		losetup -d /dev/loop0
+		mountpoint -q /live/findiso && umount /root/live/findiso
+	fi
+
 	# copy snapshot configuration if exists
 	if [ -f snapshot.conf ]
 	then
diff --git a/scripts/live-helpers b/scripts/live-helpers
index 889d157..2d90162 100644
--- a/scripts/live-helpers
+++ b/scripts/live-helpers
@@ -143,6 +143,11 @@ Arguments ()
 				export STATICIP
 				;;
 
+			findiso=*)
+				FINDISO="${ARGUMENT#findiso=}"
+				export FINDISO
+				;;
+
 			live-getty)
 				LIVE_GETTY="1"
 				export LIVE_GETTY

Reply to: