File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change 11#! /bin/bash
2+ # vim: sw=2
23
34# Usage:
45# ./scripts/restore.sh [FILENAME=backup.tar.gz] {noask}
1415# Will restore from the backup file "./backups/some_other_backup.tar.gz" and will not warn that data will be deleted.
1516#
1617
17- if [ -d " ./menu.sh" ]; then
18- echo " ./menu.sh file was not found. Ensure that you are running this from IOTstack's directory."
19- exit 1
18+ if [[ " $EUID " != 0 ]]; then
19+ # re-run as root in order to be able to restore owners correctly
20+ sudo ${BASH_SOURCE[0]} " $@ "
21+ exit $?
2022fi
2123
24+ # Allow running from everywhere, but change folder to script's IOTstack
25+ cd " $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd) /.."
26+
2227echo " Restoring from a backup will erase all existing data."
2328read -p " Continue [y/N]? " -n 1 -r PROCEED_WITH_RESTORE
2429echo " "
@@ -85,4 +90,6 @@ echo "" >> $LOGFILE
8590echo " ### End of log ###" >> $LOGFILE
8691echo " " >> $LOGFILE
8792
93+ chmod a+r $LOGFILE
94+
8895cat $LOGFILE
You can’t perform that action at this time.
0 commit comments