@ -30,7 +30,12 @@
# It's also parsed and checked and probably in some cases it could be more critical to patch that one instead.
# DONE
# Prevent running with "sh scriptname.sh".
# 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.
#
@ -181,6 +186,7 @@ Options:
-m, --m2 Don' t process M.2 drives
-f, --force Force DSM to not check drive compatibility
-r, --ram Disable memory compatibility checking
--restore Undo all changes made by the script
-h, --help Show this help message
-v, --version Show the script version
@ -450,6 +456,16 @@ if [[ $restore == "yes" ]]; 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
for f in " ${ !dbbakfiles[@] } " ; do
deleteme = " ${ dbbakfiles [f]%.bak } " # Remove .bak
@ -461,15 +477,8 @@ if [[ $restore == "yes" ]]; then
fi
done
# 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
# Update .db files from Synology
syno_disk_db_update --update
if [ [ -z $restoreerr ] ] ; then
echo -e "\nRestore successful."