diff --git a/CHANGES.txt b/CHANGES.txt index 1e9857c..e407db9 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,7 @@ +v1.2.4 +- Now shows script version. +- Hard coded /usr/syno/bin/ for Synology commands (to prevent $PATH issues). + v1.2.3 - Check if running as root - Bug fix diff --git a/syno_dsm_reinstall.sh b/syno_dsm_reinstall.sh index bf03abc..4ff5a9d 100644 --- a/syno_dsm_reinstall.sh +++ b/syno_dsm_reinstall.sh @@ -10,29 +10,46 @@ # or as root from task scheduler as a user defined script #------------------------------------------------------------------------------ +scriptver="v1.2.4" +script=Synology_DSM_reinstall +repo="007revad/Synology_DSM_reinstall" +scriptname=syno_reinstall_same_dsm_card + +# Show script version +#echo -e "$script $scriptver\ngithub.com/$repo\n" +echo -e "$script $scriptver \n" + # Check script is running as root if [[ $( whoami ) != "root" ]]; then echo "This script must be run as root or sudo." exit fi +# Check script is running on a Synology NAS +if ! /usr/bin/uname -a | grep -i synology >/dev/null; then + echo "This script is NOT running on a Synology NAS!" + echo "Copy the script to a folder on the Synology" + echo "and run it from there." + exit 1 +fi + # Maybe we should backup the VERSION file here # Prevent DSM auto-updating to "Update #" during reinstall -#if grep '"smart_nano_enabled":true' "/usr/syno/etc/update.conf"; then - sed -i "s/\"smart_nano_enabled\":true/\"smart_nano_enabled\":false/g" "/usr/syno/etc/update.conf" -#fi +##if grep '"smart_nano_enabled":true' "/usr/syno/etc/update.conf"; then +# sed -i "s/\"smart_nano_enabled\":true/\"smart_nano_enabled\":false/g" "/usr/syno/etc/update.conf" +##fi -currentbuild=$(synogetkeyvalue /etc.defaults/VERSION buildnumber) +currentbuild=$(/usr/syno/bin/synogetkeyvalue /etc.defaults/VERSION buildnumber) if [[ -n $currentbuild ]]; then echo "Current buildnumber is: $currentbuild" else echo "Failed to get buildnumber!" && exit 1 fi -currentbase=$(synogetkeyvalue /etc.defaults/VERSION base) +currentbase=$(/usr/syno/bin/synogetkeyvalue /etc.defaults/VERSION base) if [[ -n $currentbase ]]; then echo "Current base is: $currentbase" echo "" @@ -55,16 +72,16 @@ if [[ $newbuild != "$newbase" ]]; then fi -synosetkeyvalue /etc.defaults/VERSION buildnumber "$newbuild" -value=$(synogetkeyvalue /etc.defaults/VERSION buildnumber) +/usr/syno/bin/synosetkeyvalue /etc.defaults/VERSION buildnumber "$newbuild" +value=$(/usr/syno/bin/synogetkeyvalue /etc.defaults/VERSION buildnumber) if [[ $value == "$newbuild" ]]; then echo "Changed buildnumber to: $newbuild" else echo "Failed to edit buildnumber!" && exit 1 fi -synosetkeyvalue /etc.defaults/VERSION base "$newbase" -value=$(synogetkeyvalue /etc.defaults/VERSION base) +/usr/syno/bin/synosetkeyvalue /etc.defaults/VERSION base "$newbase" +value=$(/usr/syno/bin/synogetkeyvalue /etc.defaults/VERSION base) if [[ $value == "$newbase" ]]; then echo "Changed base to: $newbase" else