root/trunk/build/quickstart/linux/bw

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

Move a number of property files into a common subdirectory of the configs.

Include the overrides first from the actual config and then the common properties.

  • 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 # Projects we need to update
23 updateProjects="bwxml rpiutil access davutil webdav caldav bedework bedework-carddav bwtzsvr cachedfeeder"
24
25 # Projects we will build - pkgdefault (bedework) is built if nothing specified
26 pkgdefault=yes
27 access=
28 bedework=
29 bwtools=
30 bwxml=
31 caldav=
32 caldavTest=
33 carddav=
34 catsvr=
35 client=
36 davutil=
37 monitor=
38 naming=
39 rpiutil=
40 synch=
41 testsuite=
42 tzsvr=
43 webdav=
44
45 # Special targets - avoiding dependencies
46
47 dirstart=
48
49 specialTarget=
50
51 echo ""
52 echo "  Bedework Calendar System"
53 echo "  ------------------------"
54 echo ""
55
56 PRG="$0"
57
58 usage() {
59   echo "  $PRG ACTION"
60   echo "  $PRG [CONFIG-SOURCE] [CONFIG] [PROJECT] [ -offline ] [LOG_LEVEL] [ target ] "
61   echo ""
62   echo " where:"
63   echo ""
64   echo "   ACTION defines an action to take usually in the context of the quickstart."
65   echo "    In a deployed system many of these actions are handled directly by a"
66   echo "    deployed application. ACTION may be one of"
67   echo "      -updateall  Does an svn update of all projects"
68   echo "      -zoneinfo   builds zoneinfo data for the timezones server"
69   echo "                  requires -version and -tzdata parameters.   "
70   echo "                  NOTE: build depends on glib2 and only works on Linux/Unix"
71   echo "      -buildwebcache     builds webcache"
72   echo "      -deploywebcache    deploys webcache"
73   echo "      -deployurlbuilder  deploys url/widget builder"
74   echo ""
75   echo "   CONFIG-SOURCE optionally defines the location of configurations and"
76   echo "                 is one or none of  "
77   echo "     -quickstart    to use the configurations within the quickstart"
78   echo "     -bwchome path  to specify the location of the bwbuild directory"
79   echo "   The default is to look in the user home for the bwbuild directory."
80   echo ""
81   echo "   CONFIG optionally defines the configuration to build"
82   echo "      -bwc configname"
83   echo ""
84   echo "   -offline     Build without attempting to retrieve library jars"
85   echo ""
86   echo "   LOG_LEVEL sets the level of logging and can be"
87   echo "      -log-silent   Nearly silent"
88   echo "      -log-quiet    The default"
89   echo "      -log-inform   A little more noisy"
90   echo "      -log-verbose  Noisier"
91   echo "      -ant-debug    Vast amounts of ant output"
92   echo "      -build-debug  Some bedework build debug output"
93   echo ""
94   echo "   target       Ant target to execute"
95   echo ""
96   echo "   PROJECT optionally defines the package to build and is one of"
97   echo "           the core, ancillary or experimental targets below:"
98   echo ""
99   echo "   Core projects: required for a functioning system"
100   echo "     -access      Target is for the access classes"
101   echo "     -bwxml       Target is for the Bedework XML schemas build"
102   echo "                       (usually built automatically be dependent projects"
103   echo "     -caldav      Target is for the CalDAV build"
104   echo "     -carddav     Target is for the CardDAV build"
105   echo "     -carddav deploy-addrbook    To deploy the Javascript Addressbook client."
106   echo "     -davutil     Target is for the Bedework dav util classes"
107   echo "     -rpiutil     Target is for the Bedework util classes"
108   echo "     -tzsvr       Target is for the timezones server build"
109   echo "     -webdav      Target is for the WebDAV build"
110   echo "   Ancillary projects: not required"
111   echo "     -bwtools     Target is for the Bedework tools build"
112   echo "     -caldavTest  Target is for the CalDAV Test build"
113   echo "     -monitor     Target is for the bedework monitor application"
114   echo "     -testsuite   Target is for the bedework test suite"
115   echo "   Experimental projects: no guarantees"
116   echo "     -catsvr      Target is for the Catsvr build"
117   echo "     -client      Target is for the bedework client application build"
118   echo "     -synch       Target is for the synch build"
119   echo "     -naming      Target is for the abstract naming api"
120   echo "     The default is a calendar build"
121   echo ""
122   echo "   Invokes ant to build or deploy the Bedework system. Uses a configuration"
123   echo "   directory which contains one directory per configuration."
124   echo ""
125   echo "   Within each configuration directory we expect a file called build.properties"
126   echo "   which should point to the property and options file needed for the deploy process"
127   echo ""
128   echo "   In general these files will be in the same directory as build.properties."
129   echo "   The environment variable BEDEWORK_CONFIG contains the path to the current"
130   echo "   configuration directory and can be used to build a path to the other files."
131   echo ""
132 }
133
134 errorUsage() {
135   echo "*******************************************************************************************"
136   echo "Error: $1"
137   echo "*******************************************************************************************"
138   echo
139   echo "Sleeping 5 seconds before displaying usage. Safe to ctrl-C."
140   sleep 5
141   echo ""
142   usage
143   exit 1
144 }
145
146 # ----------------------------------------------------------------------------
147 # Update the projects
148 # ----------------------------------------------------------------------------
149 actionUpdateall() {
150   for project in $updateProjects
151   do
152     echo "*********************************************************************"
153     echo "Updating project $project"
154     echo "*********************************************************************"
155     svn update $project
156   done
157  
158   exit 0
159 }
160
161 usageZoneinfo() {
162   echo ""
163   echo "$PRG -zoneinfo -version VERSION -tzdata path-to-data"
164   echo "for example:"
165   echo "$PRG -zoneinfo -version 2010m -tzdata /data/olson/tzdata2010m.tar.gz"
166   exit 1
167 }
168
169 # Change to the next project to build. Exit if we're done.
170 # The order below reflects the dependencies
171 setDirectory() {
172     specialTarget=
173    
174 #     Special targets
175         if [ "$dirstart" != "" ] ; then
176           cd $QUICKSTART_HOME
177           specialTarget=dirstart
178       dirstart=
179           return
180         fi
181        
182 #     projects
183         if [ "$bwxml" != "" ] ; then
184           cd $QUICKSTART_HOME/bwxml
185       bwxml=
186           return
187         fi
188        
189         if [ "$rpiutil" != "" ] ; then
190           cd $QUICKSTART_HOME/rpiutil
191       rpiutil=
192           return
193         fi
194        
195         if [ "$access" != "" ] ; then
196           cd $QUICKSTART_HOME/access
197       access=
198           return
199         fi
200        
201         if [ "$davutil" != "" ] ; then
202           cd $QUICKSTART_HOME/davutil
203       davutil=
204           return
205         fi
206        
207         if [ "$webdav" != "" ] ; then
208           cd $QUICKSTART_HOME/webdav
209       webdav=
210           return
211         fi
212        
213         if [ "$caldav" != "" ] ; then
214           cd $QUICKSTART_HOME/caldav
215       caldav=
216           return
217         fi
218        
219         if [ "$caldavTest" != "" ] ; then
220           cd $QUICKSTART_HOME/caldavTest
221       caldavTest=
222           return
223         fi
224        
225         if [ "$carddav" != "" ] ; then
226           cd $QUICKSTART_HOME/bedework-carddav
227       carddav=
228           return
229         fi
230        
231         if [ "$bedework" != "" ] ; then
232           cd $QUICKSTART_HOME
233       bedework=
234           return
235         fi
236        
237         if [ "$catsvr" != "" ] ; then
238           cd $QUICKSTART_HOME/catsvr
239       catsvr=
240           return
241         fi
242        
243         if [ "$client" != "" ] ; then
244           cd $QUICKSTART_HOME/bwclient
245       client=
246           return
247         fi
248        
249         if [ "$monitor" != "" ] ; then
250           cd $QUICKSTART_HOME/MonitorApp
251       monitor=
252           return
253         fi
254        
255         if [ "$naming" != "" ] ; then
256           cd $QUICKSTART_HOME/bwnaming
257       naming=
258           return
259         fi
260        
261         if [ "$synch" != "" ] ; then
262           cd $QUICKSTART_HOME/synch
263       synch=
264           return
265         fi
266        
267         if [ "$testsuite" != "" ] ; then
268           cd $QUICKSTART_HOME/testsuite
269       testsuite=
270           return
271         fi
272        
273         if [ "$tzsvr" != "" ] ; then
274           cd $QUICKSTART_HOME/bwtzsvr
275       tzsvr=
276           return
277         fi
278        
279         if [ "$bwtools" != "" ] ; then
280           cd $QUICKSTART_HOME/bwtools
281       bwtools=
282           return
283         fi
284        
285         exit 0;
286 }
287
288 # ----------------------------------------------------------------------------
289 # Build zoneinfo - require -version -tzdata
290 # tzdata file can be obtained via http://www.twinsun.com/tz/tz-link.htm or
291 # more directly from ftp://elsie.nci.nih.gov/pub/
292 # The version parameter value should be the version code from the tzdata name
293 # ----------------------------------------------------------------------------
294 actionZoneinfo() {
295   bwtzsvr="$QUICKSTART_HOME/bwtzsvr"
296   bwresources="$bwtzsvr/resources"
297
298   shift
299  
300   if [ "$1" != "-version" ] ; then
301     echo "got $1"
302     echo "Must supply -version parameter for -zoneinfo"
303     usageZoneinfo
304   fi
305  
306   shift
307     echo "got $1"
308 #  version="-Dorg.bedework.timezones.version=$1"
309   version=$1
310   shift
311  
312   if [ "$1" != "-tzdata" ] ; then
313     echo "Must supply -tzdata parameter for -zoneinfo"
314     usageZoneinfo
315   fi
316  
317   shift
318 #  tzdata="-Dorg.bedework.timezones.data=$1"
319   tzdata=$1
320   shift
321  
322   rm -rf /tmp/bedework
323   mkdir /tmp/bedework
324   mkdir /tmp/bedework/timezones
325  
326   cd /tmp/bedework/timezones
327  
328   wget http://bedework.org/downloads/lib/vzic-1.3.tgz
329   gunzip vzic-1.3.tgz
330   tar -xf vzic-1.3.tar
331
332 # copy and unpack the data
333   mkdir olsondata
334   cd olsondata
335   cp $tzdata tzdata.tar.gz
336   gunzip tzdata.tar.gz
337   tar -xf tzdata.tar
338   rm tzdata.tar
339   cd ..
340  
341 # Replace lines in the makefile. Sure real unix types can do better 
342  
343   cd vzic-1.3
344  
345   sed "s/\(^OLSON_DIR = \)\(..*$\)/\1\/tmp\/bedework\/timezones\/olsondata/" Makefile > Makefile1
346
347   sed "s/\(^PRODUCT_ID = \)\(..*$\)/\1\/bedework.org\/\/NONSGML Bedework\/\/EN/" Makefile1 > Makefile2
348
349   sed "s/\(^TZID_PREFIX = \)\(..*$\)/\1/" Makefile2 > Makefile
350  
351   make
352  
353 # omit the pure for allegedly better outlook compatability -
354 # but not altogether correct timezones 
355   ./vzic --pure
356
357   cd ..
358  
359   mkdir tzdata
360   cp -r vzic-1.3/zoneinfo tzdata
361   cp $bwresources/aliases.txt tzdata
362  
363   cd tzdata
364  
365   echo "version=$version" > info.txt
366 #  date +buildTime=%D-%T-%N >> info.txt
367   date --utc +buildTime=%Y%m%dT%H%M%SZ >> info.txt
368  
369   zip -r tzdata *
370  
371   cp tzdata.zip $bwtzsvr/dist
372  
373   echo ""
374   echo "------------------------------------------------------------------------------"
375   echo "tzdata.zip has been built and is at $bwtzsvr/tzdata.zip"
376   echo "------------------------------------------------------------------------------"
377   echo ""
378  
379   exit 0
380 }
381
382 if [ -z "$JAVA_HOME" -o ! -d "$JAVA_HOME" ] ; then
383   errorUsage "JAVA_HOME is not defined correctly for bedework."
384 fi
385
386 saveddir=`pwd`
387
388 trap 'cd $saveddir' 0
389 trap "exit 2" 1 2 3 15
390
391 export QUICKSTART_HOME=$saveddir
392
393 CLASSPATH=$ANT_HOME/lib/ant-launcher.jar
394 CLASSPATH=$CLASSPATH:$QUICKSTART_HOME/bedework/build/quickstart/antlib
395
396 # Default some parameters
397
398 BWCONFIGS=
399 bwc=default
400 BWCONFIG=
401 offline=
402 quickstart=
403
404 action=
405
406 if [ "$1" = "" ] ; then
407   usage
408   exit 1
409 fi
410
411 # look for actions first
412
413 if [ "$1" = "-updateall" ] ; then
414   actionUpdateall
415 fi
416
417 if [ "$1" = "-zoneinfo" ] ; then
418   actionZoneinfo $*
419 fi
420
421 if [ "$1" = "-buildwebcache" ] ; then
422   cd $QUICKSTART_HOME/cachedfeeder
423   ./buildWebCache
424   exit
425 fi
426
427 if [ "$1" = "-deploywebcache" ] ; then
428   cd $QUICKSTART_HOME/cachedfeeder
429   $JAVA_HOME/bin/java -classpath $CLASSPATH $ant_xmllogfile -Dant.home=$ANT_HOME org.apache.tools.ant.launch.Launcher \
430                  $BWCONFIG $ant_listener $ant_logger $ant_loglevel $bw_loglevel deploy-webcache
431   exit
432 fi
433
434 if [ "$1" = "-deployurlbuilder" ] ; then
435   cd $QUICKSTART_HOME/cachedfeeder
436   $JAVA_HOME/bin/java -classpath $CLASSPATH $ant_xmllogfile -Dant.home=$ANT_HOME org.apache.tools.ant.launch.Launcher \
437                  $BWCONFIG $ant_listener $ant_logger $ant_loglevel $bw_loglevel deploy-urlbuilder
438   exit
439 fi
440
441 while [ "$1" != "" ]
442 do
443   # Process the next arg
444   case $1       # Look at $1
445   in
446     -bwchome)         # Define location of configs
447       shift
448       BWCONFIGS="$1"
449       shift
450       ;;
451     -quickstart)
452       quickstart="yes"
453       shift
454       ;;
455     -usage | -help | -? | ?)
456       usage
457       exit
458       shift
459       ;;
460     -bwc)
461       shift
462       bwc="$1"
463       shift
464       ;;
465     -offline)
466       offline="-Dorg.bedework.offline.build=yes"
467       shift
468       ;;
469 # ----------------------- Log level       
470     -log-silent)
471       ant_loglevel="-quiet"
472       bw_loglevel="-Dorg.bedework.build.silent=true"
473       shift
474       ;;
475     -log-quiet)
476       ant_loglevel="-quiet"
477       bw_loglevel=""
478       shift
479       ;;
480     -log-inform)
481       ant_loglevel=""
482       bw_loglevel="-Dorg.bedework.build.inform=true"
483       shift
484       ;;
485     -log-verbose)
486       ant_loglevel="-verbose"
487       bw_loglevel="-Dorg.bedework.build.inform=true -Dorg.bedework.build.noisy=true"
488       shift
489       ;;
490     -ant-debug)
491       ant_loglevel="-debug"
492       shift
493       ;;
494     -build-debug)
495       bw_loglevel="-Dorg.bedework.build.inform=true -Dorg.bedework.build.noisy=true -Dorg.bedework.build.debug=true "
496       shift
497       ;;
498 # ------------------------Special targets
499         dirstart)
500           dirstart="yes"
501       pkgdefault=
502       shift
503       ;;
504 # ------------------------Projects
505     -access)
506       access="yes"
507      
508       bwxml="yes"
509       rpiutil="yes"
510       pkgdefault=
511       shift
512       ;;
513     -bwtools)
514       bwtools="yes"
515       pkgdefault=
516       shift
517       ;;
518     -bwxml)
519       bwxml="yes"
520       pkgdefault=
521       shift
522       ;;
523     -caldav)
524       caldav="yes"
525
526       access="yes"
527       bwxml="yes"
528       rpiutil="yes"
529       webdav="yes"
530       pkgdefault=
531       shift
532       ;;
533     -caldavTest)
534       caldavTest="yes"
535
536       access="yes"
537       bwxml="yes"
538       rpiutil="yes"
539       webdav="yes"
540       pkgdefault=
541       shift
542       ;;
543     -carddav)
544       carddav="yes"
545
546       access="yes"
547       bwxml="yes"
548       rpiutil="yes"
549       webdav="yes"
550       pkgdefault=
551       shift
552       ;;
553     -catsvr)
554       catsvr="yes"
555
556       access="yes"
557       bwxml="yes"
558       rpiutil="yes"
559       webdav="yes"
560       pkgdefault=
561       shift
562       ;;
563     -client)
564       client="yes"
565       pkgdefault=
566       shift
567       ;;
568     -davutil)
569       davutil="yes"
570
571       bwxml="yes"
572       rpiutil="yes"
573       pkgdefault=
574       shift
575       ;;
576     -monitor)
577       monitor="yes"
578       pkgdefault=
579       shift
580       ;;
581     -naming)
582       naming="yes"
583       pkgdefault=
584       shift
585       ;;
586     -rpiutil)
587       rpiutil="yes"
588
589       bwxml="yes"
590       pkgdefault=
591       shift
592       ;;
593     -synch)
594       synch="yes"
595      
596       access="yes"
597       bwxml="yes"
598       davutil="yes"
599       rpiutil="yes"
600       pkgdefault=
601       shift
602       ;;
603     -testsuite)
604       testsuite="yes"
605       pkgdefault=
606       shift
607       ;;
608     -tzsvr)
609       tzsvr="yes"
610       bwxml="yes"
611       rpiutil="yes"
612       pkgdefault=
613       shift
614       ;;
615     -webdav)
616       webdav="yes"
617
618       access="yes"
619       bwxml="yes"
620       rpiutil="yes"
621       pkgdefault=
622       shift
623       ;;
624     -*)
625       usage
626       exit 1
627       ;;
628     *)
629       # Assume we've reached the target(s)
630       break
631       ;;
632   esac
633 done
634
635 if [ "$pkgdefault" = "yes" ] ; then
636   bedework="yes"
637
638   access="yes"
639   bwxml="yes"
640   caldav="yes"
641   davutil="yes"
642   rpiutil="yes"
643   webdav="yes"
644 fi
645
646 if [ "$quickstart" != "" ] ; then
647   if [ "$BWCONFIGS" != "" ] ; then
648     errorUsage "Cannot specify both -quickstart and -bwchome"
649   fi
650   if [ "$bwc" = "jboss" ] ; then
651         errorUsage "The jboss configuration has been removed from the quickstart.  It is now the default.  Remove the '-bwc jboss' option."
652   fi
653
654   BWCONFIGS=$QUICKSTART_HOME/bedework/config/bwbuild
655 elif [ "$BWCONFIGS" = "" ] ; then
656   BWCONFIGS=$HOME/bwbuild
657 fi
658
659 export BEDEWORK_CONFIGS_HOME=$BWCONFIGS
660 export BEDEWORK_CONFIG=$BWCONFIGS/$bwc
661
662 if [ ! -d "$BEDEWORK_CONFIGS_HOME/.platform" ] ; then
663   errorUsage "Configurations directory $BEDEWORK_CONFIGS_HOME is missing directory '.platform'."
664 fi
665
666 if [ ! -d "$BEDEWORK_CONFIGS_HOME/.defaults" ] ; then
667   errorUsage "Configurations directory $BEDEWORK_CONFIGS_HOME is missing directory '.defaults'."
668 fi
669
670 if [ ! -f "$BEDEWORK_CONFIG/build.properties" ] ; then
671   errorUsage "Configuration $BEDEWORK_CONFIG does not exist or is not a bedework configuration."
672 fi
673
674 # Make available for ant
675 export BWCONFIG="-Dorg.bedework.build.properties=$BEDEWORK_CONFIG/build.properties"
676
677 echo "BWCONFIGS=$BWCONFIGS"
678 echo "BWCONFIG=$BWCONFIG"
679
680 javacmd="$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"
681
682 while true
683 do
684   setDirectory
685  
686   if [ "$specialTarget" != "" ] ; then
687     $javacmd $specialTarget
688   else 
689     $javacmd $*
690   fi
691 done
692  
Note: See TracBrowser for help on using the browser.