Adapt grml-reboot init script for new live-boot live directory
authorMichael Prokop <mika@grml.org>
Thu, 10 Jan 2013 13:05:38 +0000 (14:05 +0100)
committerMichael Prokop <mika@grml.org>
Thu, 10 Jan 2013 13:05:38 +0000 (14:05 +0100)
Debian's live-boot changed the path from /live/image to
/lib/live/mount/medium, so adopt our code to support those
new versions without breaking older ISOs.

etc/init.d/grml-reboot

index 50e6c9c..21ccf6c 100755 (executable)
@@ -43,13 +43,17 @@ grep -qe 'toram' -qe '2ram' -qe 'usb' -qe 'serial' \
 
 # detect cdrom device
 if ! $INSTALLED ; then
-   # new live-initramfs layout:
-   if [ -d /live/image ] ; then
-      CDROM="$(awk '/ \/live\/image /{print $1;exit 0;}' /proc/mounts)"
-      MOUNTPATH="/live/image"
-   else # old unionfs layout:
-      CDROM="$(awk '/ \/cdrom /{print $1;exit 0;}' /proc/mounts)"
-      MOUNTPATH="/cdrom"
+   # live-boot layout since December 2012:
+   if [ -d /lib/live/mount/medium ] ; then
+     CDROM="$(awk '/ \/lib\/live\/mount\/medium /{print $1;exit 0;}' /proc/mounts)"
+     MOUNTPATH="/lib/live/mount/medium"
+   # live-boot layout until December 2012:
+   elif [ -d /live/image ] ; then
+     CDROM="$(awk '/ \/live\/image /{print $1;exit 0;}' /proc/mounts)"
+     MOUNTPATH="/live/image"
+   else # old layout:
+     CDROM="$(awk '/ \/cdrom /{print $1;exit 0;}' /proc/mounts)"
+     MOUNTPATH="/cdrom"
    fi
 
    # try to remove only removable devices
@@ -210,7 +214,7 @@ $INSTALLED && mount -n -o remount,ro / 2>/dev/null
 # Prompt for removal of live system device
 if ! $INSTALLED && ! $NOPROMPT ; then
    # do not prompt for removal when running in grml2ram mode:
-   if ! mount | grep -qe 'on /cdrom' -qe 'on /live/image' ; then
+   if ! mount | grep -qe 'on /cdrom' -qe 'on /live/image' -qe 'on /lib/live/mount/medium' ; then
       echo "Live System not mounted, nothing to eject therefore."
    else
       [ -d "$MOUNTPATH" ] && umount -l "$MOUNTPATH"