| 1 |
#! /bin/sh |
|---|
| 2 |
|
|---|
| 3 |
# |
|---|
| 4 |
# This file is included by the quickstart script file bw so that it can live |
|---|
| 5 |
# within the svn repository. |
|---|
| 6 |
# |
|---|
| 7 |
PRG="$0" |
|---|
| 8 |
|
|---|
| 9 |
usage() { |
|---|
| 10 |
echo "$PRG [-bwchome path | -quickstart ] [ -bwc configname ] [ -offline } [ target ] " |
|---|
| 11 |
echo "" |
|---|
| 12 |
echo " -bwchome specify path to configurations" |
|---|
| 13 |
echo " -quickstart Use the current quickstart configurations " |
|---|
| 14 |
echo " - bwc specify configuration name" |
|---|
| 15 |
echo " -offline build without atempting to retrieve library jars" |
|---|
| 16 |
echo " target ant target to execute" |
|---|
| 17 |
echo "" |
|---|
| 18 |
echo "Invokes ant to build or deploy the bedework system. Uses a configuration" |
|---|
| 19 |
echo "directory which contains one directory per configuration." |
|---|
| 20 |
echo "" |
|---|
| 21 |
echo "Within each configuration directory we expect a file called build.properties" |
|---|
| 22 |
echo "which should point to the proerty and options file needed for th edeploy process" |
|---|
| 23 |
echo "" |
|---|
| 24 |
echo "In general these files will be in the same directory as build.properties." |
|---|
| 25 |
echo "The environment variable BEDEWORK_CONFIG contains the path to the current" |
|---|
| 26 |
echo "configuration directory and can be used to build a path to the other files." |
|---|
| 27 |
echo "" |
|---|
| 28 |
} |
|---|
| 29 |
|
|---|
| 30 |
saveddir=`pwd` |
|---|
| 31 |
|
|---|
| 32 |
export QUICKSTART_HOME=$saveddir |
|---|
| 33 |
|
|---|
| 34 |
# Default some parameters |
|---|
| 35 |
|
|---|
| 36 |
BWCONFIGS= |
|---|
| 37 |
bwc=default |
|---|
| 38 |
BWCONFIG= |
|---|
| 39 |
offline= |
|---|
| 40 |
quickstart= |
|---|
| 41 |
|
|---|
| 42 |
while [ "$1" != "" ] |
|---|
| 43 |
do |
|---|
| 44 |
# Process the next arg |
|---|
| 45 |
case $1 # Look at $1 |
|---|
| 46 |
in |
|---|
| 47 |
-bwchome) # Define location of configs |
|---|
| 48 |
shift |
|---|
| 49 |
BWCONFIGS="$1" |
|---|
| 50 |
shift |
|---|
| 51 |
;; |
|---|
| 52 |
-quickstart) |
|---|
| 53 |
quickstart="yes" |
|---|
| 54 |
shift |
|---|
| 55 |
;; |
|---|
| 56 |
-usage | -help | -? | ?) |
|---|
| 57 |
usage |
|---|
| 58 |
exit |
|---|
| 59 |
shift |
|---|
| 60 |
;; |
|---|
| 61 |
-bwc) |
|---|
| 62 |
shift |
|---|
| 63 |
bwc="$1" |
|---|
| 64 |
shift |
|---|
| 65 |
;; |
|---|
| 66 |
-offline) |
|---|
| 67 |
offline="-Dorg.bedework.offline.build=yes" |
|---|
| 68 |
shift |
|---|
| 69 |
;; |
|---|
| 70 |
-*) |
|---|
| 71 |
usage |
|---|
| 72 |
exit 1 |
|---|
| 73 |
;; |
|---|
| 74 |
*) |
|---|
| 75 |
# Assume we've reached the target(s) |
|---|
| 76 |
break |
|---|
| 77 |
;; |
|---|
| 78 |
esac |
|---|
| 79 |
done |
|---|
| 80 |
|
|---|
| 81 |
if [ "$quickstart" != "" ] ; then |
|---|
| 82 |
if [ "$BWCONFIGS" != "" ] ; then |
|---|
| 83 |
echo "*******************************************************" |
|---|
| 84 |
echo "Error: Cannot specify both -quickstart and -bwchome" |
|---|
| 85 |
echo "*******************************************************" |
|---|
| 86 |
exit 1 |
|---|
| 87 |
fi |
|---|
| 88 |
|
|---|
| 89 |
BWCONFIGS=$QUICKSTART_HOME/bedework/config/bwbuild |
|---|
| 90 |
elif [ "$BWCONFIGS" = "" ] ; then |
|---|
| 91 |
BWCONFIGS=$HOME/bwbuild |
|---|
| 92 |
fi |
|---|
| 93 |
|
|---|
| 94 |
export BEDEWORK_CONFIGS_HOME=$BWCONFIGS |
|---|
| 95 |
export BEDEWORK_CONFIG=$BWCONFIGS/$bwc |
|---|
| 96 |
|
|---|
| 97 |
if [ ! -f "$BEDEWORK_CONFIG/build.properties" ] ; then |
|---|
| 98 |
echo "*******************************************************" |
|---|
| 99 |
echo "Error: Configuration $BEDEWORK_CONFIG does not exist or is not a bedework configuration." |
|---|
| 100 |
echo "*******************************************************" |
|---|
| 101 |
exit 1 |
|---|
| 102 |
fi |
|---|
| 103 |
|
|---|
| 104 |
if [ -z "$JAVA_HOME" -o ! -d "$JAVA_HOME" ] ; then |
|---|
| 105 |
echo "*******************************************************" |
|---|
| 106 |
echo "Error: JAVA_HOME is not defined correctly for bedework." |
|---|
| 107 |
echo "*******************************************************" |
|---|
| 108 |
exit 1 |
|---|
| 109 |
fi |
|---|
| 110 |
|
|---|
| 111 |
# Make available for ant |
|---|
| 112 |
export BWCONFIG="-Dorg.bedework.user.build.properties=$BEDEWORK_CONFIG/build.properties" |
|---|
| 113 |
|
|---|
| 114 |
echo "BWCONFIGS=$BWCONFIGS" |
|---|
| 115 |
echo "BWCONFIG=$BWCONFIG" |
|---|
| 116 |
|
|---|
| 117 |
ANT_HOME=`dirname "$PRG"`/apache-ant-1.7.0 |
|---|
| 118 |
ANT_HOME=`cd "$ANT_HOME" && pwd` |
|---|
| 119 |
|
|---|
| 120 |
CLASSPATH=$ANT_HOME/lib/ant-launcher.jar |
|---|
| 121 |
|
|---|
| 122 |
$JAVA_HOME/bin/java -classpath $CLASSPATH $offline -Dant.home=$ANT org.apache.tools.ant.launch.Launcher $BWCONFIG $* |
|---|