#! /bin/sh # # This file is included by the quickstart script file "bw" so that it can live # within the svn repository. # ANT_HOME=`dirname "$PRG"`/apache-ant-1.7.0 ANT_HOME=`cd "$ANT_HOME" && pwd` #ant_listener="-listener org.apache.tools.ant.listener.Log4jListener" #ant_xmllogfile="-DXmlLogger.file=log.xml" #ant_logger="-logger org.apache.tools.ant.XmlLogger" ant_listener= ant_xmllogfile= ant_logger= echo "" echo " Bedework Calendar System" echo " ------------------------" echo "" PRG="$0" usage() { echo " $PRG [CONFIG-SOURCE] [CONFIG] [PROJECT] [ -offline ] [ target ] " echo " $PRG ACTION" echo "" echo " where:" echo "" echo " CONFIG-SOURCE optionally defines the location of configurations and" echo " is one or none of " echo " -quickstart to use the configurations within the quickstart" echo " -bwchome path to specify the location of the bwbuild directory" echo " The default is to look in the user home for the bwbuild directory." echo "" echo " CONFIG optionally defines the configuration to build" echo " -bwc configname" echo "" echo " -offline Build without attempting to retrieve library jars" echo " target Ant target to execute" echo "" echo "" echo "" echo " PROJECT optionally defines the package to build and is none or more of" echo " -carddav Target is for the CardDAV build" echo " -client Target is for the bedework client application build" echo " -monitor Target is for the bedework monitor application" echo " -naming Target is for the abstract naming api" echo " -tzsvr Target is for the timezones server build" echo " The default is a calendar build" echo "" echo " Invokes ant to build or deploy the Bedework system. Uses a configuration" echo " directory which contains one directory per configuration." echo "" echo " Within each configuration directory we expect a file called build.properties" echo " which should point to the property and options file needed for the deploy process" echo "" echo " In general these files will be in the same directory as build.properties." echo " The environment variable BEDEWORK_CONFIG contains the path to the current" echo " configuration directory and can be used to build a path to the other files." echo "" echo " ACTION defines an action to take usually in the context of the quickstart." echo " In a deployed system many of these actions are handled directly by a" echo " deployed application. ACTION may be one of" echo " -reindex runs the indexer directly out of the quickstart bedework" echo " dist directory to rebuild the lucene indexes" echo " -zoneinfo builds zoneinfo data for the timezomnes server" echo " requires -version and -tzdata parameters " echo " -buildwebcache builds webcache" echo " -deploywebcache deploys webcache" echo " -deployurlbuilder deploys url/widget builder" echo "" } errorUsage() { echo "*******************************************************" echo "Error: $1" echo "*******************************************************" usage exit 1 } # ---------------------------------------------------------------------------- # Reindex the data # ---------------------------------------------------------------------------- actionReindex() { INDEXER=$QUICKSTART_HOME/bedework/dist/temp/shellscr/indexer if [ ! -d "$INDEXER" ] ; then errorUsage "The indexer directory $INDEXER does not exist. You probably need to do a rebuild." fi cd $INDEXER chmod +x bwrun ./bwrun reindex-nostart -user admin -indexlocprefix ../../../../../ exit 0 } usageZoneinfo() { echo "" echo "$PRG -zoneinfo -version VERSION -tzdata path-to-data" exit 1 } # ---------------------------------------------------------------------------- # Build zoneinfo - require -version -tzdata # ---------------------------------------------------------------------------- actionZoneinfo() { shift if [ "$1" != "-version" ] ; then echo "got $1" echo "Must supply -version parameter for -zoneinfo" usageZoneinfo fi shift echo "got $1" # version="-Dorg.bedework.timezones.version=$1" version=$1 shift if [ "$1" != "-tzdata" ] ; then echo "Must supply -tzdata parameter for -zoneinfo" usageZoneinfo fi shift # tzdata="-Dorg.bedework.timezones.data=$1" tzdata=$1 shift rm -rf /tmp/bedework mkdir /tmp/bedework mkdir /tmp/bedework/timezones cd /tmp/bedework/timezones wget http://bedework.org/downloads/lib/vzic-1.3.tgz gunzip vzic-1.3.tgz tar -xf vzic-1.3.tar # copy and unpack the data mkdir olsondata cd olsondata cp $tzdata tzdata.tar.gz gunzip tzdata.tar.gz tar -xf tzdata.tar rm tzdata.tar cd .. # Replace lines in the makefile. Sure real unix types can do better cd vzic-1.3 sed "s/\(^OLSON_DIR = \)\(..*$\)/\1\/tmp\/bedework\/timezones\/olsondata/" Makefile > Makefile1 sed "s/\(^PRODUCT_ID = \)\(..*$\)/\1\/bedework.org\/\/NONSGML Bedework\/\/EN/" Makefile1 > Makefile2 sed "s/\(^TZID_PREFIX = \)\(..*$\)/\1/" Makefile2 > Makefile make # omit the pure for allegedly better outlook compatability - # but not altogether correct timezones ./vzic --pure cd .. mkdir tzdata cp -r vzic-1.3/zoneinfo tzdata cp $QUICKSTART_HOME/bedework/projects/bwtzsvr/resources/aliases.txt tzdata cd tzdata echo "version=$version" > info.txt date +buildTime=%D-%T-%N >> info.txt zip -r tzdata * cp tzdata.zip $QUICKSTART_HOME echo "" echo "------------------------------------------------------------------------------" echo "tzdata.zip has been built and is at $QUICKSTART_HOME/tzdata.zip" echo "------------------------------------------------------------------------------" echo "" exit 0 } if [ -z "$JAVA_HOME" -o ! -d "$JAVA_HOME" ] ; then errorUsage "JAVA_HOME is not defined correctly for bedework." fi saveddir=`pwd` trap 'cd $saveddir' 0 trap "exit 2" 1 2 3 15 export QUICKSTART_HOME=$saveddir CLASSPATH=$ANT_HOME/lib/ant-launcher.jar CLASSPATH=$CLASSPATH:$QUICKSTART_HOME/bedework/build/quickstart/antlib #CLASSPATH=$CLASSPATH:$QUICKSTART_HOME/bedework/applib/log4j-1.2.8.jar # Default some parameters BWCONFIGS= bwc=default BWCONFIG= offline= quickstart= # Projects we will build pkgdefault=yes bedework= carddav= caldav= client= monitor= naming= tzsvr= webdav= action= if [ "$1" = "" ] ; then usage exit 1 fi # look for actions first if [ "$1" = "-reindex" ] ; then actionReindex fi if [ "$1" = "-zoneinfo" ] ; then actionZoneinfo $* fi if [ "$1" = "-buildwebcache" ] ; then cd $QUICKSTART_HOME/cachedfeeder ./buildWebCache exit fi if [ "$1" = "-deploywebcache" ] ; then cd $QUICKSTART_HOME/cachedfeeder ./deployWebCache exit fi if [ "$1" = "-deployurlbuilder" ] ; then cd $QUICKSTART_HOME/cachedfeeder ./deployUrlBuilder exit fi while [ "$1" != "" ] do # Process the next arg case $1 # Look at $1 in -bwchome) # Define location of configs shift BWCONFIGS="$1" shift ;; -quickstart) quickstart="yes" shift ;; -usage | -help | -? | ?) usage exit shift ;; -bwc) shift bwc="$1" shift ;; -offline) offline="-Dorg.bedework.offline.build=yes" shift ;; # Projects -carddav) carddav="yes" pkgdefault= shift ;; -caldav) caldav="yes" pkgdefault= shift ;; -client) client="yes" pkgdefault= shift ;; -webdav) webdav="yes" pkgdefault= shift ;; -monitor) monitor="yes" pkgdefault= shift ;; -naming) naming="yes" pkgdefault= shift ;; -tzsvr) tzsvr="yes" pkgdefault= shift ;; -*) usage exit 1 ;; *) # Assume we've reached the target(s) break ;; esac done if [ "$quickstart" != "" ] ; then if [ "$BWCONFIGS" != "" ] ; then errorUsage "Cannot specify both -quickstart and -bwchome" fi BWCONFIGS=$QUICKSTART_HOME/bedework/config/bwbuild elif [ "$BWCONFIGS" = "" ] ; then BWCONFIGS=$HOME/bwbuild fi export BEDEWORK_CONFIGS_HOME=$BWCONFIGS export BEDEWORK_CONFIG=$BWCONFIGS/$bwc if [ ! -f "$BEDEWORK_CONFIG/build.properties" ] ; then errorUsage "Configuration $BEDEWORK_CONFIG does not exist or is not a bedework configuration." fi # Make available for ant export BWCONFIG="-Dorg.bedework.user.build.properties=$BEDEWORK_CONFIG/build.properties" echo "BWCONFIGS=$BWCONFIGS" echo "BWCONFIG=$BWCONFIG" if [ "$caldav" != "" ] ; then cd $QUICKSTART_HOME/bedework/projects/caldav fi if [ "$carddav" != "" ] ; then cd $QUICKSTART_HOME/bedework-carddav fi if [ "$client" != "" ] ; then cd $QUICKSTART_HOME/bwclient fi if [ "$monitor" != "" ] ; then cd $QUICKSTART_HOME/MonitorApp fi if [ "$naming" != "" ] ; then cd $QUICKSTART_HOME/bwnaming fi if [ "$tzsvr" != "" ] ; then cd $QUICKSTART_HOME/bwtzsvr fi if [ "$webdav" != "" ] ; then cd $QUICKSTART_HOME/bedework/projects/webdav fi $JAVA_HOME/bin/java -classpath $CLASSPATH $ant_xmllogfile $offline -Dant.home=$ANT_HOME org.apache.tools.ant.launch.Launcher $BWCONFIG $ant_listener $ant_logger $*