From b095f29ed77dbb61635c5f42534a26b922eccdf8 Mon Sep 17 00:00:00 2001 From: Dave Russell <39733752+007revad@users.noreply.github.com> Date: Fri, 13 Feb 2026 09:20:50 +1100 Subject: [PATCH] Update script version and enhance whitespace handling Updated script version and improved whitespace trimming for drive model and firmware revision. --- syno_hdd_db.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/syno_hdd_db.sh b/syno_hdd_db.sh index 2bad69d..af48343 100644 --- a/syno_hdd_db.sh +++ b/syno_hdd_db.sh @@ -29,7 +29,7 @@ # /var/packages/StorageManager/target/ui/storage_panel.js -scriptver="v3.6.121" +scriptver="v3.6.122" script=Synology_HDD_db repo="007revad/Synology_HDD_db" scriptname=syno_hdd_db @@ -1026,7 +1026,8 @@ getdriveinfo(){ # Get drive model hdmodel=$(cat "$1/device/model") - hdmodel=$(printf "%s" "$hdmodel" | xargs) # trim leading and trailing white space + #hdmodel=$(printf "%s" "$hdmodel" | xargs) # trim leading and trailing white space (also replaces multiple spaces in model with 1 space) + hdmodel="$(printf "%s" "$hdmodel" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')" # trim leading and trailing white space # Fix dodgy model numbers fixdrivemodel "$hdmodel" @@ -1066,13 +1067,15 @@ getdriveinfo(){ getm2info(){ # $1 is /sys/block/nvme0n1 etc nvmemodel=$(cat "$1/device/model") - nvmemodel=$(printf "%s" "$nvmemodel" | xargs) # trim leading and trailing white space + #nvmemodel=$(printf "%s" "$nvmemodel" | xargs) # trim leading and trailing white space (also replaces multiple spaces in model with 1 space) + nvmemodel="$(printf "%s" "$nvmemodel" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')" # trim leading and trailing white space if [[ $2 == "nvme" ]]; then nvmefw=$(cat "$1/device/firmware_rev") elif [[ $2 == "nvc" ]]; then nvmefw=$(cat "$1/device/rev") fi - nvmefw=$(printf "%s" "$nvmefw" | xargs) # trim leading and trailing white space + #nvmefw=$(printf "%s" "$nvmefw" | xargs) # trim leading and trailing white space (also replaces multiple spaces in model with 1 space) + nvmefw="$(printf "%s" "$nvmefw" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')" # trim leading and trailing white space # Get drive GB size size_gb=$(get_size_gb "$1")