Skip to content

Commit

Permalink
Adding removable-usb keyword to further restrict live media selection.
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-baumann committed Mar 12, 2009
1 parent e2c01ac commit 3887dbd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
3 changes: 2 additions & 1 deletion manpages/live-initramfs.en.7.txt
Expand Up @@ -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**::

Expand Down
16 changes: 16 additions & 0 deletions scripts/live
Expand Up @@ -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
Expand Down

0 comments on commit 3887dbd

Please sign in to comment.