forked from daverobertson63/RoboticsChallenge
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdo_restore.sh
executable file
·45 lines (39 loc) · 974 Bytes
/
do_restore.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/sh
if [ -z `which zenity` ]; then
# Zenity is not installed - use text mode
cat <<__EOF__
About to restore entire laptop from master image (hosted online)
This will remove any data on this machine.
__EOF__
read -r -p "${1:-Are you sure? [y/N]} " response
case $response in
[yY])
;;
*)
exit
;;
esac
else
# Prompt graphically
zenity --question 2>/dev/null
if [ "$?" -ge "1" ]; then
exit
fi
fi
sudo RSYNC_PASSWORD=roboteer325 \
rsync -avxPz --delete \
--exclude=lost+found/ \
[email protected]::restore_master1_boot/ \
/boot/ && \
sudo RSYNC_PASSWORD=roboteer325 \
rsync -avxPz --delete \
--exclude=lost+found/ \
[email protected]::restore_master1_/ \
/
retval=$?
if [ $retval -eq 0 ]; then
read -p "Successfully restored. Press ENTER to reboot" REPLY
sudo shutdown -r now
else
read -p "Failed to restore due to one or more errors. Press ENTER to close, then please try again" REPLY
fi