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 1
1
#! /bin/bash
2
+ # vim: sw=2
2
3
3
4
# Usage:
4
5
# ./scripts/restore.sh [FILENAME=backup.tar.gz] {noask}
14
15
# Will restore from the backup file "./backups/some_other_backup.tar.gz" and will not warn that data will be deleted.
15
16
#
16
17
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 $?
20
22
fi
21
23
24
+ # Allow running from everywhere, but change folder to script's IOTstack
25
+ cd " $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd) /.."
26
+
22
27
echo " Restoring from a backup will erase all existing data."
23
28
read -p " Continue [y/N]? " -n 1 -r PROCEED_WITH_RESTORE
24
29
echo " "
@@ -85,4 +90,6 @@ echo "" >> $LOGFILE
85
90
echo " ### End of log ###" >> $LOGFILE
86
91
echo " " >> $LOGFILE
87
92
93
+ chmod a+r $LOGFILE
94
+
88
95
cat $LOGFILE
You can’t perform that action at this time.
0 commit comments