Browse Source

Update syno_hdd_db.sh

v3.5.94
- Updated to support newer drive db versions.
  - Synology added size_gb in host v7 version 8051.
  - Synology added barebone_installable_v2 in host v7 version 8054.

Note: You may need to run syno_hdd_db without the -n or --noupdate option, then update the drive database from
"Storage Manager > HDD/SSD > Settings > Advanced > Update Now" then run syno_hdd_db with your preferred options.
pull/321/head v3.5.94-RC
Dave Russell 1 year ago
committed by GitHub
parent
commit
e52b20e3d9
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 48
      syno_hdd_db.sh

48
syno_hdd_db.sh

@ -812,6 +812,15 @@ fixdrivemodel(){
fi fi
} }
get_size_gb(){
# $1 is /sys/block/sata1 or /sys/block/nvme0n1 etc
local float
local int
float=$(synodisk --info /dev/"$(basename -- "$1")" | grep 'Total capacity' | awk '{print $4 * 1.0737}')
int="${float%.*}"
echo "$int"
}
getdriveinfo(){ getdriveinfo(){
# $1 is /sys/block/sata1 etc # $1 is /sys/block/sata1 etc
@ -841,12 +850,15 @@ getdriveinfo(){
fwrev=$(smartctl -a -d sat -T permissive "$dev" | grep -i firmware | awk '{print $NF}') fwrev=$(smartctl -a -d sat -T permissive "$dev" | grep -i firmware | awk '{print $NF}')
fi fi
# Get drive GB size
size_gb=$(get_size_gb "$1")
if [[ $hdmodel ]] && [[ $fwrev ]]; then if [[ $hdmodel ]] && [[ $fwrev ]]; then
if /usr/syno/bin/synodisk --enum -t cache | grep -q /dev/"$(basename -- "$1")"; then if /usr/syno/bin/synodisk --enum -t cache | grep -q /dev/"$(basename -- "$1")"; then
# Is SATA M.2 SSD # Is SATA M.2 SSD
nvmelist+=("${hdmodel},${fwrev}") nvmelist+=("${hdmodel},${fwrev},${size_gb}")
else else
hdlist+=("${hdmodel},${fwrev}") hdlist+=("${hdmodel},${fwrev},${size_gb}")
fi fi
drivelist+=("${hdmodel}") drivelist+=("${hdmodel}")
fi fi
@ -864,8 +876,11 @@ getm2info(){
fi fi
nvmefw=$(printf "%s" "$nvmefw" | xargs) # trim leading and trailing white space nvmefw=$(printf "%s" "$nvmefw" | xargs) # trim leading and trailing white space
# Get drive GB size
size_gb=$(get_size_gb "$1")
if [[ $nvmemodel ]] && [[ $nvmefw ]]; then if [[ $nvmemodel ]] && [[ $nvmefw ]]; then
nvmelist+=("${nvmemodel},${nvmefw}") nvmelist+=("${nvmemodel},${nvmefw},${size_gb}")
drivelist+=("${nvmemodel}") drivelist+=("${nvmemodel}")
fi fi
} }
@ -1229,6 +1244,7 @@ editdb7(){
updatedb(){ updatedb(){
hdmodel=$(printf "%s" "$1" | cut -d"," -f 1) hdmodel=$(printf "%s" "$1" | cut -d"," -f 1)
fwrev=$(printf "%s" "$1" | cut -d"," -f 2) fwrev=$(printf "%s" "$1" | cut -d"," -f 2)
size_gb=$(printf "%s" "$1" | cut -d"," -f 3)
#echo arg1 "$1" >&2 # debug #echo arg1 "$1" >&2 # debug
#echo arg2 "$2" >&2 # debug #echo arg2 "$2" >&2 # debug
@ -1243,15 +1259,23 @@ updatedb(){
if grep "$hdmodel"'":{"'"$fwrev" "$2" >/dev/null; then if grep "$hdmodel"'":{"'"$fwrev" "$2" >/dev/null; then
echo -e "${Yellow}$hdmodel${Off} already exists in ${Cyan}$(basename -- "$2")${Off}" >&2 echo -e "${Yellow}$hdmodel${Off} already exists in ${Cyan}$(basename -- "$2")${Off}" >&2
else else
fwstrng=\"$fwrev\" common_string="$common_string"\"size_gb\":$size_gb,
fwstrng="$fwstrng":{\"compatibility_interval\":[{\"compatibility\":\"support\",\"not_yet_rolling_status\" common_string="$common_string"\"compatibility_interval\":[{
fwstrng="$fwstrng":\"support\",\"fw_dsm_update_status_notify\":false,\"barebone_installable\":true, common_string="$common_string"\"compatibility\":\"support\",
fwstrng="$fwstrng"\"smart_test_ignore\":false,\"smart_attr_ignore\":false}]}, common_string="$common_string"\"not_yet_rolling_status\":\"support\",
common_string="$common_string"\"fw_dsm_update_status_notify\":false,
default=\"default\" common_string="$common_string"\"barebone_installable\":true,
default="$default":{\"compatibility_interval\":[{\"compatibility\":\"support\",\"not_yet_rolling_status\" common_string="$default"\"barebone_installable_v2\":\"auto\",
default="$default":\"support\",\"fw_dsm_update_status_notify\":false,\"barebone_installable\":true, common_string="$common_string"\"smart_test_ignore\":false,
default="$default"\"smart_test_ignore\":false,\"smart_attr_ignore\":false}]}}} common_string="$common_string"\"smart_attr_ignore\":false
fwstrng=\"$fwrev\":{
fwstrng="$fwstrng$common_string"
fwstrng="$fwstrng"}]},
default=\"default\":{
default="$default$common_string"
default="$default"}]}}}
# Synology misspelt compatibility as compatbility # Synology misspelt compatibility as compatbility
if grep '"disk_compatbility_info":{}' "$2" >/dev/null; then if grep '"disk_compatbility_info":{}' "$2" >/dev/null; then

Loading…
Cancel
Save