-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·44 lines (39 loc) · 1.16 KB
/
run.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/bash
source ./config_vars
#error if name is still default
if [ "$NAME" == "your printer's name" ]; then
echo "Please set your printer's name in config.sh!"
exit 1
fi
export USERNAME=$(whoami)
export REPONAME=$NAME\_backup
# export BRANCHNAME=$(cd ~/printer_data && git remote show origin | sed -n '/HEAD branch/s/.*: //p')
# --restore, --backup, --remove
# error if both --restore and --backup are passed
# if --remove is passed, don't run initial setup
if [ $# -eq 0 ]; then
echo "please pass --restore, --backup, or --remove"
exit 1
elif [ $# -eq 1 ]; then
if [ $1 == "--remove" ]; then
echo "Removing..."
bash scripts/remove.sh
elif [ $1 == "--restore" ]; then
echo "setting up..."
bash scripts/setup.sh
echo "Restoring..."
bash scripts/initial_restore.sh
elif [ $1 == "--backup" ]; then
echo "setting up..."
bash scripts/setup.sh
echo "Backing up..."
bash scripts/initial_backup.sh
else
echo "Invalid argument. Please pass --restore or --backup, or --remove"
exit 1
fi
else
echo "Please pass only one argument"
exit 1
fi
echo "done"