Browse Source

Merge pull request #67 from 007revad/develop

Develop
pull/91/head v2.2.44
Dave Russell 3 years ago
committed by GitHub
parent
commit
e1ba991a13
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      CHANGES.txt
  2. 2
      README.md
  3. BIN
      images/syno_hdd_db_help2.png
  4. 41
      syno_hdd_db.sh

5
CHANGES.txt

@ -1,3 +1,8 @@
v2.2.44
- Added --restore info to --help
- Updated restore option to download the latest db files from Synology
- Now warns you if you try to run it in sh with "sh scriptname.sh"
v2.2.43 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 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 DSM 6 bug where the .db files were being duplicated as .dbr each time the db files were edited.

2
README.md

@ -51,7 +51,7 @@ ### Options when running the script
* 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. * --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_help2.png"></p>
### Scheduling the script in Synology's Task Scheduler ### Scheduling the script in Synology's Task Scheduler

BIN
images/syno_hdd_db_help2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

41
syno_hdd_db.sh

@ -30,6 +30,13 @@
# 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
# Added --restore info to --help
#
# Updated restore option to download the latest db files from Synology
#
# Now warns you if you try to run it in sh with "sh scriptname.sh"
#
#
# 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 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 DSM 6 bug where the .db files were being duplicated as .dbr each time the db files were edited.
@ -142,10 +149,16 @@
# Optionally disable "support_disk_compatibility". # Optionally disable "support_disk_compatibility".
scriptver="v2.2.43" scriptver="v2.2.44"
script=Synology_HDD_db script=Synology_HDD_db
repo="007revad/Synology_HDD_db" repo="007revad/Synology_HDD_db"
# Check BASH variable is is non-empty and posix mode is off, else abort with error.
[ "$BASH" ] && ! shopt -qo posix || {
printf >&2 "This is a bash script, don't run it with sh\n"
exit 1
}
#echo -e "bash version: $(bash --version | head -1 | cut -d' ' -f4)\n" # debug #echo -e "bash version: $(bash --version | head -1 | cut -d' ' -f4)\n" # debug
# Shell Colors # Shell Colors
@ -173,6 +186,7 @@ Options:
-m, --m2 Don't process M.2 drives -m, --m2 Don't process M.2 drives
-f, --force Force DSM to not check drive compatibility -f, --force Force DSM to not check drive compatibility
-r, --ram Disable memory compatibility checking -r, --ram Disable memory compatibility checking
--restore Undo all changes made by the script
-h, --help Show this help message -h, --help Show this help message
-v, --version Show the script version -v, --version Show the script version
@ -442,6 +456,16 @@ if [[ $restore == "yes" ]]; then
if [[ ${#dbbakfiles[@]} -gt "0" ]] || [[ -f ${synoinfo}.bak ]]; then if [[ ${#dbbakfiles[@]} -gt "0" ]] || [[ -f ${synoinfo}.bak ]]; then
# Restore synoinfo.conf from backup
if [[ -f ${synoinfo}.bak ]]; then
if mv "${synoinfo}.bak" "${synoinfo}"; then
echo "Restored $(basename -- "$synoinfo")"
else
restoreerr=1
echo -e "${Error}ERROR${Off} Failed to restore synoinfo.conf!\n"
fi
fi
# Restore .db files from backups # Restore .db files from backups
for f in "${!dbbakfiles[@]}"; do for f in "${!dbbakfiles[@]}"; do
deleteme="${dbbakfiles[f]%.bak}" # Remove .bak deleteme="${dbbakfiles[f]%.bak}" # Remove .bak
@ -453,15 +477,12 @@ if [[ $restore == "yes" ]]; then
fi fi
done done
# Restore synoinfo.conf from backup # Delete any .dbr and .db.newr files left by previous script versions
if [[ -f ${synoinfo}.bak ]]; then for f in "${dbpath}"*dbr; do rm "$f"; done
if mv "${synoinfo}.bak" "${synoinfo}"; then for f in "${dbpath}"*db.newr; do rm "$f"; done
echo "Restored $(basename -- "$synoinfo")"
else # Update .db files from Synology
restoreerr=1 syno_disk_db_update --update
echo -e "${Error}ERROR${Off} Failed to restore synoinfo.conf!\n"
fi
fi
if [[ -z $restoreerr ]]; then if [[ -z $restoreerr ]]; then
echo -e "\nRestore successful." echo -e "\nRestore successful."

Loading…
Cancel
Save