-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathrunChain.sh
executable file
·80 lines (70 loc) · 1.85 KB
/
runChain.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
function runIfImageDoesNotExists {
local IMAGE_NAME=$1
# Check if image does not exists
if [[ "$(docker images -q $IMAGE_NAME 2>/dev/null)" == "" ]]; then
# Run given command
"${@:2}"
fi
}
# Default values of arguments
BUILD_TAG=""
BUILD_TAG_STRING=""
SHOULD_TEST=0
INSTALL_TUTORIAL=0
ADMIN_PASSWORD=""
ADMIN_PASSWORD_STRING=""
# Loop through arguments and process them
# Taken from: https://pretzelhands.com/posts/command-line-flags
for arg in "$@"; do
case $arg in
--tag=*)
BUILD_TAG="${arg#*=}"
shift # Remove
;;
--tag)
BUILD_TAG="$2"
shift # Remove
shift
;;
--test)
SHOULD_TEST=1
shift # Remove --test from processing
;;
--tutorial)
INSTALL_TUTORIAL=1
shift # Remove --tutorial from processing
;;
--admin_password=*)
ADMIN_PASSWORD="${arg#*=}"
shift # Remove
;;
--admin_password)
ADMIN_PASSWORD="$2"
shift # Remove
shift
;;
esac
done
# Check if a build tag was given
if [ -n "$BUILD_TAG" ]; then
BUILD_TAG_STRING="--tag $BUILD_TAG"
fi
# Build google earth enterprise
cd geeBuild && runIfImageDoesNotExists geebuild:v1 bash build.sh $BUILD_TAG_STRING
# Run tests
if [ "$SHOULD_TEST" -eq 1 ]; then
cd ../geeTest && bash run.sh
fi
# Check if a password was given
if [ -n "$ADMIN_PASSWORD" ]; then
ADMIN_PASSWORD_STRING="--admin_password $ADMIN_PASSWORD"
fi
# Install server
cd ../server && runIfImageDoesNotExists geeserver:v1 bash install.sh $ADMIN_PASSWORD_STRING
# Install fusion
cd ../fusion && runIfImageDoesNotExists geefusion:v1 bash install.sh
# Check if should install tutorial files
if [ "$INSTALL_TUTORIAL" -eq 1 ]; then
# Download tutorial files to fusion
cd tutorial && runIfImageDoesNotExists fusiontutorial:v1 bash install.sh
fi