From e0749b5443b6b0061e1c259e505d2bc65767adc7 Mon Sep 17 00:00:00 2001 From: 007revad <39733752+007revad@users.noreply.github.com> Date: Mon, 20 Mar 2023 01:46:47 +1100 Subject: [PATCH] Update syno_hdd_db.sh --- syno_hdd_db.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/syno_hdd_db.sh b/syno_hdd_db.sh index 113fef8..fefdeb7 100644 --- a/syno_hdd_db.sh +++ b/syno_hdd_db.sh @@ -186,8 +186,20 @@ if [[ $dsm -gt "6" ]]; then fi # Get Synology model -model=$(find /var/lib/disk-compatibility -regextype egrep -regex ".*host(_v7)?\.db$" |\ - cut -d"/" -f5 | cut -d"_" -f1 | uniq) + +# This doesn't work for drives migrated from different model +#model=$(find /var/lib/disk-compatibility -regextype egrep -regex ".*host(_v7)?\.db$" |\ +# cut -d"/" -f5 | cut -d"_" -f1 | uniq) + +model=$(cat /proc/sys/kernel/syno_hw_version) +model=${model,,} # convert to lower case + +# Check for dodgy characters after model number +if [[ $model =~ 'pv10-j'$ ]]; then # GitHub issue #10 + model=${model%??????}+ # replace last 6 chars with + +elif [[ $model =~ '-j'$ ]]; then # GitHub issue #2 + model=${model%??} # remove last 2 chars +fi #------------------------------------------------------------------------------