diff --git a/CHANGES.txt b/CHANGES.txt index 52ac6e6..1e735bc 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,7 @@ +v2.2.43 +- Fixed DSM 6 bug where the drives were being duplicated in the .db files each time the script was run. +- Fixed DSM 6 bug where the .db files were being duplicated as .dbr each time the db files were edited. + v2.2.42 - Fixed bug where expansion units ending in RP or II were not detected. - Added a --restore option to undo all changes made by the script. diff --git a/README.md b/README.md index e2b38fd..426e00a 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,7 @@ ### Options when running the script * If you run the script without --force or -f it will re-eanble "support_disk_compatibility". * --ram or -r to disable "support_memory_compatibility". * If you run the script without --ram or -r it will re-eanble "support_memory_compatibility". +* --restore to undo all the changes the script has made.

@@ -88,5 +89,6 @@ ### Running the script via SSH **Donators** -- A big thank you to Gummibando on reddit for their donation. +- Thank you to Gummibando on reddit for their donation. +- Thank you to the onimous donors. diff --git a/syno_hdd_db.sh b/syno_hdd_db.sh index cf0b986..d903538 100644 --- a/syno_hdd_db.sh +++ b/syno_hdd_db.sh @@ -30,6 +30,10 @@ # It's also parsed and checked and probably in some cases it could be more critical to patch that one instead. # DONE +# Fixed DSM 6 bug where the drives were being duplicated in the .db files each time the script was run. +# +# Fixed DSM 6 bug where the .db files were being duplicated as .dbr each time the db files were edited. +# # Fixed bug where expansion units ending in RP or II were not detected. # # Added a --restore option to undo all changes. @@ -138,7 +142,7 @@ # Optionally disable "support_disk_compatibility". -scriptver="v2.2.42" +scriptver="v2.2.43" script=Synology_HDD_db repo="007revad/Synology_HDD_db" @@ -838,14 +842,13 @@ updatedb() { #echo hdmodel "$hdmodel" >&2 # debug #echo fwrev "$fwrev" >&2 # debug - if grep "$hdmodel"'":{"'"$fwrev" "$2" >/dev/null; then - echo -e "${Yellow}$hdmodel${Off} already exists in ${Cyan}$(basename -- "$2")${Off}" >&2 - else - # Check if db file is new or old style - getdbtype "$2" + # Check if db file is new or old style + getdbtype "$2" - if [[ $dbtype -gt "6" ]]; then - # Don't need to add firmware version? + if [[ $dbtype -gt "6" ]]; then + if grep "$hdmodel"'":{"'"$fwrev" "$2" >/dev/null; then + echo -e "${Yellow}$hdmodel${Off} already exists in ${Cyan}$(basename -- "$2")${Off}" >&2 + else fwstrng=\"$fwrev\" fwstrng="$fwstrng":{\"compatibility_interval\":[{\"compatibility\":\"support\",\"not_yet_rolling_status\" fwstrng="$fwstrng":\"support\",\"fw_dsm_update_status_notify\":false,\"barebone_installable\":true}]}, @@ -869,8 +872,11 @@ updatedb() { #echo "Append drive and firmware:" # debug editdb7 "append" "$2" fi - - elif [[ $dbtype -eq "6" ]]; then + fi + elif [[ $dbtype -eq "6" ]]; then + if grep "$hdmodel" "$2" >/dev/null; then + echo -e "${Yellow}$hdmodel${Off} already exists in ${Cyan}$(basename -- "$2")${Off}" >&2 + else # example: # {"model":"WD60EFRX-68MYMN1","firmware":"82.00A82","rec_intvl":[1]}, # Don't need to add firmware version? @@ -880,7 +886,7 @@ updatedb() { startstring="{\"success\":1,\"list\":\[" # example: # {"success":1,"list":[{"model":"WD60EFRX-68MYMN1","firmware":"82.00A82","rec_intvl":[1]}, - if sed -ir "s/$startstring/$startstring$string/" "$2"; then + if sed -i "s/$startstring/$startstring$string/" "$2"; then echo -e "Added ${Yellow}$hdmodel${Off} to ${Cyan}$(basename -- "$2")${Off}" else echo -e "\n${Error}ERROR 8${Off} Failed to update $(basename -- "$2")${Off}" >&2 @@ -890,6 +896,7 @@ updatedb() { fi } + # HDDs and SATA SSDs num="0" while [[ $num -lt "${#hdds[@]}" ]]; do @@ -1100,7 +1107,7 @@ else #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" "/etc.defaults/synoinfo.conf" + sed -i "/drive_db_test_url=*/d" "$synoinfo" # Check if we re-enabled drive db auto updates url="$(get_key_value $synoinfo drive_db_test_url)"