summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Baumann <daniel@debian.org>2009-03-12 08:07:48 +0100
committerDaniel Baumann <daniel@debian.org>2011-03-09 17:48:04 +0100
commit46d3944369fb7436c4e7129df65f2f1a6dbf3ffc (patch)
tree100eee8fe8f5a571186824bc820a4e4cac24efa9
parentf5302bcc273b3b7f557e3b30c6457d9c20d05b56 (diff)
downloadlive-boot-46d3944369fb7436c4e7129df65f2f1a6dbf3ffc.tar.gz
live-boot-46d3944369fb7436c4e7129df65f2f1a6dbf3ffc.zip
Also allowing to use the removable keyword for specifying a live media.
-rw-r--r--manpages/live-initramfs.en.7.txt4
-rwxr-xr-xscripts/live34
2 files changed, 31 insertions, 7 deletions
diff --git a/manpages/live-initramfs.en.7.txt b/manpages/live-initramfs.en.7.txt
index c1dcd5b..d6a7d21 100644
--- a/manpages/live-initramfs.en.7.txt
+++ b/manpages/live-initramfs.en.7.txt
@@ -114,6 +114,10 @@ to find this device for the "/live" directory where the read-only root
filesystem should reside. If it did not find something usable, the normal scan
for block devices is performed.
+Instead of specifing an actual device name, the keyword 'removable' can be used
+to limit the search of acceptable live media to removable type only. Note that
+cdrom devices are not removable, but e.g. usb mass storage is.
+
{live-media-encryption|encryption}=**TYPE**::
live-initramfs will mount the encrypted rootfs TYPE, asking the passphrase,
diff --git a/scripts/live b/scripts/live
index 5d5b978..d7c2347 100755
--- a/scripts/live
+++ b/scripts/live
@@ -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)")