summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Baumann <daniel@debian.org>2009-03-12 10:18:44 +0100
committerDaniel Baumann <daniel@debian.org>2011-03-09 17:48:04 +0100
commitb786a1129a4d5014389a603e00cd8ecabf63a10e (patch)
treea47b1d978016540d29c98691f13d1e0112bdd107
parent2f3063da01d44e08b260c451d8c88b6046bcdaaa (diff)
downloadlive-boot-b786a1129a4d5014389a603e00cd8ecabf63a10e.tar.gz
live-boot-b786a1129a4d5014389a603e00cd8ecabf63a10e.zip
Adding removable-usb keyword to further restrict live media selection.
-rw-r--r--manpages/live-initramfs.en.7.txt3
-rwxr-xr-xscripts/live16
2 files changed, 18 insertions, 1 deletions
diff --git a/manpages/live-initramfs.en.7.txt b/manpages/live-initramfs.en.7.txt
index d6a7d21..c43fa5e 100644
--- a/manpages/live-initramfs.en.7.txt
+++ b/manpages/live-initramfs.en.7.txt
@@ -116,7 +116,8 @@ 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.
+if you want to further restrict the media to usb mass storage only, you can use
+the 'removable-usb' keyword.
{live-media-encryption|encryption}=**TYPE**::
diff --git a/scripts/live b/scripts/live
index d7c2347..d125eae 100755
--- a/scripts/live
+++ b/scripts/live
@@ -1418,6 +1418,22 @@ find_livefs ()
done
;;
+ removable-usb)
+ for sysblock in $(echo /sys/block/* | tr ' ' '\n' | grep -vE "/(loop|ram|dm-|fd)")
+ do
+ if [ "$(cat ${sysblock}/removable)" = "1" ] && readlink ${sysblock}/device | grep -q usb
+ then
+ for dev in $(subdevices "${sysblock}")
+ do
+ if check_dev "${dev}"
+ then
+ return 0
+ fi
+ done
+ fi
+ done
+ ;;
+
*)
if [ ! -z "${LIVE_MEDIA}" ]
then