root/trunk/build/quickstart/linux/bw

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

Make testsuite into a separate project.

Add extra comment to config listing components to be added to application list

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