root/releases/bedework-3.8/build/quickstart/linux/bw

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

added an option to fetch the timezone information and build the zipped data file.

Now preferred approach is

./bw -zoneinfo -fetch

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