#! /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= ant_loglevel="-quiet" bw_loglevel="" # Projects we need to update updateProjects="bwxml bedework bedework-carddav bwtzsvr cachedfeeder" echo "" echo " Bedework Calendar System" echo " ------------------------" echo "" PRG="$0" usage() { echo " $PRG ACTION" echo " $PRG [CONFIG-SOURCE] [CONFIG] [PROJECT] [ -offline ] [LOG_LEVEL] [ target ] " echo "" echo " where:" 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 " -updateall Does an svn update of all projects" echo " -zoneinfo builds zoneinfo data for the timezones server" echo " requires -version and -tzdata parameters. " echo " NOTE: build depends on glib2 and only works on Linux/Unix" echo " -buildwebcache builds webcache" echo " -deploywebcache deploys webcache" echo " -deployurlbuilder deploys url/widget builder" 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 "" echo " LOG_LEVEL sets the level of logging and can be" echo " -log-silent Nearly silent" echo " -log-quiet The default" echo " -log-inform A little more noisy" echo " -log-verbose Noisier" echo " -ant-debug Vast amounts of ant output" echo " -build-debug Some bedework build debug output" echo "" echo " target Ant target to execute" echo "" echo " PROJECT optionally defines the package to build and is one of" echo " the core, ancillary or experimental targets below:" echo "" echo " Core projects: required for a functioning system" echo " -bwxml Target is for the Bedework XML schemas build" echo " (usually built automatically be dependent projects" echo " -carddav Target is for the CardDAV build" echo " -carddav deploy-addrbook To deploy the Javascript Addressbook client." echo " -tzsvr Target is for the timezones server build" echo " Ancillary projects: not required" echo " -monitor Target is for the bedework monitor application" echo " Experimental projects: no guarantees" echo " -client Target is for the bedework client application build" echo " -exsynch Target is for the Exchange synch build" echo " -naming Target is for the abstract naming api" 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 "" } errorUsage() { echo "*******************************************************************************************" echo "Error: $1" echo "*******************************************************************************************" echo echo "Sleeping 5 seconds before displaying usage. Safe to ctrl-C." sleep 5 echo "" usage exit 1 } # ---------------------------------------------------------------------------- # Update the projects # ---------------------------------------------------------------------------- actionUpdateall() { for project in $updateProjects do echo "*********************************************************************" echo "Updating project $project" echo "*********************************************************************" svn update $project done exit 0 } usageZoneinfo() { echo "" echo "$PRG -zoneinfo -version VERSION -tzdata path-to-data" echo "for example:" echo "$PRG -zoneinfo -version 2010m -tzdata /data/olson/tzdata2010m.tar.gz" exit 1 } # ---------------------------------------------------------------------------- # Build zoneinfo - require -version -tzdata # tzdata file can be obtained via http://www.twinsun.com/tz/tz-link.htm or # more directly from ftp://elsie.nci.nih.gov/pub/ # The version parameter value should be the version code from the tzdata name # ---------------------------------------------------------------------------- actionZoneinfo() { bwtzsvr="$QUICKSTART_HOME/bwtzsvr" bwresources="$bwtzsvr/resources" 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 $bwresources/aliases.txt tzdata cd tzdata echo "version=$version" > info.txt date +buildTime=%D-%T-%N >> info.txt zip -r tzdata * cp tzdata.zip $bwtzsvr/ echo "" echo "------------------------------------------------------------------------------" echo "tzdata.zip has been built and is at $bwtzsvr/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 # Default some parameters BWCONFIGS= bwc=default BWCONFIG= offline= quickstart= # Projects we will build pkgdefault=yes bedework= bwxml= carddav= caldav= client= exsynch= monitor= naming= tzsvr= webdav= action= if [ "$1" = "" ] ; then usage exit 1 fi # look for actions first if [ "$1" = "-updateall" ] ; then actionUpdateall 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 $JAVA_HOME/bin/java -classpath $CLASSPATH $ant_xmllogfile -Dant.home=$ANT_HOME org.apache.tools.ant.launch.Launcher \ $BWCONFIG $ant_listener $ant_logger $ant_loglevel $bw_loglevel deploy-webcache exit fi if [ "$1" = "-deployurlbuilder" ] ; then cd $QUICKSTART_HOME/cachedfeeder $JAVA_HOME/bin/java -classpath $CLASSPATH $ant_xmllogfile -Dant.home=$ANT_HOME org.apache.tools.ant.launch.Launcher \ $BWCONFIG $ant_listener $ant_logger $ant_loglevel $bw_loglevel deploy-urlbuilder 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 ;; # ----------------------- Log level -log-silent) ant_loglevel="-quiet" bw_loglevel="-Dorg.bedework.build.silent=true" shift ;; -log-quiet) ant_loglevel="-quiet" bw_loglevel="" shift ;; -log-inform) ant_loglevel="" bw_loglevel="-Dorg.bedework.build.inform=true" shift ;; -log-verbose) ant_loglevel="-verbose" bw_loglevel="-Dorg.bedework.build.inform=true -Dorg.bedework.build.noisy=true" shift ;; -ant-debug) ant_loglevel="-debug" shift ;; -build-debug) bw_loglevel="-Dorg.bedework.build.inform=true -Dorg.bedework.build.noisy=true -Dorg.bedework.build.debug=true " shift ;; # ------------------------Projects -bwxml) bwxml="yes" pkgdefault= shift ;; -carddav) carddav="yes" pkgdefault= shift ;; -caldav) caldav="yes" pkgdefault= shift ;; -client) client="yes" pkgdefault= shift ;; -exsynch) exsynch="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 if [ "$bwc" = "jboss" ] ; then errorUsage "The jboss configuration has been removed from the quickstart. It is now the default. Remove the '-bwc jboss' option." 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 [ ! -d "$BEDEWORK_CONFIGS_HOME/.platform" ] ; then errorUsage "Configurations directory $BEDEWORK_CONFIGS_HOME is missing directory '.platform'." fi 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 [ "$bwxml" != "" ] ; then cd $QUICKSTART_HOME/bwxml fi 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 [ "$exsynch" != "" ] ; then cd $QUICKSTART_HOME/exchgsynch 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 $ant_loglevel $bw_loglevel $*