forked from awslabs/aws-saas-boost
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·98 lines (80 loc) · 2.31 KB
/
install.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/usr/bin/env bash
# * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# *
# * Licensed under the Apache License, Version 2.0 (the "License").
# * You may not use this file except in compliance with the License.
# * You may obtain a copy of the License at
# *
# * http://www.apache.org/licenses/LICENSE-2.0
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
echo "Start SaaS Boost Installation"
CURRENT_DIR=$(pwd)
# Check for installer dir
if [ ! -d "${CURRENT_DIR}/installer" ];
then
echo "Directory ${CURRENT_DIR}/installer not found"
exit 2
fi
# Check for client/web dir
if [ ! -d "${CURRENT_DIR}/client/web" ];
then
echo "Directory ${CURRENT_DIR}/client/web not found"
exit 2
fi
# check for java
if ! command -v java >/dev/null 2>&1;
then
echo "java version 11 or higher must be installed"
exit 2
fi
# check for maven
if ! command -v mvn >/dev/null 2>&1;
then
echo "maven must be installed"
exit 2
fi
# check for yarn
if ! command -v yarn >/dev/null 2>&1;
then
echo "yarn must be installed"
exit 2
fi
# check for yarn
if ! command -v node >/dev/null 2>&1;
then
echo "node must be installed"
exit 2
fi
if [ -z $AWS_DEFAULT_REGION ]; then
export AWS_REGION=$(aws configure list | grep region | awk '{print $2}')
if [ "X$AWS_REGION" = "X" ]; then
echo "AWS_REGION not set, check your aws profile or set AWS_DEFAULT_REGION"
exit 2
fi
else
export AWS_REGION=$AWS_DEFAULT_REGION
fi
echo "AWS Region = $AWS_REGION"
cd ${CURRENT_DIR}/installer
echo "Build installler jar with maven"
if ! mvn > /dev/null 2>&1 ;
then
echo "Error with build of Java installer for SaaS Boost"
exit 2
fi
cd ${CURRENT_DIR}/client/web
echo "Download dependencies for React Web App"
yarn
if [ $? -ne 0 ]; then
echo "Error with yarn build of dependencies for React Web App. Check node version per documentation"
exit 2
fi
cd ${CURRENT_DIR}
clear
echo "Launch Java Installer for SaaS Boost"
java -Djava.util.logging.config.file=logging.properties -jar ${CURRENT_DIR}/installer/target/SaaSBoostInstall-1.0.0-shaded.jar