root/trunk/build/quickstart/linux/bw

Revision 3024 (checked in by douglm, 3 years ago)

Placement of tzdata.zip caused problems with tzsvr build

  • 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 echo ""
20 echo "  Bedework Calendar System"
21 echo "  ------------------------"
22 echo ""
23
24 PRG="$0"
25
26 usage() {
27   echo "  $PRG [CONFIG-SOURCE] [CONFIG] [PROJECT] [ -offline ] [ target ] "
28   echo "  $PRG ACTION"
29   echo ""
30   echo " where:"
31   echo ""
32   echo "   CONFIG-SOURCE optionally defines the location of configurations and"
33   echo "                 is one or none of  "
34   echo "     -quickstart    to use the configurations within the quickstart"
35   echo "     -bwchome path  to specify the location of the bwbuild directory"
36   echo "   The default is to look in the user home for the bwbuild directory."
37   echo ""
38   echo "   CONFIG optionally defines the configuration to build"
39   echo "      -bwc configname"
40   echo ""
41   echo "   -offline     Build without attempting to retrieve library jars"
42   echo "   target       Ant target to execute"
43   echo ""
44   echo "   PROJECT optionally defines the package to build and is none or more of"
45   echo "     -carddav     Target is for the CardDAV build"
46   echo "     -exsynch     Target is for the Exchange synch build"
47   echo "     -client      Target is for the bedework client application build"
48   echo "     -monitor     Target is for the bedework monitor application"
49   echo "     -naming      Target is for the abstract naming api"
50   echo "     -tzsvr       Target is for the timezones server build"
51   echo "     The default is a calendar build"
52   echo ""
53   echo "     -carddav deploy-addrbook    To deploy the Javascript Addressbook client."
54   echo ""
55   echo "   Invokes ant to build or deploy the Bedework system. Uses a configuration"
56   echo "   directory which contains one directory per configuration."
57   echo ""
58   echo "   Within each configuration directory we expect a file called build.properties"
59   echo "   which should point to the property and options file needed for the deploy process"
60   echo ""
61   echo "   In general these files will be in the same directory as build.properties."
62   echo "   The environment variable BEDEWORK_CONFIG contains the path to the current"
63   echo "   configuration directory and can be used to build a path to the other files."
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 "      -reindex    runs the indexer directly out of the quickstart bedework"
69   echo "                  dist directory to rebuild the lucene indexes"
70   echo "      -zoneinfo   builds zoneinfo data for the timezones server"
71   echo "                  requires -version and -tzdata parameters.   NOTE: build depends on glib2"
72   echo "      -buildwebcache     builds webcache"
73   echo "      -deploywebcache    deploys webcache"
74   echo "      -deployurlbuilder  deploys url/widget builder"
75   echo ""
76 }
77
78 errorUsage() {
79   echo "*******************************************************************************************"
80   echo "Error: $1"
81   echo "*******************************************************************************************"
82   echo
83   echo "Sleeping 5 seconds before displaying usage. Safe to ctrl-C."
84   sleep 5
85   echo ""
86   usage
87   exit 1
88 }
89
90 # ----------------------------------------------------------------------------
91 # Reindex the data
92 # ----------------------------------------------------------------------------
93 actionReindex() {
94   INDEXER=$QUICKSTART_HOME/bedework/dist/temp/shellscr/indexer
95  
96         if [ ! -d "$INDEXER" ] ; then
97           errorUsage "The indexer directory $INDEXER does not exist. You probably need to do a rebuild."
98         fi
99
100   cd $INDEXER
101   chmod +x bwrun
102   ./bwrun reindex-nostart -user admin -indexlocprefix ../../../../../
103  
104   exit 0
105 }
106
107 usageZoneinfo() {
108   echo ""
109   echo "$PRG -zoneinfo -version VERSION -tzdata path-to-data"
110   echo "for example:"
111   echo "$PRG -zoneinfo -version 2010m -tzdata /data/olson/tzdata2010m.tar.gz"
112   exit 1
113 }
114
115 # ----------------------------------------------------------------------------
116 # Build zoneinfo - require -version -tzdata
117 # tzdata file can be obtained via http://www.twinsun.com/tz/tz-link.htm or
118 # more directly from ftp://elsie.nci.nih.gov/pub/
119 # The version parameter value should be the version code from the tzdata name
120 # ----------------------------------------------------------------------------
121 actionZoneinfo() {
122   bwtzsvr="$QUICKSTART_HOME/bwtzsvr"
123   bwresources="$bwtzsvr/resources"
124
125   shift
126  
127   if [ "$1" != "-version" ] ; then
128     echo "got $1"
129     echo "Must supply -version parameter for -zoneinfo"
130     usageZoneinfo
131   fi
132  
133   shift
134     echo "got $1"
135 #  version="-Dorg.bedework.timezones.version=$1"
136   version=$1
137   shift
138  
139   if [ "$1" != "-tzdata" ] ; then
140     echo "Must supply -tzdata parameter for -zoneinfo"
141     usageZoneinfo
142   fi
143  
144   shift
145 #  tzdata="-Dorg.bedework.timezones.data=$1"
146   tzdata=$1
147   shift
148  
149   rm -rf /tmp/bedework
150   mkdir /tmp/bedework
151   mkdir /tmp/bedework/timezones
152  
153   cd /tmp/bedework/timezones
154  
155   wget http://bedework.org/downloads/lib/vzic-1.3.tgz
156   gunzip vzic-1.3.tgz
157   tar -xf vzic-1.3.tar
158
159 # copy and unpack the data
160   mkdir olsondata
161   cd olsondata
162   cp $tzdata tzdata.tar.gz
163   gunzip tzdata.tar.gz
164   tar -xf tzdata.tar
165   rm tzdata.tar
166   cd ..
167  
168 # Replace lines in the makefile. Sure real unix types can do better 
169  
170   cd vzic-1.3
171  
172   sed "s/\(^OLSON_DIR = \)\(..*$\)/\1\/tmp\/bedework\/timezones\/olsondata/" Makefile > Makefile1
173
174   sed "s/\(^PRODUCT_ID = \)\(..*$\)/\1\/bedework.org\/\/NONSGML Bedework\/\/EN/" Makefile1 > Makefile2
175
176   sed "s/\(^TZID_PREFIX = \)\(..*$\)/\1/" Makefile2 > Makefile
177  
178   make
179  
180 # omit the pure for allegedly better outlook compatability -
181 # but not altogether correct timezones 
182   ./vzic --pure
183
184   cd ..
185  
186   mkdir tzdata
187   cp -r vzic-1.3/zoneinfo tzdata
188   cp $bwresources/aliases.txt tzdata
189  
190   cd tzdata
191  
192   echo "version=$version" > info.txt
193   date +buildTime=%D-%T-%N >> info.txt
194  
195   zip -r tzdata *
196  
197   cp tzdata.zip $bwtzsvr/
198  
199   echo ""
200   echo "------------------------------------------------------------------------------"
201   echo "tzdata.zip has been built and is at $bwtzsvr/tzdata.zip"
202   echo "------------------------------------------------------------------------------"
203   echo ""
204  
205   exit 0
206 }
207
208 if [ -z "$JAVA_HOME" -o ! -d "$JAVA_HOME" ] ; then
209   errorUsage "JAVA_HOME is not defined correctly for bedework."
210 fi
211
212 saveddir=`pwd`
213
214 trap 'cd $saveddir' 0
215 trap "exit 2" 1 2 3 15
216
217 export QUICKSTART_HOME=$saveddir
218
219 CLASSPATH=$ANT_HOME/lib/ant-launcher.jar
220 CLASSPATH=$CLASSPATH:$QUICKSTART_HOME/bedework/build/quickstart/antlib
221 #CLASSPATH=$CLASSPATH:$QUICKSTART_HOME/bedework/applib/log4j-1.2.8.jar
222
223 # Default some parameters
224
225 BWCONFIGS=
226 bwc=default
227 BWCONFIG=
228 offline=
229 quickstart=
230
231 # Projects we will build
232 pkgdefault=yes
233 bedework=
234 carddav=
235 caldav=
236 client=
237 exsynch=
238 monitor=
239 naming=
240 tzsvr=
241 webdav=
242
243 action=
244
245 if [ "$1" = "" ] ; then
246   usage
247   exit 1
248 fi
249
250 # look for actions first
251
252 if [ "$1" = "-reindex" ] ; then
253   actionReindex
254 fi
255
256 if [ "$1" = "-zoneinfo" ] ; then
257   actionZoneinfo $*
258 fi
259
260 if [ "$1" = "-buildwebcache" ] ; then
261   cd $QUICKSTART_HOME/cachedfeeder
262   ./buildWebCache
263   exit
264 fi
265
266 if [ "$1" = "-deploywebcache" ] ; then
267    cd $QUICKSTART_HOME/cachedfeeder
268   ./deployWebCache
269   exit
270 fi
271
272 if [ "$1" = "-deployurlbuilder" ] ; then
273    cd $QUICKSTART_HOME/cachedfeeder
274   ./deployUrlBuilder
275   exit
276 fi
277
278 while [ "$1" != "" ]
279 do
280   # Process the next arg
281   case $1       # Look at $1
282   in
283     -bwchome)         # Define location of configs
284       shift
285       BWCONFIGS="$1"
286       shift
287       ;;
288     -quickstart)
289       quickstart="yes"
290       shift
291       ;;
292     -usage | -help | -? | ?)
293       usage
294       exit
295       shift
296       ;;
297     -bwc)
298       shift
299       bwc="$1"
300       shift
301       ;;
302     -offline)
303       offline="-Dorg.bedework.offline.build=yes"
304       shift
305       ;;
306 # Projects
307     -carddav)
308       carddav="yes"
309       pkgdefault=
310       shift
311       ;;
312     -caldav)
313       caldav="yes"
314       pkgdefault=
315       shift
316       ;;
317     -client)
318       client="yes"
319       pkgdefault=
320       shift
321       ;;
322     -exsynch)
323       exsynch="yes"
324       pkgdefault=
325       shift
326       ;;
327     -webdav)
328       webdav="yes"
329       pkgdefault=
330       shift
331       ;;
332     -monitor)
333       monitor="yes"
334       pkgdefault=
335       shift
336       ;;
337     -naming)
338       naming="yes"
339       pkgdefault=
340       shift
341       ;;
342     -tzsvr)
343       tzsvr="yes"
344       pkgdefault=
345       shift
346       ;;
347     -*)
348       usage
349       exit 1
350       ;;
351     *)
352       # Assume we've reached the target(s)
353       break
354       ;;
355   esac
356 done
357
358 if [ "$quickstart" != "" ] ; then
359   if [ "$BWCONFIGS" != "" ] ; then
360     errorUsage "Cannot specify both -quickstart and -bwchome"
361   fi
362   if [ "$bwc" = "jboss" ] ; then
363         errorUsage "The jboss configuration has been removed from the quickstart.  It is now the default.  Remove the '-bwc jboss' option."
364   fi
365
366   BWCONFIGS=$QUICKSTART_HOME/bedework/config/bwbuild
367 elif [ "$BWCONFIGS" = "" ] ; then
368   BWCONFIGS=$HOME/bwbuild
369 fi
370
371 export BEDEWORK_CONFIGS_HOME=$BWCONFIGS
372 export BEDEWORK_CONFIG=$BWCONFIGS/$bwc
373
374 if [ ! -f "$BEDEWORK_CONFIG/build.properties" ] ; then
375   errorUsage "Configuration $BEDEWORK_CONFIG does not exist or is not a bedework configuration."
376 fi
377
378 # Make available for ant
379 export BWCONFIG="-Dorg.bedework.user.build.properties=$BEDEWORK_CONFIG/build.properties"
380
381 echo "BWCONFIGS=$BWCONFIGS"
382 echo "BWCONFIG=$BWCONFIG"
383
384 if [ "$caldav" != "" ] ; then
385   cd $QUICKSTART_HOME/bedework/projects/caldav
386 fi
387
388 if [ "$carddav" != "" ] ; then
389   cd $QUICKSTART_HOME/bedework-carddav
390 fi
391
392 if [ "$client" != "" ] ; then
393   cd $QUICKSTART_HOME/bwclient
394 fi
395
396 if [ "$exsynch" != "" ] ; then
397   cd $QUICKSTART_HOME/exchgsynch
398 fi
399
400 if [ "$monitor" != "" ] ; then
401   cd $QUICKSTART_HOME/MonitorApp
402 fi
403
404 if [ "$naming" != "" ] ; then
405   cd $QUICKSTART_HOME/bwnaming
406 fi
407
408 if [ "$tzsvr" != "" ] ; then
409   cd $QUICKSTART_HOME/bwtzsvr
410 fi
411
412 if [ "$webdav" != "" ] ; then
413   cd $QUICKSTART_HOME/bedework/projects/webdav
414 fi
415
416 $JAVA_HOME/bin/java -classpath $CLASSPATH $ant_xmllogfile $offline -Dant.home=$ANT_HOME org.apache.tools.ant.launch.Launcher $BWCONFIG $ant_listener $ant_logger $*
Note: See TracBrowser for help on using the browser.