From 11803a7d45e17594c12c4e300c038a25534cadb4 Mon Sep 17 00:00:00 2001 From: HassanMirza01 Date: Fri, 3 Aug 2018 22:09:39 +0500 Subject: [PATCH] Another check to prevent USB HDD to show in USB List. --- bootiso | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bootiso b/bootiso index db60091..a0eedfd 100755 --- a/bootiso +++ b/bootiso @@ -510,7 +510,7 @@ initDevicesList() { mapfile -t devices < <(lsblk -o NAME,TYPE | grep --color=never -oP '^\K\w+(?=\s+disk$)') devicesList=() for device in "${devices[@]}"; do - if [ "$(getDeviceType "/dev/$device")" == "usb" ] || [ "$disableUSBCheck" == 'true' ]; then + if [ "$(getDeviceType "/dev/$device")" == "usb" ] && [ "$(getDeviceTypewithExHDD "/dev/$device")" == "ID_DRIVE_THUMB=1" ] || [ "$disableUSBCheck" == 'true' ]; then devicesList+=("$device") fi done @@ -739,6 +739,12 @@ getDeviceType() { echo "$deviceType" } +getDeviceTypewithExHDD() { + typeset deviceName=/sys/block/${1#/dev/} + typeset getDeviceTypewithExHDD=$(udevadm info --query=property --path="$deviceName" | grep -o 'ID_DRIVE_THUMB=1') + echo "$getDeviceTypewithExHDD" +} + deviceIsDisk() { lsblk --nodeps -o NAME,TYPE "$1" | grep -q disk return $?