-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.sh
executable file
·64 lines (57 loc) · 1.04 KB
/
app.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
59
60
61
62
63
64
#!/bin/bash
ARG1=$1
ARG2=$2
set -u ## exit if you try to use an uninitialised variable
set -e ## exit if any statement fails
# Make sure working dir is same as this dir, so that script can be excuted from another working directory
PARENT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
getIpAddress() {
hostname -I | head -n1 | awk '{print $1;}'
}
ip=`getIpAddress`
# import functions
source ./scripts/helpers.sh
source ./scripts/print.sh
if [ -z "$ARG1" ]
then
help
elif [ "$ARG1" == "gitinit" ]
then
gitinit "${ARG2}"
elif [ "$ARG1" == "install" ]
then
install "${ARG2}"
elif [ "$ARG1" == "update" ]
then
update "${ARG2}"
elif [ "$ARG1" == "init" ]
then
stop
reset
startdocker
init
elif [ "$ARG1" == "link" ]
then
link
elif [ "$ARG1" == "start" ]
then
stop
start "${ARG2}"
elif [ "$ARG1" == "test" ]
then
stop
link
test
elif [ "$ARG1" == "stop" ]
then
stop
elif [ "$ARG1" == "reset" ]
then
stop
reset "${ARG2}"
elif [ "$ARG1" == "log" ]
then
log "${ARG2}"
else
help
fi