2009-11-07 22:12:12 +01:00
#!/bin/bash
2011-02-18 02:58:15 +01:00
set -e
2011-04-09 17:48:36 +02:00
set -u
2011-02-18 02:58:15 +01:00
2011-04-09 17:48:36 +02:00
WISE_VERSION = $1
2009-11-07 22:12:12 +01:00
BASE_DIR = ` pwd `
TARGET_DIR = $BASE_DIR /target
JETTY_DIR = $TARGET_DIR /wisemapping-$WISE_VERSION
WISE_WEBAPP_DIR = $JETTY_DIR /webapps/wisemapping
2011-07-05 17:31:17 +02:00
JETTY_DIST_DIR = jetty-distribution-7.4.3.v20110701
2011-02-18 02:58:15 +01:00
JETTY_ZIP = ${ JETTY_DIST_DIR } .zip
2009-11-07 22:12:12 +01:00
# Clean ...
2011-07-05 17:31:17 +02:00
mvn -o -f $BASE_DIR /../pom.xml clean
2011-04-09 17:48:36 +02:00
[ ! -e target ] && mkdir target
2011-02-18 02:58:15 +01:00
rm -fr ${ JETTY_DIR }
2011-07-05 17:31:17 +02:00
rm -fr ${ TARGET_DIR } /${ JETTY_DIST_DIR }
2009-11-07 22:12:12 +01:00
# Prepare resources ..
2011-07-05 17:31:17 +02:00
mvn -o -f $BASE_DIR /../pom.xml install
2009-11-07 22:12:12 +01:00
2011-02-18 02:58:15 +01:00
if [ ! -f ./target/${ JETTY_ZIP } ]
2009-11-07 22:12:12 +01:00
then
echo "Download Jetty"
2011-02-18 02:58:15 +01:00
wget http://download.eclipse.org/jetty/stable-7/dist/${ JETTY_ZIP } -P $TARGET_DIR
2009-11-07 22:12:12 +01:00
fi
echo "Unzip Jetty ...:"
2011-02-18 02:58:15 +01:00
unzip ${ TARGET_DIR } /${ JETTY_ZIP } -d ${ TARGET_DIR } / > /dev/null
mv ${ TARGET_DIR } /${ JETTY_DIST_DIR } ${ JETTY_DIR }
2009-11-07 22:12:12 +01:00
# Clean unsed files ...
rm -r $JETTY_DIR /webapps/*
rm -r $JETTY_DIR /contexts/*
# Now, start wise-webapps customization ...
echo "Unzip wisemappig.war ..."
mkdir $WISE_WEBAPP_DIR
unzip $BASE_DIR /../wise-webapp/target/wisemapping.war -d $WISE_WEBAPP_DIR >/dev/null
rm $WISE_WEBAPP_DIR /images/wisemapping.swf
mkdir $WISE_WEBAPP_DIR /WEB-INF/database
2009-11-07 22:32:33 +01:00
cp -r $BASE_DIR /../wise-webapp/target/db/* $WISE_WEBAPP_DIR /WEB-INF/database/
2009-11-07 22:12:12 +01:00
cp $BASE_DIR /wisemapping.xml $JETTY_DIR /contexts/
# Some replacements ...
sed 's/target\/db\/wisemapping/webapps\/wisemapping\/WEB-INF\/database\/wisemapping/' $WISE_WEBAPP_DIR /WEB-INF/app.properties > $WISE_WEBAPP_DIR /WEB-INF/app.properties2
mv $WISE_WEBAPP_DIR /WEB-INF/app.properties2 $WISE_WEBAPP_DIR /WEB-INF/app.properties
2011-04-09 17:48:36 +02:00
# Distribute scripts
cp -r $BASE_DIR /../wise-webapp/src/test/sql $TARGET_DIR /wisemapping-$WISE_VERSION /config
# Zip all ...
2009-11-07 22:12:12 +01:00
cd $TARGET_DIR
zip -r wisemapping-$WISE_VERSION .zip wisemapping-$WISE_VERSION
cd ..