-
Notifications
You must be signed in to change notification settings - Fork 2
/
backup.sh
executable file
·48 lines (38 loc) · 1.1 KB
/
backup.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
45
46
47
48
#!/usr/bin/env bash
declare -a backup_cmds=(
"brew bundle dump --file=$DOTFILES/Brewfile --force"
# "mackup backup --force"
)
echo "You are about to back up your settings and files."
echo "This will run the following commands:"
for ((i = 0; i < ${#backup_cmds[@]}; i++)); do
printf "\n* ${backup_cmds[$i]}"
done
echo -e "\n\n"
echo "Are you sure? [y/N]"
read CONFIRM
if [ "$CONFIRM" = "y" ]; then
for ((i = 0; i < ${#backup_cmds[@]}; i++)); do
printf "
**** Running: ${backup_cmds[$i]} *****"
# Run each command
RESULT=$( ${backup_cmds[$i]})
### Check if the command gave any output, and echo it if so
if [ -n "$RESULT" ]; then
echo ""
echo "$RESULT"
fi
done
else
echo -e "\nOkay, not gonna do it."
fi
echo -e "\nWant to run bundle-ignored to put all your secret files from this project into secrets.tar.gz? [y/N]"
read CONFIRM_BUNDLE
if [ "$CONFIRM_BUNDLE" = "y" ]; then
echo "Bundling…"
$(./fn/bundle-ignored secrets)
echo "(Ignore the warning about no such file or directory if you see it)"
echo -e "\nFinished!"
else
echo -e "\nOkay, bye!"
fi