-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathoctoprint_deploy.sh
executable file
·58 lines (48 loc) · 1.05 KB
/
octoprint_deploy.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
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
#all operations must be with root/sudo
if (( $EUID != 0 )); then
echo "Please run with sudo"
exit
fi
#this is a weak check, but will catch most cases
if [ $SUDO_USER ]; then
user=$SUDO_USER
else
echo "You should not run this script as root. Use sudo as a normal user"
exit
fi
if [ "$user" == root ]; then
echo "You should not run this script as root. Use sudo as a normal user"
exit
fi
# initiate logging
logfile='octoprint_deploy.log'
SCRIPTDIR=$(dirname $(readlink -f $0))
source $SCRIPTDIR/plugins.sh
source $SCRIPTDIR/prepare.sh
source $SCRIPTDIR/instance.sh
source $SCRIPTDIR/util.sh
source $SCRIPTDIR/menu.sh
source $SCRIPTDIR/cameras.sh
get_settings
#command line arguments
if [ "$1" == remove ]; then
remove_everything
fi
if [ "$1" == restart_all ]; then
restart_all
fi
if [ "$1" == backup ]; then
back_up_all
fi
if [ "$1" == picam ]; then
add_camera true
fi
if [ "$1" == noserial ]; then
NOSERIAL=1
fi
#let's make it possibly to inject any function directly
if [ "$1" == f ]; then
$2
fi
main_menu