From 71a5d9138388d0c82e56f282573d620dbf54badc Mon Sep 17 00:00:00 2001 From: Dave Russell <39733752+007revad@users.noreply.github.com> Date: Sun, 14 Dec 2025 06:16:27 +1100 Subject: [PATCH 1/2] Update script to v3.6.114 v3.6.114 - Added syno_hdd_shutdown.sh to the auto update code. - Now if script is located on an NVMe volume it warns you and exits. Previously it just warned you and continued. - Bug fix for DSM 7.3 not disabling compatible drive database auto update. --- syno_hdd_db.sh | 173 ++++++++++++++++++++++++++++++++++++------------- 1 file changed, 128 insertions(+), 45 deletions(-) diff --git a/syno_hdd_db.sh b/syno_hdd_db.sh index edff033..dc7f7c2 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.113" +scriptver="v3.6.114" script=Synology_HDD_db repo="007revad/Synology_HDD_db" scriptname=syno_hdd_db @@ -257,6 +257,11 @@ if [[ $dsm -gt "6" ]]; then version="_v$dsm" fi +# Get DSM major and minor version +major=$(/usr/syno/bin/synogetkeyvalue /etc.defaults/VERSION majorversion) +minor=$(/usr/syno/bin/synogetkeyvalue /etc.defaults/VERSION minorversion) +dsmversion="$major$minor" + # Get Synology model model=$(cat /proc/sys/kernel/syno_hw_version) modelname="$model" @@ -301,7 +306,25 @@ fi # Get StorageManager version storagemgrver=$(/usr/syno/bin/synopkg version StorageManager) # Show StorageManager version -if [[ $storagemgrver ]]; then echo -e "StorageManager $storagemgrver\n"; fi +if [[ $storagemgrver ]]; then echo -e "StorageManager $storagemgrver"; fi + +# Get SynoOnlinePack version +if [[ $dsmversion -gt "72" ]]; then + # Is DSM 7.3 or later + if [[ -f /var/packages/SynoOnlinePack_v3/INFO ]]; then + SOPinfo="/var/packages/SynoOnlinePack_v3/INFO" + v2="_v3" + elif [[ -f /var/packages/SynoOnlinePack_v2/INFO ]]; then + SOPinfo="/var/packages/SynoOnlinePack_v2/INFO" + v2="_v2" + else + SOPinfo="/var/packages/SynoOnlinePack/INFO" + fi + SOPpkgver="$(/usr/syno/bin/synogetkeyvalue $SOPinfo version)" + echo -e "SynoOnlinePack$v2 version $SOPpkgver\n" +else + echo "" +fi # Show host drive db version if [[ -f "/var/lib/disk-compatibility/${model}_host_v7.version" ]]; then @@ -410,7 +433,9 @@ get_script_vol() { get_script_vol # sets $vol_name to /dev/whatever if grep -qE "^${vol_name#/dev/} .+ nvme" /proc/mdstat then + ding echo -e "\n${Yellow}WARNING${Off} Don't store this script on an NVMe volume!" + exit 3 fi @@ -502,6 +527,15 @@ if ! printf "%s\n%s\n" "$tag" "$scriptver" | syslog_set warn "$script failed to copy $tag to script location" fi + # Copy new script companion sh file to script location + if ! cp -p "/tmp/$script-$shorttag/syno_hdd_shutdown.sh" "${scriptpath}/syno_hdd_shutdown.sh"; + then + copyerr=1 + echo -e "${Error}ERROR${Off} Failed to copy"\ + "$script-$shorttag sh file(s) to:\n $scriptpath/syno_hdd_shutdown.sh" + syslog_set warn "$script failed to copy syno_hdd_shutdown.sh to script location" + fi + # Copy new syno_hdd_vendor_ids.txt file vidstxt="syno_hdd_vendor_ids.txt" if [[ $scriptpath =~ /volume* ]]; then @@ -2278,60 +2312,109 @@ if ls /dev | grep -q "nv[cm]"; then fi -# Edit synoinfo.conf to prevent drive db updates -dtu=drive_db_test_url -url="$(/usr/syno/bin/synogetkeyvalue $synoinfo ${dtu})" -disabled="" -if [[ $nodbupdate == "yes" ]]; then - if [[ ! $url ]]; then - # Add drive_db_test_url="127.0.0.1" - #echo 'drive_db_test_url="127.0.0.1"' >> "$synoinfo" - /usr/syno/bin/synosetkeyvalue "$synoinfo" "$dtu" "127.0.0.1" - # Junior boot - #[ -d /tmpRoot ] && /tmpRoot/usr/syno/bin/synosetkeyvalue /tmpRoot/etc.defaults/synoinfo.conf "$dtu" "127.0.0.1" - if [ -f /tmpRoot/usr/syno/bin/synosetkeyvalue ] && [ -f /tmpRoot/etc.defaults/synoinfo.conf ]; then - /tmpRoot/usr/syno/bin/synosetkeyvalue /tmpRoot/etc.defaults/synoinfo.conf "$dtu" "127.0.0.1" - fi - disabled="yes" - elif [[ $url != "127.0.0.1" ]]; then - # Edit drive_db_test_url= - /usr/syno/bin/synosetkeyvalue "$synoinfo" "$dtu" "127.0.0.1" - # Junior boot - #[ -d /tmpRoot ] && /tmpRoot/usr/syno/bin/synosetkeyvalue /tmpRoot/etc.defaults/synoinfo.conf "$dtu" "127.0.0.1" - if [ -f /tmpRoot/usr/syno/bin/synosetkeyvalue ] && [ -f /tmpRoot/etc.defaults/synoinfo.conf ]; then - /tmpRoot/usr/syno/bin/synosetkeyvalue /tmpRoot/etc.defaults/synoinfo.conf "$dtu" "127.0.0.1" +# Prevent drive db updates +if [[ $dsmversion -lt "73" ]]; then + # Edit synoinfo.conf to prevent drive db updates + dtu=drive_db_test_url + url="$(/usr/syno/bin/synogetkeyvalue $synoinfo ${dtu})" + disabled="" + if [[ $nodbupdate == "yes" ]]; then + if [[ ! $url ]]; then + # Add drive_db_test_url="127.0.0.1" + #echo 'drive_db_test_url="127.0.0.1"' >> "$synoinfo" + /usr/syno/bin/synosetkeyvalue "$synoinfo" "$dtu" "127.0.0.1" + # Junior boot + #[ -d /tmpRoot ] && /tmpRoot/usr/syno/bin/synosetkeyvalue /tmpRoot/etc.defaults/synoinfo.conf "$dtu" "127.0.0.1" + if [ -f /tmpRoot/usr/syno/bin/synosetkeyvalue ] && [ -f /tmpRoot/etc.defaults/synoinfo.conf ]; then + /tmpRoot/usr/syno/bin/synosetkeyvalue /tmpRoot/etc.defaults/synoinfo.conf "$dtu" "127.0.0.1" + fi + disabled="yes" + elif [[ $url != "127.0.0.1" ]]; then + # Edit drive_db_test_url= + /usr/syno/bin/synosetkeyvalue "$synoinfo" "$dtu" "127.0.0.1" + # Junior boot + #[ -d /tmpRoot ] && /tmpRoot/usr/syno/bin/synosetkeyvalue /tmpRoot/etc.defaults/synoinfo.conf "$dtu" "127.0.0.1" + if [ -f /tmpRoot/usr/syno/bin/synosetkeyvalue ] && [ -f /tmpRoot/etc.defaults/synoinfo.conf ]; then + /tmpRoot/usr/syno/bin/synosetkeyvalue /tmpRoot/etc.defaults/synoinfo.conf "$dtu" "127.0.0.1" + fi + disabled="yes" fi - disabled="yes" - fi - # Check if we disabled drive db auto updates - url="$(/usr/syno/bin/synogetkeyvalue $synoinfo drive_db_test_url)" - if [[ $disabled == "yes" ]]; then - if [[ $url == "127.0.0.1" ]]; then - echo -e "\nDisabled drive db auto updates." + # Check if we disabled drive db auto updates + url="$(/usr/syno/bin/synogetkeyvalue $synoinfo drive_db_test_url)" + if [[ $disabled == "yes" ]]; then + if [[ $url == "127.0.0.1" ]]; then + echo -e "\nDisabled drive db auto updates." + else + echo -e "\n${Error}ERROR${Off} Failed to disable drive db auto updates!" + fi else - echo -e "\n${Error}ERROR${Off} Failed to disable drive db auto updates!" + echo -e "\nDrive db auto updates already disabled." fi else - echo -e "\nDrive db auto updates already disabled." + # Re-enable drive db updates + #if [[ $url == "127.0.0.1" ]]; then + if [[ $url ]]; then + # Delete "drive_db_test_url=127.0.0.1" line (inc. line break) + sed -i "/drive_db_test_url=*/d" "$synoinfo" + sed -i "/drive_db_test_url=*/d" /etc/synoinfo.conf + + # Check if we re-enabled drive db auto updates + url="$(/usr/syno/bin/synogetkeyvalue $synoinfo drive_db_test_url)" + if [[ $url != "127.0.0.1" ]]; then + echo -e "\nRe-enabled drive db auto updates." + else + echo -e "\n${Error}ERROR${Off} Failed to enable drive db auto updates!" + fi + else + echo -e "\nDrive db auto updates already enabled." + fi fi else - # Re-enable drive db updates - #if [[ $url == "127.0.0.1" ]]; then - if [[ $url ]]; then - # Delete "drive_db_test_url=127.0.0.1" line (inc. line break) - sed -i "/drive_db_test_url=*/d" "$synoinfo" - sed -i "/drive_db_test_url=*/d" /etc/synoinfo.conf + # Is DSM 7.3 or later + if [[ -f /var/packages/SynoOnlinePack_v3/INFO ]]; then + SOPinfo="/var/packages/SynoOnlinePack_v3/INFO" + elif [[ -f /var/packages/SynoOnlinePack_v2/INFO ]]; then + SOPinfo="/var/packages/SynoOnlinePack_v2/INFO" + else + SOPinfo="/var/packages/SynoOnlinePack/INFO" + fi + SOPpkgver="$(/usr/syno/bin/synogetkeyvalue $SOPinfo version)" - # Check if we re-enabled drive db auto updates - url="$(/usr/syno/bin/synogetkeyvalue $synoinfo drive_db_test_url)" - if [[ $url != "127.0.0.1" ]]; then - echo -e "\nRe-enabled drive db auto updates." + if [[ $nodbupdate == "yes" ]]; then + if [[ ${SOPpkgver:0:4} != "9999" ]]; then + # Prepend version with 9999 + /usr/syno/bin/synosetkeyvalue "$SOPinfo" version "9999$SOPpkgver" + disabled="yes" + fi + + # Check if we disabled drive db auto updates + SOPpkgver2="$(/usr/syno/bin/synogetkeyvalue $SOPinfo version)" + if [[ $disabled == "yes" ]]; then + if [[ $SOPpkgver2 -gt "$SOPpkgver" ]]; then + echo -e "\nDisabled drive db auto updates." + else + echo -e "\n${Error}ERROR${Off} Failed to disable drive db auto updates!" + fi else - echo -e "\n${Error}ERROR${Off} Failed to enable drive db auto updates!" + echo -e "\nDrive db auto updates already disabled." fi else - echo -e "\nDrive db auto updates already enabled." + # Re-enable drive db updates + if [[ ${SOPpkgver:0:4} == "9999" ]]; then + # Remove 9999 from version + /usr/syno/bin/synosetkeyvalue "$SOPinfo" version "${SOPpkgver:4}" + + # Check if we re-enabled drive db auto updates + SOPpkgver2="$(/usr/syno/bin/synogetkeyvalue $SOPinfo version)" + if [[ ${SOPpkgver2:0:4} != "9999" ]]; then + echo -e "\nRe-enabled drive db auto updates." + else + echo -e "\n${Error}ERROR${Off} Failed to enable drive db auto updates!" + fi + else + echo -e "\nDrive db auto updates already enabled." + fi fi fi From 437211520b8a283451c320cd800c9e7b30370450 Mon Sep 17 00:00:00 2001 From: Dave Russell <39733752+007revad@users.noreply.github.com> Date: Sun, 14 Dec 2025 06:17:52 +1100 Subject: [PATCH 2/2] Update CHANGES.txt for version 3.6.114 --- CHANGES.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index e954a6b..61604be 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,8 @@ +v3.6.114 +- Added syno_hdd_shutdown.sh to the auto update code. +- Now if script is located on an NVMe volume it warns you and exits. Previously it just warned you and continued. +- Bug fix for DSM 7.3 not disabling compatible drive database auto update. + v3.6.113 - Added check that DSM 7.3 db file was successfully compacted. - Added drive's firmware version to messages.