comparison contrib/make_flys_release/make_release.sh @ 4484:7e82d51c5a27

Improved build script
author Sascha L. Teichmann <teichmann@intevation.de>
date Tue, 13 Nov 2012 19:03:59 +0100
parents 0182916dcb01
children b51f6bb188d7
comparison
equal deleted inserted replaced
4483:cc6323401643 4484:7e82d51c5a27
1 #!/bin/sh 1 #!/bin/bash
2 HG_USER=YOURNAME
3 2
4 echo "INFO: define required variables" 3 echo "INFO: define required variables"
5 ARTIFACTS_HG_REPO="ssh://$HG_USER@hg.wald.intevation.org/hg/dive4elements/artifacts" 4 ARTIFACTS_HG_REPO="http://wald.intevation.org/hg/dive4elements/artifacts"
6 HTTPCLIIENT_HG_REPO="ssh://$HG_USER@hg.wald.intevation.org/hg/dive4elements/http-client" 5 HTTPCLIIENT_HG_REPO="http://wald.intevation.org/hg/dive4elements/http-client"
7 FLYS_HG_REPO="ssh://$HG_USER@hg.wald.intevation.org/hg/dive4elements/flys" 6 FLYS_HG_REPO="http://wald.intevation.org/hg/dive4elements/flys"
8 7
9 ARTIFACTS_HG="hg.artifacts" 8 ARTIFACTS_HG="hg.artifacts"
10 HTTPCLIENT_HG="hg.http-client" 9 HTTPCLIENT_HG="hg.http-client"
11 FLYS_HG="hg.flys" 10 FLYS_HG="hg.flys"
12 11
13 PREFIX="flys-" 12 PREFIX="flys-"
14 RELEASE=default 13 RELEASE=default
15 RELEASE_DATE=`date +'%Y-%m-%d'` 14 RELEASE_DATE=`date +'%Y-%m-%d'`
16 DIRECTORY=$PREFIX$RELEASE_DATE 15 DIRECTORY=$PREFIX$RELEASE_DATE
17 16
17 ARTEFACT_PORT=9002
18 TOMCAT_PORT=8005
19
18 echo "INFO: create server directories" 20 echo "INFO: create server directories"
19 mkdir -p $DIRECTORY/server/bin/lib/own 21 mkdir -p $DIRECTORY/server/bin/lib/own
20 mkdir $DIRECTORY/server/shapefiles 22 mkdir $DIRECTORY/server/shapefiles
21 mkdir $DIRECTORY/client 23 mkdir $DIRECTORY/client
22 24
23 echo "INFO: checkout sources" 25 echo "INFO: checkout sources"
24 echo " ... checkout $ARTIFACTS_HG_REPO" 26 echo " ... checkout $ARTIFACTS_HG_REPO"
27
28 rm -rf $ARTIFACTS_HG
25 hg clone $ARTIFACTS_HG_REPO $ARTIFACTS_HG 29 hg clone $ARTIFACTS_HG_REPO $ARTIFACTS_HG
26 (cd $ARTIFACTS_HG && hg co $RELEASE) 30 (cd $ARTIFACTS_HG && hg co $RELEASE)
27 31
28 echo " ... checkout $HTTPCLIIENT_HG_REPO" 32 echo " ... checkout $HTTPCLIIENT_HG_REPO"
33 rm -rf $HTTPCLIENT_HG
29 hg clone $HTTPCLIIENT_HG_REPO $HTTPCLIENT_HG 34 hg clone $HTTPCLIIENT_HG_REPO $HTTPCLIENT_HG
30 (cd $HTTPCLIENT_HG && hg co $RELEASE) 35 (cd $HTTPCLIENT_HG && hg co $RELEASE)
31 36
32 echo " ... checkout $FLYS_HG_REPO" 37 echo " ... checkout $FLYS_HG_REPO"
38 rm -rf $FLYS_HG
33 hg clone $FLYS_HG_REPO $FLYS_HG 39 hg clone $FLYS_HG_REPO $FLYS_HG
34 (cd $FLYS_HG && hg co $RELEASE) 40 (cd $FLYS_HG && hg co $RELEASE)
35 41
36 # adapt client configuration 42 # adapt client configuration
37 echo "INFO: prepare configuration of web client" 43 echo "INFO: prepare configuration of web client"
38 cp confs/web.xml $FLYS_HG/flys-client/src/main/webapp/WEB-INF/web.xml 44
45 sed -i -e "s@http://localhost:8181@http://localhost:$ARTEFACT_PORT@g " \
46 -e "a@http://localhost:8888@http://localhost:$TOMCAT_PORT@g" \
47 $FLYS_HG/flys-client/src/main/webapp/WEB-INF/web.xml
39 48
40 echo "INFO: download OpenLayers-2.11 for client" 49 echo "INFO: download OpenLayers-2.11 for client"
41 curl -O http://openlayers.org/download/OpenLayers-2.11.tar.gz 50 curl -O http://openlayers.org/download/OpenLayers-2.11.tar.gz
42 tar xvfz OpenLayers-2.11.tar.gz 51 tar xvfz OpenLayers-2.11.tar.gz
43 # TODO: Remove more superfluous OpenLayers stuff. 52 # TODO: Remove more superfluous OpenLayers stuff.
46 rm -rf OpenLayers-2.11/examples 55 rm -rf OpenLayers-2.11/examples
47 mv OpenLayers-2.11 $FLYS_HG/flys-client/src/main/webapp/ 56 mv OpenLayers-2.11 $FLYS_HG/flys-client/src/main/webapp/
48 57
49 # compile and build our code stuff 58 # compile and build our code stuff
50 echo "INFO: compile and build sources" 59 echo "INFO: compile and build sources"
51 mvn -f $ARTIFACTS_HG/pom.xml clean compile package 60 mvn -f $ARTIFACTS_HG/pom.xml clean compile package install
52 mvn -f $FLYS_HG/flys-backend/pom.xml clean compile package 61 mvn -f $FLYS_HG/flys-backend/pom.xml clean compile package install
53 mvn -f $FLYS_HG/flys-artifacts/pom.xml clean compile package dependency:copy-dependencies 62 mvn -f $FLYS_HG/flys-artifacts/pom.xml clean compile package dependency:copy-dependencies
54 mvn -f $HTTPCLIENT_HG/pom.xml clean compile package install 63 mvn -f $HTTPCLIENT_HG/pom.xml clean compile package install
55 mvn -f $FLYS_HG/flys-client/pom.xml clean compile package 64 mvn -f $FLYS_HG/flys-client/pom.xml clean compile package
56 65
57 ## fetch the java stuff 66 ## fetch the java stuff
59 cp $ARTIFACTS_HG/artifact-database/target/artifact-database-1.0-SNAPSHOT.jar $DIRECTORY/server/bin/lib/own/ 68 cp $ARTIFACTS_HG/artifact-database/target/artifact-database-1.0-SNAPSHOT.jar $DIRECTORY/server/bin/lib/own/
60 cp $ARTIFACTS_HG/artifacts/target/artifacts-1.0-SNAPSHOT.jar $DIRECTORY/server/bin/lib/own/ 69 cp $ARTIFACTS_HG/artifacts/target/artifacts-1.0-SNAPSHOT.jar $DIRECTORY/server/bin/lib/own/
61 cp $ARTIFACTS_HG/artifacts-common/target/artifacts-common-1.0-SNAPSHOT.jar $DIRECTORY/server/bin/lib/own/ 70 cp $ARTIFACTS_HG/artifacts-common/target/artifacts-common-1.0-SNAPSHOT.jar $DIRECTORY/server/bin/lib/own/
62 cp $FLYS_HG/flys-backend/target/flys-backend-1.0-SNAPSHOT.jar $DIRECTORY/server/bin/lib/own/ 71 cp $FLYS_HG/flys-backend/target/flys-backend-1.0-SNAPSHOT.jar $DIRECTORY/server/bin/lib/own/
63 cp $FLYS_HG/flys-artifacts/target/flys-artifacts-1.0-SNAPSHOT.jar $DIRECTORY/server/bin/lib/own/ 72 cp $FLYS_HG/flys-artifacts/target/flys-artifacts-1.0-SNAPSHOT.jar $DIRECTORY/server/bin/lib/own/
64 cp $FLYS_HG/flys-client/target/FLYS-1.0-SNAPSHOT.war $DIRECTORY/client/ 73 cp $FLYS_HG/flys-client/target/FLYS-1.0-SNAPSHOT.war $DIRECTORY/client/flys-${RELEASE}.war
65 cp $FLYS_HG/flys-artifacts/target/dependency/* $DIRECTORY/server/bin/lib/ 74 cp $FLYS_HG/flys-artifacts/target/dependency/* $DIRECTORY/server/bin/lib/
66 75
67 echo "INFO: copy scripts and libraries to target destination" 76 echo "INFO: copy scripts and libraries to target destination"
68 cp bin/run.sh $DIRECTORY/server/bin/ 77 cp bin/run.sh $DIRECTORY/server/bin/
69 cp bin/wsplgen.exe $DIRECTORY/server/bin/ 78 cp bin/wsplgen.exe $DIRECTORY/server/bin/
78 rm $DIRECTORY/server/bin/lib/ojdbc* 87 rm $DIRECTORY/server/bin/lib/ojdbc*
79 88
80 # fetch the configuration stuff 89 # fetch the configuration stuff
81 echo "INFO: copy default configuration to target destination" 90 echo "INFO: copy default configuration to target destination"
82 cp -R $FLYS_HG/flys-artifacts/doc/conf $DIRECTORY/server/ 91 cp -R $FLYS_HG/flys-artifacts/doc/conf $DIRECTORY/server/
83 cp confs/* $DIRECTORY/server/conf/ 92
93 #cp confs/* $DIRECTORY/server/conf/
94 mkdir -o $DIRECTORY/server/conf
95
96 sed "s/8999/$ARTEFACT_PORT/g" \
97 confs/rest-server.xml \
98 > $DIRECTORY/server/conf/rest-server.xml
99
100 sed "s@http://czech-republic.intevation.de/@http://flys-devel.intevation.de/@g" \
101 "s@flys-default@flys-$RELEASE@g" \
102 confs/floodmap.xml \
103 > $DIRECTORY/server/conf/floodmap.xml
104
105 sed "s@/tmp/flys-server-default.log@/tmp/flys-server-${RELEASE}.log" \
106 confs/log4j.properties \
107 > $DIRECTORY/server/conf/log4j.properties
108
109 # TODO: Use templating here
110 cp confs/seddb-db.xml $DIRECTORY/server/conf/seddb-db.xml
111 cp confs/backend-db.xml $DIRECTORY/server/conf/backend-db.xml
112 cp confs/artifact-db.xml $DIRECTORY/server/conf/artifact-db.xml
113 cp confs/datacage-db.xml $DIRECTORY/server/conf/datacage-db.xml
84 114
85 cp $ARTIFACTS_HG/artifact-database/doc/schema-h2.sql h2/artifacts-h2.sql 115 cp $ARTIFACTS_HG/artifact-database/doc/schema-h2.sql h2/artifacts-h2.sql
86 cp $FLYS_HG/flys-artifacts/doc/conf/datacage.sql h2/datacage.sql 116 cp $FLYS_HG/flys-artifacts/doc/conf/datacage.sql h2/datacage.sql
87 117
88 echo "INFO: create h2 database for artifacts and datacage" 118 echo "INFO: create h2 database for artifacts and datacage"

http://dive4elements.wald.intevation.org