root/trunk/build/quickstart/linux/bw

Revision 2751 (checked in by johnsa, 3 years ago)

DONE 496: Port bw and runjboss script to Windows
http://www.bedework.org/trac/bedework/ticket/496

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