Improving robustness of fromiso cleanup process with is_mountpoint (Closes: #668100).
[live-boot-grml.git] / scripts / live
index 780c5de..371fac4 100755 (executable)
@@ -1255,15 +1255,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
@@ -1595,8 +1595,14 @@ mountroot ()
        # 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 /live/fromiso
+               then
+                       umount /live/fromiso
+                       rmdir --ignore-fail-on-non-empty /live/fromiso \
+                               >/dev/null 2>&1 || true
+               fi
        fi
 
        if [ -n "${MODULETORAMFILE}" ] || [ -n "${PLAIN_ROOT}" ]
@@ -1649,7 +1655,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 \