forked from Lexxie9952/fcw.org-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·40 lines (32 loc) · 1.06 KB
/
build.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
#!/bin/bash
# builds Freeciv-web, copies the war file to Tomcat and builds the selected rulesets.
BATCH_MODE=""
#Build site:
while [[ $# -gt 0 ]]; do
case $1 in
-B) BATCH_MODE="-B"; shift;;
*) echo "Unrecognized argument: $1"; shift;;
esac
done
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
TOMCATDIR="/var/lib/tomcat8"
WEBAPP_DIR="${DIR}/target/freeciv-web"
# Creating build.txt info file
REVTMP="$(git rev-parse HEAD 2>/dev/null)"
if test "x$REVTMP" != "x" ; then
# This is build from git repository.
mkdir -p "${WEBAPP_DIR}"
echo "This build is from freeciv-web commit: $REVTMP" > "${WEBAPP_DIR}/build.txt"
if ! test $(git diff | wc -l) -eq 0 ; then
echo "It had local modifications." >> "${WEBAPP_DIR}/build.txt"
fi
date >> "${WEBAPP_DIR}/build.txt"
else
rm -f "${WEBAPP_DIR}/build.txt"
fi
echo "maven package"
mvn ${BATCH_MODE} flyway:migrate package && \
echo "Copying target/freeciv-web.war to ${TOMCATDIR}/webapps" && \
cp target/freeciv-web.war "${TOMCATDIR}/webapps/"
# let user know when it's finished
echo $'\a'