El 09/04/12 18:45, intrigeri escribió:
I am trying to improve fromiso boot parametre current code.
Great.
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.
I'd rather review split patches: one per kind of change.
A Git branch would be perfect, patches output by "git format-patch"
would do.
Besides, given the code structure of findiso and fromiso end up being
that similar, how hard would it be to factorize common logics somehow?
Cheers,
I attach the splitted patches.
I am doubting about 003 patch. Why fromiso didn't have in the first
place? Why findiso did it? Perhaps because fromiso in the paste did have it?
Maybe it's some kind of obsolete code.
Related to this I have found: /live/image and /root/live/image that do
not seem to be used (just rgreped for /live/image). I might open a new
bug for this but I'm not sure.
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/scripts/live b/scripts/live
index 97f548d..0703af6 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 /fromiso
+ mount -t $fs_type "$ISO_DEVICE" /fromiso
ISO_NAME="$(echo $FROMISO | sed "s|$ISO_DEVICE||")"
- loopdevname=$(setup_loop "/isofrom/${ISO_NAME}" "loop" "/sys/block/loop*" "" '')
+ loopdevname=$(setup_loop "/fromiso/${ISO_NAME}" "loop" "/sys/block/loop*" "" '')
devname="${loopdevname}"
else
echo "Warning: unable to mount $ISO_DEVICE." >>/live-boot.log
@@ -1617,7 +1617,7 @@ mountroot ()
if [ -n "$FROMISO" ] && [ "${TORAM}" ]
then
losetup -d /dev/loop0
- grep -q /isofrom /proc/mounts && umount /isofrom
+ grep -q /fromiso /proc/mounts && umount /fromiso
fi
if [ -n "${MODULETORAMFILE}" ] || [ -n "${PLAIN_ROOT}" ]
diff --git a/scripts/live b/scripts/live
index 0703af6..17b1b30 100755
--- a/scripts/live
+++ b/scripts/live
@@ -1281,10 +1281,10 @@ check_dev ()
fs_type=$(get_fstype "${ISO_DEVICE}")
if is_supported_fs ${fs_type}
then
- mkdir /fromiso
- mount -t $fs_type "$ISO_DEVICE" /fromiso
+ mkdir /live/fromiso
+ mount -t $fs_type "$ISO_DEVICE" /live/fromiso
ISO_NAME="$(echo $FROMISO | sed "s|$ISO_DEVICE||")"
- loopdevname=$(setup_loop "/fromiso/${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
@@ -1617,7 +1617,7 @@ mountroot ()
if [ -n "$FROMISO" ] && [ "${TORAM}" ]
then
losetup -d /dev/loop0
- grep -q /fromiso /proc/mounts && umount /fromiso
+ grep -q /live/fromiso /proc/mounts && umount /live/fromiso
fi
if [ -n "${MODULETORAMFILE}" ] || [ -n "${PLAIN_ROOT}" ]
diff --git a/scripts/live b/scripts/live
index 17b1b30..28fcbea 100755
--- a/scripts/live
+++ b/scripts/live
@@ -1611,6 +1611,13 @@ 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
diff --git a/scripts/live b/scripts/live
index 28fcbea..31df5e4 100755
--- a/scripts/live
+++ b/scripts/live
@@ -1623,8 +1623,14 @@ mountroot ()
# rid of it when running from RAM
if [ -n "$FROMISO" ] && [ "${TORAM}" ]
then
- losetup -d /dev/loop0
- grep -q /live/fromiso /proc/mounts && umount /live/fromiso
+ 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}" ]