| 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 |
|
|---|
| 8 |
ANT_HOME=`dirname "$PRG"`/apache-ant-1.7.0 |
|---|
| 9 |
ANT_HOME=`cd "$ANT_HOME" && pwd` |
|---|
| 10 |
|
|---|
| 11 |
#ant_listener="-listener org.apache.tools.ant.listener.Log4jListener" |
|---|
| 12 |
#ant_xmllogfile="-DXmlLogger.file=log.xml" |
|---|
| 13 |
#ant_logger="-logger org.apache.tools.ant.XmlLogger" |
|---|
| 14 |
|
|---|
| 15 |
ant_listener= |
|---|
| 16 |
ant_xmllogfile= |
|---|
| 17 |
ant_logger= |
|---|
| 18 |
|
|---|
| 19 |
echo "" |
|---|
| 20 |
echo " Bedework Calendar System" |
|---|
| 21 |
echo " ------------------------" |
|---|
| 22 |
echo "" |
|---|
| 23 |
|
|---|
| 24 |
PRG="$0" |
|---|
| 25 |
|
|---|
| 26 |
usage() { |
|---|
| 27 |
echo " $PRG [ -quickstart | -bwchome path ] [ -bwc configname ] [ -offline } [ target ] " |
|---|
| 28 |
echo "" |
|---|
| 29 |
echo " -quickstart Use the current quickstart configurations " |
|---|
| 30 |
echo " -bwchome Specify path to configurations" |
|---|
| 31 |
echo " -bwc Specify configuration name" |
|---|
| 32 |
echo " -offline Build without attempting to retrieve library jars" |
|---|
| 33 |
echo " -carddav Target is for the CardDAV build, otherwise it's a calendar build" |
|---|
| 34 |
echo " target Ant target to execute" |
|---|
| 35 |
echo "" |
|---|
| 36 |
echo " Invokes ant to build or deploy the Bedework system. Uses a configuration" |
|---|
| 37 |
echo " directory which contains one directory per configuration." |
|---|
| 38 |
echo "" |
|---|
| 39 |
echo " Within each configuration directory we expect a file called build.properties" |
|---|
| 40 |
echo " which should point to the property and options file needed for the deploy process" |
|---|
| 41 |
echo "" |
|---|
| 42 |
echo " In general these files will be in the same directory as build.properties." |
|---|
| 43 |
echo " The environment variable BEDEWORK_CONFIG contains the path to the current" |
|---|
| 44 |
echo " configuration directory and can be used to build a path to the other files." |
|---|
| 45 |
echo "" |
|---|
| 46 |
} |
|---|
| 47 |
|
|---|
| 48 |
errorUsage() { |
|---|
| 49 |
echo "*******************************************************" |
|---|
| 50 |
echo "Error: $1" |
|---|
| 51 |
echo "*******************************************************" |
|---|
| 52 |
usage |
|---|
| 53 |
exit 1 |
|---|
| 54 |
} |
|---|
| 55 |
|
|---|
| 56 |
if [ -z "$JAVA_HOME" -o ! -d "$JAVA_HOME" ] ; then |
|---|
| 57 |
errorUsage "JAVA_HOME is not defined correctly for bedework." |
|---|
| 58 |
fi |
|---|
| 59 |
|
|---|
| 60 |
saveddir=`pwd` |
|---|
| 61 |
|
|---|
| 62 |
trap 'cd $saveddir' 0 |
|---|
| 63 |
trap "exit 2" 1 2 3 15 |
|---|
| 64 |
|
|---|
| 65 |
export QUICKSTART_HOME=$saveddir |
|---|
| 66 |
|
|---|
| 67 |
# Default some parameters |
|---|
| 68 |
|
|---|
| 69 |
BWCONFIGS= |
|---|
| 70 |
bwc=default |
|---|
| 71 |
BWCONFIG= |
|---|
| 72 |
offline= |
|---|
| 73 |
quickstart= |
|---|
| 74 |
carddav= |
|---|
| 75 |
|
|---|
| 76 |
if [ "$1" = "" ] ; then |
|---|
| 77 |
usage |
|---|
| 78 |
exit 1 |
|---|
| 79 |
fi |
|---|
| 80 |
|
|---|
| 81 |
while [ "$1" != "" ] |
|---|
| 82 |
do |
|---|
| 83 |
# Process the next arg |
|---|
| 84 |
case $1 # Look at $1 |
|---|
| 85 |
in |
|---|
| 86 |
-bwchome) # Define location of configs |
|---|
| 87 |
shift |
|---|
| 88 |
BWCONFIGS="$1" |
|---|
| 89 |
shift |
|---|
| 90 |
;; |
|---|
| 91 |
-quickstart) |
|---|
| 92 |
quickstart="yes" |
|---|
| 93 |
shift |
|---|
| 94 |
;; |
|---|
| 95 |
-carddav) |
|---|
| 96 |
carddav="yes" |
|---|
| 97 |
shift |
|---|
| 98 |
;; |
|---|
| 99 |
-usage | -help | -? | ?) |
|---|
| 100 |
usage |
|---|
| 101 |
exit |
|---|
| 102 |
shift |
|---|
| 103 |
;; |
|---|
| 104 |
-bwc) |
|---|
| 105 |
shift |
|---|
| 106 |
bwc="$1" |
|---|
| 107 |
shift |
|---|
| 108 |
;; |
|---|
| 109 |
-offline) |
|---|
| 110 |
offline="-Dorg.bedework.offline.build=yes" |
|---|
| 111 |
shift |
|---|
| 112 |
;; |
|---|
| 113 |
-*) |
|---|
| 114 |
usage |
|---|
| 115 |
exit 1 |
|---|
| 116 |
;; |
|---|
| 117 |
*) |
|---|
| 118 |
# Assume we've reached the target(s) |
|---|
| 119 |
break |
|---|
| 120 |
;; |
|---|
| 121 |
esac |
|---|
| 122 |
done |
|---|
| 123 |
|
|---|
| 124 |
if [ "$quickstart" != "" ] ; then |
|---|
| 125 |
if [ "$BWCONFIGS" != "" ] ; then |
|---|
| 126 |
errorUsage "Cannot specify both -quickstart and -bwchome" |
|---|
| 127 |
fi |
|---|
| 128 |
|
|---|
| 129 |
BWCONFIGS=$QUICKSTART_HOME/bedework/config/bwbuild |
|---|
| 130 |
elif [ "$BWCONFIGS" = "" ] ; then |
|---|
| 131 |
BWCONFIGS=$HOME/bwbuild |
|---|
| 132 |
fi |
|---|
| 133 |
|
|---|
| 134 |
export BEDEWORK_CONFIGS_HOME=$BWCONFIGS |
|---|
| 135 |
export BEDEWORK_CONFIG=$BWCONFIGS/$bwc |
|---|
| 136 |
|
|---|
| 137 |
if [ ! -f "$BEDEWORK_CONFIG/build.properties" ] ; then |
|---|
| 138 |
errorUsage "Configuration $BEDEWORK_CONFIG does not exist or is not a bedework configuration." |
|---|
| 139 |
fi |
|---|
| 140 |
|
|---|
| 141 |
# Make available for ant |
|---|
| 142 |
export BWCONFIG="-Dorg.bedework.user.build.properties=$BEDEWORK_CONFIG/build.properties" |
|---|
| 143 |
|
|---|
| 144 |
echo "BWCONFIGS=$BWCONFIGS" |
|---|
| 145 |
echo "BWCONFIG=$BWCONFIG" |
|---|
| 146 |
|
|---|
| 147 |
CLASSPATH=$ANT_HOME/lib/ant-launcher.jar |
|---|
| 148 |
CLASSPATH=$CLASSPATH:$QUICKSTART_HOME/bedework/build/quickstart/antlib |
|---|
| 149 |
CLASSPATH=$CLASSPATH:$QUICKSTART_HOME/bedework/applib/log4j-1.2.8.jar |
|---|
| 150 |
|
|---|
| 151 |
|
|---|
| 152 |
if [ "$carddav" != "" ] ; then |
|---|
| 153 |
cd $QUICKSTART_HOME/bedework-carddav |
|---|
| 154 |
fi |
|---|
| 155 |
|
|---|
| 156 |
$JAVA_HOME/bin/java -classpath $CLASSPATH $ant_xmllogfile $offline -Dant.home=$ANT org.apache.tools.ant.launch.Launcher $BWCONFIG $ant_listener $ant_logger $* |
|---|