From 0cca7b862098190062ee0dc028de849fcdd25ebd Mon Sep 17 00:00:00 2001 From: 007revad <39733752+007revad@users.noreply.github.com> Date: Fri, 17 Mar 2023 22:25:51 +1100 Subject: [PATCH] Update syno_hdd_db.sh - Fixed bug where removable drives were being detected and added to drive database. --- syno_hdd_db.sh | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/syno_hdd_db.sh b/syno_hdd_db.sh index a17b6b2..95686a1 100644 --- a/syno_hdd_db.sh +++ b/syno_hdd_db.sh @@ -47,6 +47,8 @@ # # Changed checking drive_db_test_url setting to be more durable. # +# Fixed bug where removable drives were being detected and added to drive database. +# # # Added check that M.2 volume support is enabled (on supported models). # @@ -263,15 +265,19 @@ fi # Get list of installed SATA, SAS and M.2 NVMe/SATA drives getdriveinfo() { - # Get drive model and firmware version - hdmodel=$(cat "$1/device/model") - hdmodel=$(printf "%s" "$hdmodel" | xargs) # trim leading and trailing white space - - fwrev=$(cat "$1/device/rev") - fwrev=$(printf "%s" "$fwrev" | xargs) # trim leading and trailing white space - - if [[ $hdmodel ]] && [[ $fwrev ]]; then - hdlist+=("${hdmodel},${fwrev}") + # Skip removable drives (USB drives) + removable=$(cat "$1/removable") + if [[ $removable == "0" ]]; then + # Get drive model and firmware version + hdmodel=$(cat "$1/device/model") + hdmodel=$(printf "%s" "$hdmodel" | xargs) # trim leading and trailing white space + + fwrev=$(cat "$1/device/rev") + fwrev=$(printf "%s" "$fwrev" | xargs) # trim leading and trailing white space + + if [[ $hdmodel ]] && [[ $fwrev ]]; then + hdlist+=("${hdmodel},${fwrev}") + fi fi }