root/trunk/build/quickstart/linux/bw

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

Changes to xml schema and binding which resulted in many changes - nearly all not functional but class names chnaged

  • 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  
218   zip -r tzdata *
219  
220   cp tzdata.zip $bwtzsvr/
221  
222   echo ""
223   echo "------------------------------------------------------------------------------"
224   echo "tzdata.zip has been built and is at $bwtzsvr/tzdata.zip"
225   echo "------------------------------------------------------------------------------"
226   echo ""
227  
228   exit 0
229 }
230
231 if [ -z "$JAVA_HOME" -o ! -d "$JAVA_HOME" ] ; then
232   errorUsage "JAVA_HOME is not defined correctly for bedework."
233 fi
234
235 saveddir=`pwd`
236
237 trap 'cd $saveddir' 0
238 trap "exit 2" 1 2 3 15
239
240 export QUICKSTART_HOME=$saveddir
241
242 CLASSPATH=$ANT_HOME/lib/ant-launcher.jar
243 CLASSPATH=$CLASSPATH:$QUICKSTART_HOME/bedework/build/quickstart/antlib
244
245 # Default some parameters
246
247 BWCONFIGS=
248 bwc=default
249 BWCONFIG=
250 offline=
251 quickstart=
252
253 # Projects we will build
254 pkgdefault=yes
255 bedework=
256 bwxml=
257 bwtools=
258 caldav=
259 caldavTest=
260 carddav=
261 catsvr=
262 client=
263 exsynch=
264 monitor=
265 naming=
266 testsuite=
267 tzsvr=
268 webdav=
269
270 action=
271
272 if [ "$1" = "" ] ; then
273   usage
274   exit 1
275 fi
276
277 # look for actions first
278
279 if [ "$1" = "-updateall" ] ; then
280   actionUpdateall
281 fi
282
283 if [ "$1" = "-zoneinfo" ] ; then
284   actionZoneinfo $*
285 fi
286
287 if [ "$1" = "-buildwebcache" ] ; then
288   cd $QUICKSTART_HOME/cachedfeeder
289   ./buildWebCache
290   exit
291 fi
292
293 if [ "$1" = "-deploywebcache" ] ; then
294   cd $QUICKSTART_HOME/cachedfeeder
295   $JAVA_HOME/bin/java -classpath $CLASSPATH $ant_xmllogfile -Dant.home=$ANT_HOME org.apache.tools.ant.launch.Launcher \
296                  $BWCONFIG $ant_listener $ant_logger $ant_loglevel $bw_loglevel deploy-webcache
297   exit
298 fi
299
300 if [ "$1" = "-deployurlbuilder" ] ; then
301   cd $QUICKSTART_HOME/cachedfeeder
302   $JAVA_HOME/bin/java -classpath $CLASSPATH $ant_xmllogfile -Dant.home=$ANT_HOME org.apache.tools.ant.launch.Launcher \
303                  $BWCONFIG $ant_listener $ant_logger $ant_loglevel $bw_loglevel deploy-urlbuilder
304   exit
305 fi
306
307 while [ "$1" != "" ]
308 do
309   # Process the next arg
310   case $1       # Look at $1
311   in
312     -bwchome)         # Define location of configs
313       shift
314       BWCONFIGS="$1"
315       shift
316       ;;
317     -quickstart)
318       quickstart="yes"
319       shift
320       ;;
321     -usage | -help | -? | ?)
322       usage
323       exit
324       shift
325       ;;
326     -bwc)
327       shift
328       bwc="$1"
329       shift
330       ;;
331     -offline)
332       offline="-Dorg.bedework.offline.build=yes"
333       shift
334       ;;
335 # ----------------------- Log level       
336     -log-silent)
337       ant_loglevel="-quiet"
338       bw_loglevel="-Dorg.bedework.build.silent=true"
339       shift
340       ;;
341     -log-quiet)
342       ant_loglevel="-quiet"
343       bw_loglevel=""
344       shift
345       ;;
346     -log-inform)
347       ant_loglevel=""
348       bw_loglevel="-Dorg.bedework.build.inform=true"
349       shift
350       ;;
351     -log-verbose)
352       ant_loglevel="-verbose"
353       bw_loglevel="-Dorg.bedework.build.inform=true -Dorg.bedework.build.noisy=true"
354       shift
355       ;;
356     -ant-debug)
357       ant_loglevel="-debug"
358       shift
359       ;;
360     -build-debug)
361       bw_loglevel="-Dorg.bedework.build.inform=true -Dorg.bedework.build.noisy=true -Dorg.bedework.build.debug=true "
362       shift
363       ;;
364 # ------------------------Projects
365     -bwtools)
366       bwtools="yes"
367       pkgdefault=
368       shift
369       ;;
370     -bwxml)
371       bwxml="yes"
372       pkgdefault=
373       shift
374       ;;
375     -caldav)
376       caldav="yes"
377       pkgdefault=
378       shift
379       ;;
380     -caldavTest)
381       caldavTest="yes"
382       pkgdefault=
383       shift
384       ;;
385     -carddav)
386       carddav="yes"
387       pkgdefault=
388       shift
389       ;;
390     -catsvr)
391       catsvr="yes"
392       pkgdefault=
393       shift
394       ;;
395     -client)
396       client="yes"
397       pkgdefault=
398       shift
399       ;;
400     -exsynch)
401       exsynch="yes"
402       pkgdefault=
403       shift
404       ;;
405     -webdav)
406       webdav="yes"
407       pkgdefault=
408       shift
409       ;;
410     -monitor)
411       monitor="yes"
412       pkgdefault=
413       shift
414       ;;
415     -naming)
416       naming="yes"
417       pkgdefault=
418       shift
419       ;;
420     -testsuite)
421       testsuite="yes"
422       pkgdefault=
423       shift
424       ;;
425     -tzsvr)
426       tzsvr="yes"
427       pkgdefault=
428       shift
429       ;;
430     -*)
431       usage
432       exit 1
433       ;;
434     *)
435       # Assume we've reached the target(s)
436       break
437       ;;
438   esac
439 done
440
441 if [ "$quickstart" != "" ] ; then
442   if [ "$BWCONFIGS" != "" ] ; then
443     errorUsage "Cannot specify both -quickstart and -bwchome"
444   fi
445   if [ "$bwc" = "jboss" ] ; then
446         errorUsage "The jboss configuration has been removed from the quickstart.  It is now the default.  Remove the '-bwc jboss' option."
447   fi
448
449   BWCONFIGS=$QUICKSTART_HOME/bedework/config/bwbuild
450 elif [ "$BWCONFIGS" = "" ] ; then
451   BWCONFIGS=$HOME/bwbuild
452 fi
453
454 export BEDEWORK_CONFIGS_HOME=$BWCONFIGS
455 export BEDEWORK_CONFIG=$BWCONFIGS/$bwc
456
457 if [ ! -d "$BEDEWORK_CONFIGS_HOME/.platform" ] ; then
458   errorUsage "Configurations directory $BEDEWORK_CONFIGS_HOME is missing directory '.platform'."
459 fi
460
461 if [ ! -f "$BEDEWORK_CONFIG/build.properties" ] ; then
462   errorUsage "Configuration $BEDEWORK_CONFIG does not exist or is not a bedework configuration."
463 fi
464
465 # Make available for ant
466 export BWCONFIG="-Dorg.bedework.user.build.properties=$BEDEWORK_CONFIG/build.properties"
467
468 echo "BWCONFIGS=$BWCONFIGS"
469 echo "BWCONFIG=$BWCONFIG"
470
471 if [ "$bwxml" != "" ] ; then
472   cd $QUICKSTART_HOME/bwxml
473 fi
474
475 if [ "$bwtools" != "" ] ; then
476   cd $QUICKSTART_HOME/bwtools
477 fi
478
479 if [ "$caldav" != "" ] ; then
480   cd $QUICKSTART_HOME/bedework/projects/caldav
481 fi
482
483 if [ "$caldavTest" != "" ] ; then
484   cd $QUICKSTART_HOME/caldavTest
485 fi
486
487 if [ "$carddav" != "" ] ; then
488   cd $QUICKSTART_HOME/bedework-carddav
489 fi
490
491 if [ "$catsvr" != "" ] ; then
492   cd $QUICKSTART_HOME/catsvr
493 fi
494
495 if [ "$client" != "" ] ; then
496   cd $QUICKSTART_HOME/bwclient
497 fi
498
499 if [ "$exsynch" != "" ] ; then
500   cd $QUICKSTART_HOME/exchgsynch
501 fi
502
503 if [ "$monitor" != "" ] ; then
504   cd $QUICKSTART_HOME/MonitorApp
505 fi
506
507 if [ "$naming" != "" ] ; then
508   cd $QUICKSTART_HOME/bwnaming
509 fi
510
511 if [ "$testsuite" != "" ] ; then
512   cd $QUICKSTART_HOME/testsuite
513 fi
514
515 if [ "$tzsvr" != "" ] ; then
516   cd $QUICKSTART_HOME/bwtzsvr
517 fi
518
519 if [ "$webdav" != "" ] ; then
520   cd $QUICKSTART_HOME/bedework/projects/webdav
521 fi
522
523 $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.