- # If this is a removable (e.g., USB flash) device, then try to
- # look for an ISO image on each of its partitions.
- if [ "$(cat /sys/block/$device/removable)" = "1" ] ; then
- partitions=$(/bin/awk "\$4 ~ /${device}[0-9]*/ { print \$4 }" /proc/partitions)
- for partition in $partitions ; do
- echo "pl_sysinit: checking $partition for iso image"
- mkdir -p /tmp/$partition
- if /bin/mount -o ro -t msdos,ext2 /dev/$partition /tmp/$partition 2>&1 > /dev/null ; then
+ for device in /sys/block/*; do
+ device=$(/bin/basename $device)
+
+ # skipping any devices that start with md or ra (ram) or lo
+ # (loop) or fd (floppy)
+
+ start_device=${device:0:2}
+ if [ "$start_device" == "ra" ] || [ "$start_device" == "md" ] ||
+ [ "$start_device" == "lo" ] || [ "$start_device" == "fd" ]; then
+ continue
+ fi
+
+ # If this is a removable (e.g., USB flash) device, then try to
+ # look for an ISO image on each of its partitions.
+ if [ "$(cat /sys/block/$device/removable)" = "1" ] ; then
+ partitions=$(/bin/awk "\$4 ~ /${device}[0-9]*/ { print \$4 }" /proc/partitions)
+ for partition in $partitions ; do
+ echo "pl_sysinit: checking $partition for iso image"
+ mkdir -p /tmp/$partition
+ if /bin/mount -o ro -t msdos,ext2 /dev/$partition /tmp/$partition 2>&1 > /dev/null ; then