comparison contrib/make_flys_release/make_release.sh @ 8501:c8d633c0971b

Release script: remove installation specific defaults and give the possibility to overwrite any config-file in WEB-INF.
author Tom Gottfried <tom@intevation.de>
date Mon, 15 Dec 2014 19:30:10 +0100
parents 414e68e6d19a
children da9365fc2f42
comparison
equal deleted inserted replaced
8500:414e68e6d19a 8501:c8d633c0971b
28 usage(){ 28 usage(){
29 cat << EOF 29 cat << EOF
30 30
31 usage: $0 [options] VERSION 31 usage: $0 [options] VERSION
32 32
33 Create a flys package 33 Create a D4E River package
34 34
35 OPTIONS: 35 OPTIONS:
36 -?, --help Show this message 36 -?, --help Show this message
37 -w The working directory to use (do not use spaces in path) 37 -w The working directory to use (do not use spaces in path)
38 Default: $DEFAULT_WD 38 Default: $DEFAULT_WD
53 # --seddb-url Sediment db url. Default: $SEDDBURL 53 # --seddb-url Sediment db url. Default: $SEDDBURL
54 # --seddb-port Sediment db port. Default: $SEDDBPORT 54 # --seddb-port Sediment db port. Default: $SEDDBPORT
55 # --seddb-user Sediment db user. Default: $SEDDBUSER 55 # --seddb-user Sediment db user. Default: $SEDDBUSER
56 # --seddb-pass Sediment db password. Default: $SEDDBPASS 56 # --seddb-pass Sediment db password. Default: $SEDDBPASS
57 # --seddb-back Sediment db backend. Default: $SEDDBBACK 57 # --seddb-back Sediment db backend. Default: $SEDDBBACK
58 TOMCAT_PORT=${TOMCAT_PORT:-8282} 58
59 WIKI_URL=${WIKI_URL:-https://flys3-devel.bafg.de/wiki} 59 # customizable variables
60 # Prefix to FreeSans.ttf
61 FONT_PATH=${FONT_PATH:-/opt/flys}
62
63 # Backend configuration
64 LOG_DIR=/var/log/flys
65
66 # Client configuration
67 AUTH=${AUTH:-GGinA}
68 ELBE_MODEL_UUID=${ELBE_MODEL_UUID:-1a4825f6-925f-11e3-8165-001f29e71d12} 60 ELBE_MODEL_UUID=${ELBE_MODEL_UUID:-1a4825f6-925f-11e3-8165-001f29e71d12}
69 61
70 OPTS=`getopt -o ?w:,t,o \ 62 OPTS=`getopt -o ?w:,t,o \
71 -l help,oracle \ 63 -l help,oracle \
72 -n $0 -- "$@"` 64 -n $0 -- "$@"`
98 if [ $# != 1 ]; then 90 if [ $# != 1 ]; then
99 usage 91 usage
100 fi 92 fi
101 93
102 VERSION=$1 94 VERSION=$1
103 if [ -n "`hg branches | sed -n "/$VERSION/p"`" ]; then
104 ARTIFACT_PORT=${ARTIFACT_PORT:-29999}
105 else
106 ARTIFACT_PORT=${ARTIFACT_PORT:-`echo 1$VERSION | sed 's/\.//g'`}
107 fi
108 95
109 if [ -z $WORK_DIR ]; then 96 if [ -z $WORK_DIR ]; then
110 WORK_DIR=$DEFAULT_WD 97 WORK_DIR=$DEFAULT_WD
111 fi 98 fi
112 99
152 # Update to current version 139 # Update to current version
153 for repo in $REPOS; do 140 for repo in $REPOS; do
154 cd $repo 141 cd $repo
155 if [ -z "`hg tags | sed -n "/$VERSION/p"`" -a -z "`hg branches | sed -n "/$VERSION/p"`" ] 142 if [ -z "`hg tags | sed -n "/$VERSION/p"`" -a -z "`hg branches | sed -n "/$VERSION/p"`" ]
156 then 143 then
157 echo "[WARNING]: $VERSION not found in $repo! Updating to default." 144 echo "WARNING: $VERSION not found in $repo! Updating to default."
158 hg up default 145 hg up default
159 else 146 else
160 hg up "$VERSION" 147 hg up "$VERSION"
161 fi 148 fi
162 cd $FLYS_SOURCE_DIR 149 cd $FLYS_SOURCE_DIR
166 cd $WORK_DIR 153 cd $WORK_DIR
167 mkdir -p "$WORK_DIR/server/bin/lib/own" 154 mkdir -p "$WORK_DIR/server/bin/lib/own"
168 mkdir "$WORK_DIR/server/shapefiles" 155 mkdir "$WORK_DIR/server/shapefiles"
169 mkdir "$WORK_DIR/client" 156 mkdir "$WORK_DIR/client"
170 157
171 echo "[INFO]: Preparing configuration of web client" 158
172 echo "[INFO]: Tomcat Port: $TOMCAT_PORT" 159 echo "INFO: Preparing configuration of web client"
173 echo "[INFO]: Artifact Port: $ARTIFACT_PORT"
174 160
175 #Needs to be done before the tomcat replacement below 161 #Needs to be done before the tomcat replacement below
176 if [ -r "$FEATURES_XML" ]; then
177 cp "$FEATURES_XML" \
178 $FLYS_SOURCE_DIR/river/gwt-client/src/main/webapp/WEB-INF/features.xml
179 fi
180
181 if [ -r "$CLIENT_LOG4J" ]; then
182 cp "$CLIENT_LOG4J" \
183 $FLYS_SOURCE_DIR/river/gwt-client/src/main/webapp/WEB-INF/log4j.properties
184 fi
185
186 sed -i -e "s@http://localhost:8080/d4e-river/flys/mapfish-print@https://localhost/flys-${VERSION}/flys/mapfish-print@g" \
187 $FLYS_SOURCE_DIR/river/gwt-client/src/main/webapp/WEB-INF/web.xml
188
189 sed -i -e "s@http://localhost:8181@http://localhost:$ARTIFACT_PORT@g" \
190 -e "s@http://localhost:8888@http://localhost:$TOMCAT_PORT@g" \
191 $FLYS_SOURCE_DIR/river/gwt-client/src/main/webapp/WEB-INF/web.xml
192
193 sed -i -e "s@<param-value>plain</param-value>@<param-value>$AUTH</param-value>@" \
194 $FLYS_SOURCE_DIR/river/gwt-client/src/main/webapp/WEB-INF/web.xml
195
196 sed -i -e "s@https://flys3-devel.bafg.de/wiki@${WIKI_URL}@g" \
197 $FLYS_SOURCE_DIR/river/gwt-client/src/main/java/org/dive4elements/river/client/client/config.xml
198
199 sed -i -e \
200 "s@/var/log/d4e-river/d4e-client.log@${LOG_DIR}/client-VERSION.log@g" \
201 $FLYS_SOURCE_DIR/river/gwt-client/src/main/webapp/WEB-INF/log4j.properties
202
203 sed -i -e "s@VERSION@${VERSION}@g" \
204 $FLYS_SOURCE_DIR/river/gwt-client/src/main/webapp/WEB-INF/log4j.properties
205
206 sed -i -e "s@1a4825f6-925f-11e3-8165-001f29e71d12@${ELBE_MODEL_UUID}@g" \ 162 sed -i -e "s@1a4825f6-925f-11e3-8165-001f29e71d12@${ELBE_MODEL_UUID}@g" \
207 $FLYS_SOURCE_DIR/river/gwt-client/src/main/webapp/images/FLYS_Karte_interactive.html 163 $FLYS_SOURCE_DIR/river/gwt-client/src/main/webapp/images/FLYS_Karte_interactive.html
208 164
209 find $FLYS_SOURCE_DIR/river/ -name \*.properties -o -name \*.xsl | \ 165 if [ -d $WEBINF ]; then
210 xargs sed -i "s@https://flys-intern.intevation.de@${WIKI_URL}@g"; 166 echo "INFO: copy custom client configuration to target destination"
211 167 WEBINF_DIR=$FLYS_SOURCE_DIR/river/gwt-client/src/main/webapp/WEB-INF/
212 if [ -r "$WMSSERVICES_XML" ]; then 168 cp -R $WEBINF/* $WEBINF_DIR
213 cp "$WMSSERVICES_XML" \ 169 for file in `find $WEBINF_DIR/ -type f`; do
214 $FLYS_SOURCE_DIR/river/gwt-client/src/main/webapp/WEB-INF/wms-services.xml 170 sed -i -e "s@D4E_VERSION@${VERSION}@g" $file
215 fi 171 done
216 172 fi
217 if [ -r "$CONFIG_YAML" ]; then
218 cp "$CONFIG_YAML" $FLYS_SOURCE_DIR/river/gwt-client/src/main/webapp/WEB-INF/config.yaml
219 fi
220
221 sed -i -e "s@/usr/share/fonts/truetype/freefont@${FONT_PATH}@g" \
222 $FLYS_SOURCE_DIR/river/gwt-client/src/main/webapp/WEB-INF/config.yaml
223 173
224 174
225 if [ ! -f $FLYS_SOURCE_DIR/OpenLayers-2.11.tar.gz ]; then 175 if [ ! -f $FLYS_SOURCE_DIR/OpenLayers-2.11.tar.gz ]; then
226 echo "INFO: download OpenLayers-2.11 for client" 176 echo "INFO: download OpenLayers-2.11 for client"
227 cd $FLYS_SOURCE_DIR 177 cd $FLYS_SOURCE_DIR
285 echo "Please make sure that the ORACLE_HIBERNATE variable is set correctly" 235 echo "Please make sure that the ORACLE_HIBERNATE variable is set correctly"
286 exit 1 236 exit 1
287 fi 237 fi
288 cp $ORACLE_HIBERNATE $ORACLE_JDBC $WORK_DIR/server/bin/lib/ 238 cp $ORACLE_HIBERNATE $ORACLE_JDBC $WORK_DIR/server/bin/lib/
289 else 239 else
290 echo "INFO: remove Oralce libraries" 240 echo "INFO: remove Oracle libraries"
291 rm -f $WORK_DIR/server/bin/lib/hibernate-spatial-oracle-1.1.jar 241 rm -f $WORK_DIR/server/bin/lib/hibernate-spatial-oracle-1.1.jar
292 rm -f $WORK_DIR/server/bin/lib/ojdbc* 242 rm -f $WORK_DIR/server/bin/lib/ojdbc*
293 fi 243 fi
294 244
295 245
296 echo "INFO: copy default configuration to target destination" 246 echo "INFO: copy default server configuration to target destination"
297 cp -R $FLYS_SOURCE_DIR/river/artifacts/doc/conf $WORK_DIR/server/ 247 cp -R $FLYS_SOURCE_DIR/river/artifacts/doc/conf $WORK_DIR/server/
298
299 sed -i "s/8181/$ARTIFACT_PORT/g" \
300 $WORK_DIR/server/conf/rest-server.xml
301 248
302 if [ -n $DGM_PATH ]; then 249 if [ -n $DGM_PATH ]; then
303 sed -i -e "s@<dgm-path>/path/to/rivers/</dgm-path>@<dgm-path>${DGM_PATH}</dgm-path>@g" \ 250 sed -i -e "s@<dgm-path>/path/to/rivers/</dgm-path>@<dgm-path>${DGM_PATH}</dgm-path>@g" \
304 $WORK_DIR/server/conf/conf.xml 251 $WORK_DIR/server/conf/conf.xml
305 fi 252 fi
308 sed -i -e "s@<help-url>http://example.com</help-url>@<help-url>${WIKI_URL}</help-url>@g" \ 255 sed -i -e "s@<help-url>http://example.com</help-url>@<help-url>${WIKI_URL}</help-url>@g" \
309 $WORK_DIR/server/conf/conf.xml 256 $WORK_DIR/server/conf/conf.xml
310 fi 257 fi
311 258
312 if [ -d $SERVER_CONF ]; then 259 if [ -d $SERVER_CONF ]; then
313 echo "INFO: copy custom configuration to target destination" 260 echo "INFO: copy custom server configuration to target destination"
314 cp -R $SERVER_CONF/* $WORK_DIR/server/conf/ 261 cp -R $SERVER_CONF/* $WORK_DIR/server/conf/
315 for file in `find $WORK_DIR/server/conf -type f`; do 262 for file in `find $WORK_DIR/server/conf -type f`; do
316 sed -i -e "s@D4E_VERSION@${VERSION}@g" $file 263 sed -i -e "s@D4E_VERSION@${VERSION}@g" $file
317 done 264 done
318 fi 265 fi

http://dive4elements.wald.intevation.org