Bug#668100: fromiso rewriting based on findiso structure
Package: live-boot
Version: 3.0~a26-1
Severity: minor
Dear Maintainer,
I am trying to improve fromiso boot parametre current code.
I attach a patch that:
a) Rewrites it to its code structure is as close as findiso one. This
implies that the /live/fromiso (previously called /isofrom) folder is
available in the new root filesystem at /root/live/fromiso. This was not
the case in the old implementation.
b) Rewrites it to use fromiso string instead of isofrom string in the
code as often as possible.
I would like some feedback before testing it to confirm that this is
right way of coding/improving it.
Thank you very much!
diff --git a/scripts/live b/scripts/live
index f4f4059..31df5e4 100755
--- a/scripts/live
+++ b/scripts/live
@@ -1276,15 +1276,15 @@ check_dev ()
if [ "$ISO_DEVICE" = "/" ]
then
- echo "Warning: device for bootoption isofrom= ($FROMISO) not found.">>/live-boot.log
+ echo "Warning: device for bootoption fromiso= ($FROMISO) not found.">>/live-boot.log
else
fs_type=$(get_fstype "${ISO_DEVICE}")
if is_supported_fs ${fs_type}
then
- mkdir /isofrom
- mount -t $fs_type "$ISO_DEVICE" /isofrom
+ mkdir /live/fromiso
+ mount -t $fs_type "$ISO_DEVICE" /live/fromiso
ISO_NAME="$(echo $FROMISO | sed "s|$ISO_DEVICE||")"
- loopdevname=$(setup_loop "/isofrom/${ISO_NAME}" "loop" "/sys/block/loop*" "" '')
+ loopdevname=$(setup_loop "/live/fromiso/${ISO_NAME}" "loop" "/sys/block/loop*" "" '')
devname="${loopdevname}"
else
echo "Warning: unable to mount $ISO_DEVICE." >>/live-boot.log
@@ -1611,13 +1611,26 @@ mountroot ()
log_end_msg
fi
+ # Move fromiso directory to the new root filesystem so that programs there can get at it.
+ if [ -d /live/fromiso ] && [ ! -d /root/live/fromiso ]
+ then
+ mkdir -p /root/live/fromiso
+ mount -n --move /live/fromiso /root/live/fromiso
+ 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 "$FROMISO" ] && [ "${TORAM}" ]
then
- losetup -d /dev/loop0
- grep -q /isofrom /proc/mounts && umount /isofrom
+ losetup -d /dev/loop0
+
+ if is_mountpoint /root/live/fromiso
+ then
+ umount /root/live/fromiso
+ rmdir --ignore-fail-on-non-empty /root/live/fromiso \
+ >/dev/null 2>&1 || true
+ fi
fi
if [ -n "${MODULETORAMFILE}" ] || [ -n "${PLAIN_ROOT}" ]
@@ -1670,7 +1683,7 @@ mountroot ()
then
losetup -d /dev/loop0
- if is_mountpoint /live/findiso
+ if is_mountpoint /root/live/findiso
then
umount /root/live/findiso
rmdir --ignore-fail-on-non-empty /root/live/findiso \
Reply to: