Skip to content

Commit

Permalink
Another check to prevent USB HDD to show in USB List.
Browse files Browse the repository at this point in the history
  • Loading branch information
HassanMirza01 committed Aug 3, 2018
1 parent bd9338f commit 11803a7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion bootiso
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 $?
Expand Down

0 comments on commit 11803a7

Please sign in to comment.