root/trunk/build/quickstart/linux/bw

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

More fixes after separatng out tzsvr

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