Browse Source

Merge pull request #66 from 007revad/develop

Develop
pull/91/head v2.2.43
Dave Russell 3 years ago
committed by GitHub
parent
commit
fe48e6cca6
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      CHANGES.txt
  2. 4
      README.md
  3. 31
      syno_hdd_db.sh

4
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 v2.2.42
- Fixed bug where expansion units ending in RP or II were not detected. - 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. - Added a --restore option to undo all changes made by the script.

4
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". * If you run the script without --force or -f it will re-eanble "support_disk_compatibility".
* --ram or -r to disable "support_memory_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". * 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.
<p align="leftr"><img src="images/syno_hdd_db_help.png"></p> <p align="leftr"><img src="images/syno_hdd_db_help.png"></p>
@ -88,5 +89,6 @@ ### Running the script via SSH
**Donators** **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.

31
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. # It's also parsed and checked and probably in some cases it could be more critical to patch that one instead.
# DONE # 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. # Fixed bug where expansion units ending in RP or II were not detected.
# #
# Added a --restore option to undo all changes. # Added a --restore option to undo all changes.
@ -138,7 +142,7 @@
# Optionally disable "support_disk_compatibility". # Optionally disable "support_disk_compatibility".
scriptver="v2.2.42" scriptver="v2.2.43"
script=Synology_HDD_db script=Synology_HDD_db
repo="007revad/Synology_HDD_db" repo="007revad/Synology_HDD_db"
@ -838,14 +842,13 @@ updatedb() {
#echo hdmodel "$hdmodel" >&2 # debug #echo hdmodel "$hdmodel" >&2 # debug
#echo fwrev "$fwrev" >&2 # debug #echo fwrev "$fwrev" >&2 # debug
if grep "$hdmodel"'":{"'"$fwrev" "$2" >/dev/null; then # Check if db file is new or old style
echo -e "${Yellow}$hdmodel${Off} already exists in ${Cyan}$(basename -- "$2")${Off}" >&2 getdbtype "$2"
else
# Check if db file is new or old style
getdbtype "$2"
if [[ $dbtype -gt "6" ]]; then if [[ $dbtype -gt "6" ]]; then
# Don't need to add firmware version? 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=\"$fwrev\"
fwstrng="$fwstrng":{\"compatibility_interval\":[{\"compatibility\":\"support\",\"not_yet_rolling_status\" fwstrng="$fwstrng":{\"compatibility_interval\":[{\"compatibility\":\"support\",\"not_yet_rolling_status\"
fwstrng="$fwstrng":\"support\",\"fw_dsm_update_status_notify\":false,\"barebone_installable\":true}]}, fwstrng="$fwstrng":\"support\",\"fw_dsm_update_status_notify\":false,\"barebone_installable\":true}]},
@ -869,8 +872,11 @@ updatedb() {
#echo "Append drive and firmware:" # debug #echo "Append drive and firmware:" # debug
editdb7 "append" "$2" editdb7 "append" "$2"
fi fi
fi
elif [[ $dbtype -eq "6" ]]; then 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: # example:
# {"model":"WD60EFRX-68MYMN1","firmware":"82.00A82","rec_intvl":[1]}, # {"model":"WD60EFRX-68MYMN1","firmware":"82.00A82","rec_intvl":[1]},
# Don't need to add firmware version? # Don't need to add firmware version?
@ -880,7 +886,7 @@ updatedb() {
startstring="{\"success\":1,\"list\":\[" startstring="{\"success\":1,\"list\":\["
# example: # example:
# {"success":1,"list":[{"model":"WD60EFRX-68MYMN1","firmware":"82.00A82","rec_intvl":[1]}, # {"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}" echo -e "Added ${Yellow}$hdmodel${Off} to ${Cyan}$(basename -- "$2")${Off}"
else else
echo -e "\n${Error}ERROR 8${Off} Failed to update $(basename -- "$2")${Off}" >&2 echo -e "\n${Error}ERROR 8${Off} Failed to update $(basename -- "$2")${Off}" >&2
@ -890,6 +896,7 @@ updatedb() {
fi fi
} }
# HDDs and SATA SSDs # HDDs and SATA SSDs
num="0" num="0"
while [[ $num -lt "${#hdds[@]}" ]]; do while [[ $num -lt "${#hdds[@]}" ]]; do
@ -1100,7 +1107,7 @@ else
#if [[ $url == "127.0.0.1" ]]; then #if [[ $url == "127.0.0.1" ]]; then
if [[ $url ]]; then if [[ $url ]]; then
# Delete "drive_db_test_url=127.0.0.1" line (inc. line break) # 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 # Check if we re-enabled drive db auto updates
url="$(get_key_value $synoinfo drive_db_test_url)" url="$(get_key_value $synoinfo drive_db_test_url)"

Loading…
Cancel
Save