root/trunk/build/quickstart/linux/bw

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

Change icalendar schema to correct dateTime pattern and add restriction pattern to tzoffset.

Fix tzsvr to match latest schema and latest draft.

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