Bug#656135: Add findiso boot parametre
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. Cheers, -- intrigeri | GnuPG key @ https://gaffer.ptitcanardnoir.org/intrigeri/intrigeri.asc | OTR fingerprint @ https://gaffer.ptitcanardnoir.org/intrigeri/otr.asc -- To UNSUBSCRIBE, email to debian-live-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/858vi8m2et@boum.org
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 21 + # 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
Bug#656135: Add findiso boot parametre
On 04/07/2012 04:06 PM, adrian15 wrote: 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. it would be a depends, not a build-depends. the initrd is build on the target system, not on the build system. /bin/mountpoint is part of initscripts from sysvinit. i'm afraid we cannot use this - a depends on initscripts is too invasive for systems running alternative init systems (systemd, upstart, etc). -- Address:Daniel Baumann, Donnerbuehlweg 3, CH-3012 Bern Email: daniel.baum...@progress-technologies.net Internet: http://people.progress-technologies.net/~daniel.baumann/ -- To UNSUBSCRIBE, email to debian-live-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/4f806b6c.7070...@progress-technologies.net
Bug#656135: Add findiso boot parametre
Hi, Daniel Baumann wrote (07 Apr 2012 16:29:32 GMT) : /bin/mountpoint is part of initscripts from sysvinit. i'm afraid we cannot use this - a depends on initscripts is too invasive for systems running alternative init systems (systemd, upstart, etc). May I ask why? System-V's /sbin/init is provided by the sysvinit binary package. I think the initscripts binary package, even if it's built from the sysvinit source package, can perfectly coexist with alternative init systems, can't it? Moreover, initscripts is Priority: required, so... Did I miss anything? Cheers, -- intrigeri | GnuPG key @ https://gaffer.ptitcanardnoir.org/intrigeri/intrigeri.asc | OTR fingerprint @ https://gaffer.ptitcanardnoir.org/intrigeri/otr.asc -- To UNSUBSCRIBE, email to debian-live-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/85obr3jwx8@boum.org
Bug#656135: Add findiso boot parametre
El 07/04/12 18:29, Daniel Baumann escribió: On 04/07/2012 04:06 PM, adrian15 wrote: 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. it would be a depends, not a build-depends. the initrd is build on the target system, not on the build system. /bin/mountpoint is part of initscripts from sysvinit. i'm afraid we cannot use this - a depends on initscripts is too invasive for systems running alternative init systems (systemd, upstart, etc). This is the alternate patch then. 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/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..8435ccd 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 21 + # 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 + grep -q /live/findiso /proc/mounts 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
Bug#656135: Add findiso boot parametre
On 04/07/2012 07:04 PM, intrigeri wrote: May I ask why? sure. there are two reasons, mainly: first, it clutters the system uselessly. it seems overkill to me to need the whole initscripts package just for that single program. granted, initscripts is not a really huge package. second, i prefere to avoid packages of other init systems when using non-sysvinit init. some init systems behave different (switching to 'legacy' mode automatically, rather than to run in 'native' mode) when initscripts is installed. if /bin/mountpoint would be a complex and very handy program, well, i would not have much of a problem (maybe trying to get it moved to another binary or source package (e.g. util-linux where it would be a proper fit)). however.. /bin/mountpoints can be replicaeded as a function of two lines of shell only, so, weighting above two issues (which are not that convincing by itself) against a trivial shell function, i'd go for the latter. I think the initscripts binary package, even if it's built from the sysvinit source package, can perfectly coexist with alternative init systems, can't it? absolutely. i didn't ment to imply a conflict between the two packages. Moreover, initscripts is Priority: required, so... first, this will change as soon as debian allows to have non-sysvinit initsystems choosen by the user. granted, probably not for wheezy, but we shouldn't rely on it when we know that this will change anytime 'soon' anyway. second, e.g. on progress linux, the wheezy based system will use systemd by default. being nice to derivatives, it would be nice to not need to ship custom live-boot just because of this. -- Address:Daniel Baumann, Donnerbuehlweg 3, CH-3012 Bern Email: daniel.baum...@progress-technologies.net Internet: http://people.progress-technologies.net/~daniel.baumann/ -- To UNSUBSCRIBE, email to debian-live-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/4f807728.2060...@progress-technologies.net
Bug#656135: Add findiso boot parametre
Hi, adrian15 wrote (07 Apr 2012 17:14:08 GMT) : This is the alternate patch then. I'm fine with the reasons Daniel provided against using mountpoint in live-boot, but I still don't consider grep -q /live/findiso /proc/mounts as a robust way to check that /root/live/findiso (or /live/findiso?) is mounted. I think we need to use something similar to mountpoint but written in shell, that is either parse /proc/mounts, or copy the way /bin/mountpoint works (its algorithm boils down comparing if the major:minor matches the ones of the parent directory). Cheers, -- intrigeri | GnuPG key @ https://gaffer.ptitcanardnoir.org/intrigeri/intrigeri.asc | OTR fingerprint @ https://gaffer.ptitcanardnoir.org/intrigeri/otr.asc -- To UNSUBSCRIBE, email to debian-live-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/85aa2njsnn@boum.org
Bug#656135: Add findiso boot parametre
On 04/07/2012 08:36 PM, intrigeri wrote: I think we need to use something similar to mountpoint but written in shell, that is either parse /proc/mounts, or copy the way /bin/mountpoint works (its algorithm boils down comparing if the major:minor matches the ones of the parent directory). alternatively, we could ask to move mountpoint from initscripts to util-linux, though, that might take a very long time to accomplish. -- Address:Daniel Baumann, Donnerbuehlweg 3, CH-3012 Bern Email: daniel.baum...@progress-technologies.net Internet: http://people.progress-technologies.net/~daniel.baumann/ -- To UNSUBSCRIBE, email to debian-live-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/4f808f4e.8070...@progress-technologies.net
Bug#656135: Add findiso boot parametre
Hi, Daniel Baumann wrote (07 Apr 2012 19:02:38 GMT) : alternatively, we could ask to move mountpoint from initscripts to util-linux, though, that might take a very long time to accomplish. Moving /bin/mountpoint to another, better suited package would be great. However, I would not like to see the current effort of getting findiso into live-boot, to be stalled by the outcome of this move. Cheers, -- intrigeri | GnuPG key @ https://gaffer.ptitcanardnoir.org/intrigeri/intrigeri.asc | OTR fingerprint @ https://gaffer.ptitcanardnoir.org/intrigeri/otr.asc -- To UNSUBSCRIBE, email to debian-live-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/85k41ribo0@boum.org
Bug#656135: Add findiso boot parametre
On 04/07/2012 09:28 PM, intrigeri wrote: Moving /bin/mountpoint to another, better suited package would be great. i'll open a bug on sysvinit for that. However, I would not like to see the current effort of getting findiso into live-boot, to be stalled by the outcome of this move. sure. -- Address:Daniel Baumann, Donnerbuehlweg 3, CH-3012 Bern Email: daniel.baum...@progress-technologies.net Internet: http://people.progress-technologies.net/~daniel.baumann/ -- To UNSUBSCRIBE, email to debian-live-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/4f809ccf.2080...@progress-technologies.net
Bug#656135: Add findiso boot parametre
El 07/04/12 20:36, intrigeri escribió: Hi, adrian15 wrote (07 Apr 2012 17:14:08 GMT) : This is the alternate patch then. I'm fine with the reasons Daniel provided against using mountpoint in live-boot, but I still don't consider grep -q /live/findiso /proc/mounts as a robust way to check that /root/live/findiso (or /live/findiso?) is mounted. I think we need to use something similar to mountpoint but written in shell, that is either parse /proc/mounts, or copy the way /bin/mountpoint works (its algorithm boils down comparing if the major:minor matches the ones of the parent directory). Cheers, I rewrote the patch according to intrigeri wishes and with some pieces of advice from Daniel. After testing this patch with boot parametres: findiso and to ram. I have run: cat /proc/mounts and the results are: rootfs / rootfs rw 0 0 sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0 proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0 udev /dev devtmpfs rw,relatime,size=506840k,nr_inodes=126710,mode=755 0 0 devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0 tmpfs /run tmpfs rw,nosuid,noexec,relatime,size=102704k,mode=755 0 0 /dev/sr0 /live/findiso iso9660 ro,noatime 0 0 /dev/shm /live/image tmpfs rw,relatime,size=144388k 0 0 /dev/loop1 /live/rofs/filesystem.squashfs squashfs ro,noatime 0 0 tmpfs /live/cow tmpfs rw,noatime,mode=755 0 0 aufs / aufs rw,relatime,si=12f0b3e00b69d11c,noxino 0 0 tmpfs /live tmpfs rw,relatime 0 0 proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0 tmpfs /run/lock tmpfs rw,nosuid,nodev,noexec,relatime,size=5120k 0 0 tmpfs /tmp tmpfs rw,nosuid,nodev,relatime,size=205404k 0 0 sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0 tmpfs /run/shm tmpfs rw,nosuid,nodev,relatime,size=205404k 0 0 I don't see any /root/live/findiso so I guess it's ok. If the patch is accepted I will send a similar patch for fromiso/isofrom option so that it uses the is_mountpoint function. 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/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..4954ce3 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,26 @@ mountroot () # when booting FAI, this simple workaround solves it ls /root/* /dev/null 21 + # 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 + + if is_mountpoint /live/findiso + then + umount /root/live/findiso + fi + fi + # copy snapshot configuration if exists if [ -f snapshot.conf ] then diff --git a/scripts/live-helpers b/scripts/live-helpers index 889d157..4258ab3 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 @@ -1579,3 +1584,15 @@ fix_home_rw_compatibility () /home source=. ${include_list} fi } + +is_mountpoint () { + + local directory=$1 + + if [ $(stat -fc%d:%D ${directory}) != $(stat
Bug#656135: Add findiso boot parametre
On 04/08/2012 12:19 AM, adrian15 wrote: I rewrote the patch according to intrigeri wishes and with some pieces of advice from Daniel. but now you did worsen it a bit compared to the last iteration :) * use 'mkdir -p /live/findiso' instead of 'mkdir /live/findiso -p' for consistency. * use 'if [ -d /live/findiso ] [ ! -d /root/live/findiso ]' instead of 'if [ -d /live/findiso -a ! -d /root/live/findiso ]' which is a bashism. * don't use 'local' when declaring variables, it's a bashism. other than that, looks good to me. -- Address:Daniel Baumann, Donnerbuehlweg 3, CH-3012 Bern Email: daniel.baum...@progress-technologies.net Internet: http://people.progress-technologies.net/~daniel.baumann/ -- To UNSUBSCRIBE, email to debian-live-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/4f811dea.2040...@progress-technologies.net