Also allowing to use the removable keyword for specifying a live media.
[live-boot-grml.git] / scripts / live
index 5d5b978..d7c2347 100755 (executable)
@@ -1401,13 +1401,33 @@ find_livefs ()
        fi
 
        # first look at the one specified in the command line
-       if [ ! -z "${LIVE_MEDIA}" ]
-       then
-               if check_dev "null" "${LIVE_MEDIA}" "skip_uuid_check"
-               then
-                       return 0
-               fi
-       fi
+       case "${LIVE_MEDIA}" in
+               removable)
+                       for sysblock in $(echo /sys/block/* | tr ' ' '\n' | grep -vE "/(loop|ram|dm-|fd)")
+                       do
+                               if [ "$(cat ${sysblock}/removable)" = "1" ]
+                               then
+                                       for dev in $(subdevices "${sysblock}")
+                                       do
+                                               if check_dev "${dev}"
+                                               then
+                                                       return 0
+                                               fi
+                                       done
+                               fi
+                       done
+                       ;;
+
+               *)
+                       if [ ! -z "${LIVE_MEDIA}" ]
+                       then
+                               if check_dev "null" "${LIVE_MEDIA}" "skip_uuid_check"
+                               then
+                                       return 0
+                               fi
+                       fi
+                       ;;
+       esac
 
        # or do the scan of block devices
        for sysblock in $(echo /sys/block/* | tr ' ' '\n' | grep -vE "/(loop|ram|dm-|fd)")