root/trunk/build/quickstart/linux/bw

Revision 3170 (checked in by douglm, 2 years ago)

Further changes to the build process.

This allows virtual hosts to be set in the config file for carddav.

Carddav configuration is now rolled into the same config files as the other projects

Small change to webdav error logging

  • Property svn:mergeinfo set to
  • Property svn:executable set to *
Line 
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 ant_loglevel="-quiet"
20 bw_loglevel=""
21
22 echo ""
23 echo "  Bedework Calendar System"
24 echo "  ------------------------"
25 echo ""
26
27 PRG="$0"
28
29 usage() {
30   echo "  $PRG [CONFIG-SOURCE] [CONFIG] [PROJECT] [ -offline ] [LOG_LEVEL] [ target ] "
31   echo "  $PRG ACTION"
32   echo ""
33   echo " where:"
34   echo ""
35   echo "   CONFIG-SOURCE optionally defines the location of configurations and"
36   echo "                 is one or none of  "
37   echo "     -quickstart    to use the configurations within the quickstart"
38   echo "     -bwchome path  to specify the location of the bwbuild directory"
39   echo "   The default is to look in the user home for the bwbuild directory."
40   echo ""
41   echo "   CONFIG optionally defines the configuration to build"
42   echo "      -bwc configname"
43   echo ""
44   echo "   -offline     Build without attempting to retrieve library jars"
45   echo ""
46   echo "   LOG_LEVEL sets the level of logging and can be"
47   echo "      -log-silent   Nearly silent"
48   echo "      -log-quiet    The default"
49   echo "      -log-inform   A little more noisy"
50   echo "      -log-verbose  Noisier"
51   echo "      -ant-debug    Vast amounts of ant output"
52   echo "      -build-debug  Some bedework build debug output"
53   echo ""
54   echo "   target       Ant target to execute"
55   echo ""
56   echo "   PROJECT optionally defines the package to build and is none or more of"
57   echo "     -carddav     Target is for the CardDAV build"
58   echo "     -exsynch     Target is for the Exchange synch build"
59   echo "     -client      Target is for the bedework client application build"
60   echo "     -monitor     Target is for the bedework monitor application"
61   echo "     -naming      Target is for the abstract naming api"
62   echo "     -tzsvr       Target is for the timezones server build"
63   echo "     The default is a calendar build"
64   echo ""
65   echo "     -carddav deploy-addrbook    To deploy the Javascript Addressbook client."
66   echo ""
67   echo "   Invokes ant to build or deploy the Bedework system. Uses a configuration"
68   echo "   directory which contains one directory per configuration."
69   echo ""
70   echo "   Within each configuration directory we expect a file called build.properties"
71   echo "   which should point to the property and options file needed for the deploy process"
72   echo ""
73   echo "   In general these files will be in the same directory as build.properties."
74   echo "   The environment variable BEDEWORK_CONFIG contains the path to the current"
75   echo "   configuration directory and can be used to build a path to the other files."
76   echo ""
77   echo "   ACTION defines an action to take usually in the context of the quickstart."
78   echo "    In a deployed system many of these actions are handled directly by a"
79   echo "    deployed application. ACTION may be one of"
80   echo "      -reindex    runs the indexer directly out of the quickstart bedework"
81   echo "                  dist directory to rebuild the lucene indexes"
82   echo "      -zoneinfo   builds zoneinfo data for the timezones server"
83   echo "                  requires -version and -tzdata parameters.   NOTE: build depends on glib2"
84   echo "      -buildwebcache     builds webcache"
85   echo "      -deploywebcache    deploys webcache"
86   echo "      -deployurlbuilder  deploys url/widget builder"
87   echo ""
88 }
89
90 errorUsage() {
91   echo "*******************************************************************************************"
92   echo "Error: $1"
93   echo "*******************************************************************************************"
94   echo
95   echo "Sleeping 5 seconds before displaying usage. Safe to ctrl-C."
96   sleep 5
97   echo ""
98   usage
99   exit 1
100 }
101
102 # ----------------------------------------------------------------------------
103 # Reindex the data
104 # ----------------------------------------------------------------------------
105 actionReindex() {
106   INDEXER=$QUICKSTART_HOME/bedework/dist/temp/shellscr/indexer
107  
108         if [ ! -d "$INDEXER" ] ; then
109           errorUsage "The indexer directory $INDEXER does not exist. You probably need to do a rebuild."
110         fi
111
112   cd $INDEXER
113   chmod +x bwrun
114   ./bwrun reindex-nostart -user admin -indexlocprefix ../../../../../
115  
116   exit 0
117 }
118
119 usageZoneinfo() {
120   echo ""
121   echo "$PRG -zoneinfo -version VERSION -tzdata path-to-data"
122   echo "for example:"
123   echo "$PRG -zoneinfo -version 2010m -tzdata /data/olson/tzdata2010m.tar.gz"
124   exit 1
125 }
126
127 # ----------------------------------------------------------------------------
128 # Build zoneinfo - require -version -tzdata
129 # tzdata file can be obtained via http://www.twinsun.com/tz/tz-link.htm or
130 # more directly from ftp://elsie.nci.nih.gov/pub/
131 # The version parameter value should be the version code from the tzdata name
132 # ----------------------------------------------------------------------------
133 actionZoneinfo() {
134   bwtzsvr="$QUICKSTART_HOME/bwtzsvr"
135   bwresources="$bwtzsvr/resources"
136
137   shift
138  
139   if [ "$1" != "-version" ] ; then
140     echo "got $1"
141     echo "Must supply -version parameter for -zoneinfo"
142     usageZoneinfo
143   fi
144  
145   shift
146     echo "got $1"
147 #  version="-Dorg.bedework.timezones.version=$1"
148   version=$1
149   shift
150  
151   if [ "$1" != "-tzdata" ] ; then
152     echo "Must supply -tzdata parameter for -zoneinfo"
153     usageZoneinfo
154   fi
155  
156   shift
157 #  tzdata="-Dorg.bedework.timezones.data=$1"
158   tzdata=$1
159   shift
160  
161   rm -rf /tmp/bedework
162   mkdir /tmp/bedework
163   mkdir /tmp/bedework/timezones
164  
165   cd /tmp/bedework/timezones
166  
167   wget http://bedework.org/downloads/lib/vzic-1.3.tgz
168   gunzip vzic-1.3.tgz
169   tar -xf vzic-1.3.tar
170
171 # copy and unpack the data
172   mkdir olsondata
173   cd olsondata
174   cp $tzdata tzdata.tar.gz
175   gunzip tzdata.tar.gz
176   tar -xf tzdata.tar
177   rm tzdata.tar
178   cd ..
179  
180 # Replace lines in the makefile. Sure real unix types can do better 
181  
182   cd vzic-1.3
183  
184   sed "s/\(^OLSON_DIR = \)\(..*$\)/\1\/tmp\/bedework\/timezones\/olsondata/" Makefile > Makefile1
185
186   sed "s/\(^PRODUCT_ID = \)\(..*$\)/\1\/bedework.org\/\/NONSGML Bedework\/\/EN/" Makefile1 > Makefile2
187
188   sed "s/\(^TZID_PREFIX = \)\(..*$\)/\1/" Makefile2 > Makefile
189  
190   make
191  
192 # omit the pure for allegedly better outlook compatability -
193 # but not altogether correct timezones 
194   ./vzic --pure
195
196   cd ..
197  
198   mkdir tzdata
199   cp -r vzic-1.3/zoneinfo tzdata
200   cp $bwresources/aliases.txt tzdata
201  
202   cd tzdata
203  
204   echo "version=$version" > info.txt
205   date +buildTime=%D-%T-%N >> info.txt
206  
207   zip -r tzdata *
208  
209   cp tzdata.zip $bwtzsvr/
210  
211   echo ""
212   echo "------------------------------------------------------------------------------"
213   echo "tzdata.zip has been built and is at $bwtzsvr/tzdata.zip"
214   echo "------------------------------------------------------------------------------"
215   echo ""
216  
217   exit 0
218 }
219
220 if [ -z "$JAVA_HOME" -o ! -d "$JAVA_HOME" ] ; then
221   errorUsage "JAVA_HOME is not defined correctly for bedework."
222 fi
223
224 saveddir=`pwd`
225
226 trap 'cd $saveddir' 0
227 trap "exit 2" 1 2 3 15
228
229 export QUICKSTART_HOME=$saveddir
230
231 CLASSPATH=$ANT_HOME/lib/ant-launcher.jar
232 CLASSPATH=$CLASSPATH:$QUICKSTART_HOME/bedework/build/quickstart/antlib
233 #CLASSPATH=$CLASSPATH:$QUICKSTART_HOME/bedework/applib/log4j-1.2.8.jar
234
235 # Default some parameters
236
237 BWCONFIGS=
238 bwc=default
239 BWCONFIG=
240 offline=
241 quickstart=
242
243 # Projects we will build
244 pkgdefault=yes
245 bedework=
246 bwxmlschema=
247 carddav=
248 caldav=
249 client=
250 exsynch=
251 monitor=
252 naming=
253 tzsvr=
254 webdav=
255
256 action=
257
258 if [ "$1" = "" ] ; then
259   usage
260   exit 1
261 fi
262
263 # look for actions first
264
265 if [ "$1" = "-reindex" ] ; then
266   actionReindex
267 fi
268
269 if [ "$1" = "-zoneinfo" ] ; then
270   actionZoneinfo $*
271 fi
272
273 if [ "$1" = "-buildwebcache" ] ; then
274   cd $QUICKSTART_HOME/cachedfeeder
275   ./buildWebCache
276   exit
277 fi
278
279 if [ "$1" = "-deploywebcache" ] ; then
280   cd $QUICKSTART_HOME/cachedfeeder
281   $JAVA_HOME/bin/java -classpath $CLASSPATH $ant_xmllogfile -Dant.home=$ANT_HOME org.apache.tools.ant.launch.Launcher \
282                  $BWCONFIG $ant_listener $ant_logger $ant_loglevel $bw_loglevel deploy-webcache
283   exit
284 fi
285
286 if [ "$1" = "-deployurlbuilder" ] ; then
287   cd $QUICKSTART_HOME/cachedfeeder
288   $JAVA_HOME/bin/java -classpath $CLASSPATH $ant_xmllogfile -Dant.home=$ANT_HOME org.apache.tools.ant.launch.Launcher \
289                  $BWCONFIG $ant_listener $ant_logger $ant_loglevel $bw_loglevel deploy-urlbuilder
290   exit
291 fi
292
293 while [ "$1" != "" ]
294 do
295   # Process the next arg
296   case $1       # Look at $1
297   in
298     -bwchome)         # Define location of configs
299       shift
300       BWCONFIGS="$1"
301       shift
302       ;;
303     -quickstart)
304       quickstart="yes"
305       shift
306       ;;
307     -usage | -help | -? | ?)
308       usage
309       exit
310       shift
311       ;;
312     -bwc)
313       shift
314       bwc="$1"
315       shift
316       ;;
317     -offline)
318       offline="-Dorg.bedework.offline.build=yes"
319       shift
320       ;;
321 # ----------------------- Log level       
322     -log-silent)
323       ant_loglevel="-quiet"
324       bw_loglevel="-Dorg.bedework.build.silent=true"
325       shift
326       ;;
327     -log-quiet)
328       ant_loglevel="-quiet"
329       bw_loglevel=""
330       shift
331       ;;
332     -log-inform)
333       ant_loglevel=""
334       bw_loglevel="-Dorg.bedework.build.inform=true"
335       shift
336       ;;
337     -log-verbose)
338       ant_loglevel="-verbose"
339       bw_loglevel="-Dorg.bedework.build.inform=true -Dorg.bedework.build.noisy=true"
340       shift
341       ;;
342     -ant-debug)
343       ant_loglevel="-debug"
344       shift
345       ;;
346     -build-debug)
347       bw_loglevel="-Dorg.bedework.build.inform=true -Dorg.bedework.build.noisy=true -Dorg.bedework.build.debug=true "
348       shift
349       ;;
350 # ------------------------Projects
351     -bwxml)
352       bwxmlschema="yes"
353       pkgdefault=
354       shift
355       ;;
356     -carddav)
357       carddav="yes"
358       pkgdefault=
359       shift
360       ;;
361     -caldav)
362       caldav="yes"
363       pkgdefault=
364       shift
365       ;;
366     -client)
367       client="yes"
368       pkgdefault=
369       shift
370       ;;
371     -exsynch)
372       exsynch="yes"
373       pkgdefault=
374       shift
375       ;;
376     -webdav)
377       webdav="yes"
378       pkgdefault=
379       shift
380       ;;
381     -monitor)
382       monitor="yes"
383       pkgdefault=
384       shift
385       ;;
386     -naming)
387       naming="yes"
388       pkgdefault=
389       shift
390       ;;
391     -tzsvr)
392       tzsvr="yes"
393       pkgdefault=
394       shift
395       ;;
396     -*)
397       usage
398       exit 1
399       ;;
400     *)
401       # Assume we've reached the target(s)
402       break
403       ;;
404   esac
405 done
406
407 if [ "$quickstart" != "" ] ; then
408   if [ "$BWCONFIGS" != "" ] ; then
409     errorUsage "Cannot specify both -quickstart and -bwchome"
410   fi
411   if [ "$bwc" = "jboss" ] ; then
412         errorUsage "The jboss configuration has been removed from the quickstart.  It is now the default.  Remove the '-bwc jboss' option."
413   fi
414
415   BWCONFIGS=$QUICKSTART_HOME/bedework/config/bwbuild
416 elif [ "$BWCONFIGS" = "" ] ; then
417   BWCONFIGS=$HOME/bwbuild
418 fi
419
420 export BEDEWORK_CONFIGS_HOME=$BWCONFIGS
421 export BEDEWORK_CONFIG=$BWCONFIGS/$bwc
422
423 if [ ! -d "$BEDEWORK_CONFIGS_HOME/.platform" ] ; then
424   errorUsage "Configurations directory $BEDEWORK_CONFIGS_HOME is missing directory '.platform'."
425 fi
426
427 if [ ! -f "$BEDEWORK_CONFIG/build.properties" ] ; then
428   errorUsage "Configuration $BEDEWORK_CONFIG does not exist or is not a bedework configuration."
429 fi
430
431 # Make available for ant
432 export BWCONFIG="-Dorg.bedework.user.build.properties=$BEDEWORK_CONFIG/build.properties"
433
434 echo "BWCONFIGS=$BWCONFIGS"
435 echo "BWCONFIG=$BWCONFIG"
436
437 if [ "$bwxmlschema" != "" ] ; then
438   cd $QUICKSTART_HOME/bwxml-schema
439 fi
440
441 if [ "$caldav" != "" ] ; then
442   cd $QUICKSTART_HOME/bedework/projects/caldav
443 fi
444
445 if [ "$carddav" != "" ] ; then
446   cd $QUICKSTART_HOME/bedework-carddav
447 fi
448
449 if [ "$client" != "" ] ; then
450   cd $QUICKSTART_HOME/bwclient
451 fi
452
453 if [ "$exsynch" != "" ] ; then
454   cd $QUICKSTART_HOME/exchgsynch
455 fi
456
457 if [ "$monitor" != "" ] ; then
458   cd $QUICKSTART_HOME/MonitorApp
459 fi
460
461 if [ "$naming" != "" ] ; then
462   cd $QUICKSTART_HOME/bwnaming
463 fi
464
465 if [ "$tzsvr" != "" ] ; then
466   cd $QUICKSTART_HOME/bwtzsvr
467 fi
468
469 if [ "$webdav" != "" ] ; then
470   cd $QUICKSTART_HOME/bedework/projects/webdav
471 fi
472
473 $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 $*
Note: See TracBrowser for help on using the browser.