-
Notifications
You must be signed in to change notification settings - Fork 14
/
eap-installer.sh
executable file
·89 lines (74 loc) · 2.71 KB
/
eap-installer.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
#!/bin/bash
readonly MVN_REPO=${MVN_REPO:-'mvn-repo'}
readonly MVN_REPO_ZIP=${MVN_REPO_ZIP:-'mvn-repo.zip'}
verify_maven() {
if [ -z "${MAVEN_HOME}" ]; then
echo 'MAVEN_HOME variable not set'
return 1
fi
if [ ! -d "${MAVEN_HOME}" ] || [ ! -d "${MAVEN_HOME}/bin" ]; then
echo "${MAVEN_HOME}/bin is not a directory"
return 1
fi
if [ ! -e "${MAVEN_HOME}/bin/mvn" ] || [ ! -x "${MAVEN_HOME}/bin/mvn" ]; then
echo "${MAVEN_HOME}/bin/mvn is not present or is not executable"
return 1
fi
return 0
}
if ! verify_maven; then
echo 'Maven is required to run the build. Please see above'
exit 1
fi
readonly MAVEN_BIN_DIR="${MAVEN_HOME}/bin"
echo "Adding ${MAVEN_BIN_DIR} to PATH:${PATH}."
export PATH=${MAVEN_BIN_DIR}:${PATH}
if [ $# -ne 1 ]; then
echo "eap-installer needs action. Allowed values are [testsuite installer commons izpack]"
exit 2
fi
readonly ACTION="${1}"
if [ "${ACTION}" != 'testsuite' ] && [ "${ACTION}" != 'installer' ] &&
[ "${ACTION}" != 'izpack' ] && [ "${ACTION}" != 'commons' ]; then
echo "Unknown action: ${ACTION}"
exit 2
fi
if [ "${ACTION}" != 'testsuite' ]; then
if [ "${ACTION}" = 'izpack' ]; then
mkdir "${MVN_REPO}"
else
unzip "${MVN_REPO_ZIP}"
fi
BUILD_OPTS="${BUILD_OPTS} -Dmaven.repo.local=${MVN_REPO}"
if [ "${ACTION}" = 'installer' ] && [ -n "${EAP_QUICKSTART_LINK}" ]; then
BUILD_OPTS="${BUILD_OPTS} -Deap.quickstarts.link=${EAP_QUICKSTART_LINK}"
fi
# shellcheck disable=SC2086
# BUILD_OPTS has to be interpreted as multiple parameters
mvn ${BUILD_OPTS} clean install
zip -rq "${MVN_REPO_ZIP}" "${MVN_REPO}"
else
Xvfb :1 &
XVFB_PID=$!
# shellcheck disable=SC2064
# evaluate XVFB_PID now rather then when called
trap "kill -9 ${XVFB_PID}" EXIT
readonly ORIGINAL_JARS=( *.jar )
# check if just one
readonly VERSION=$(echo "${ORIGINAL_JARS[0]}" | sed -r "s/.*([0-9]+\.[0-9]+\.[0-9]).*/\1/")
readonly INSTALLER="jboss-eap-${VERSION}-installer.jar"
mv "${ORIGINAL_JARS[0]}" "${INSTALLER}"
if [ -n "${EAP_QUICKSTART_LINK}" ]; then
BUILD_OPTS="${BUILD_OPTS} -Deap.bits.url.quickstarts=${EAP_QUICKSTART_LINK}"
fi
if [ -n "${EAP_BUILD_LINK}" ]; then
BUILD_OPTS="${BUILD_OPTS} -Deap.bits.url.zip=${EAP_BUILD_LINK}"
fi
export MAVEN_OPTS="-Xms1968m -Xmx1968m -XX:MaxPermSize=256m"
export DISPLAY=:1
export INSTALL_TIMEOUT=600
BUILD_OPTS="${BUILD_OPTS} -Deap.install.timeout=1000 -Deap.start.timeout=120 -Deap.stop.timeout=20 -fn -fae -Dgui.test.timeout=1000"
# shellcheck disable=SC2086
# BUILD_OPTS has to be interpreted as multiple parameters
mvn clean test -B -Deap.installer="${INSTALLER}" ${BUILD_OPTS}
fi