root/trunk/build/quickstart/linux/bw

Revision 3022 (checked in by bleibson, 3 years ago)

o remove the -deployaddressbook option. The script it called is gone now.
o document -carddav deployaddrbook combo.
o give helpful feedback to anybody still using -quickstart -bwc jboss (which no longer works)
o add a 5 second sleep between when the error message is displayed and when the usage is dumped. Works well for me!

  • 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 "
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   bwresources="$QUICKSTART_HOME/bwtzsvr/resources"
123
124   shift
125  
126   if [ "$1" != "-version" ] ; then
127     echo "got $1"
128     echo "Must supply -version parameter for -zoneinfo"
129     usageZoneinfo
130   fi
131  
132   shift
133     echo "got $1"
134 #  version="-Dorg.bedework.timezones.version=$1"
135   version=$1
136   shift
137  
138   if [ "$1" != "-tzdata" ] ; then
139     echo "Must supply -tzdata parameter for -zoneinfo"
140     usageZoneinfo
141   fi
142  
143   shift
144 #  tzdata="-Dorg.bedework.timezones.data=$1"
145   tzdata=$1
146   shift
147  
148   rm -rf /tmp/bedework
149   mkdir /tmp/bedework
150   mkdir /tmp/bedework/timezones
151  
152   cd /tmp/bedework/timezones
153  
154   wget http://bedework.org/downloads/lib/vzic-1.3.tgz
155   gunzip vzic-1.3.tgz
156   tar -xf vzic-1.3.tar
157
158 # copy and unpack the data
159   mkdir olsondata
160   cd olsondata
161   cp $tzdata tzdata.tar.gz
162   gunzip tzdata.tar.gz
163   tar -xf tzdata.tar
164   rm tzdata.tar
165   cd ..
166  
167 # Replace lines in the makefile. Sure real unix types can do better 
168  
169   cd vzic-1.3
170  
171   sed "s/\(^OLSON_DIR = \)\(..*$\)/\1\/tmp\/bedework\/timezones\/olsondata/" Makefile > Makefile1
172
173   sed "s/\(^PRODUCT_ID = \)\(..*$\)/\1\/bedework.org\/\/NONSGML Bedework\/\/EN/" Makefile1 > Makefile2
174
175   sed "s/\(^TZID_PREFIX = \)\(..*$\)/\1/" Makefile2 > Makefile
176  
177   make
178  
179 # omit the pure for allegedly better outlook compatability -
180 # but not altogether correct timezones 
181   ./vzic --pure
182
183   cd ..
184  
185   mkdir tzdata
186   cp -r vzic-1.3/zoneinfo tzdata
187   cp $bwresources/aliases.txt tzdata
188  
189   cd tzdata
190  
191   echo "version=$version" > info.txt
192   date +buildTime=%D-%T-%N >> info.txt
193  
194   zip -r tzdata *
195  
196   cp tzdata.zip $bwresources/
197  
198   echo ""
199   echo "------------------------------------------------------------------------------"
200   echo "tzdata.zip has been built and is at $bwresources/tzdata.zip"
201   echo "------------------------------------------------------------------------------"
202   echo ""
203  
204   exit 0
205 }
206
207 if [ -z "$JAVA_HOME" -o ! -d "$JAVA_HOME" ] ; then
208   errorUsage "JAVA_HOME is not defined correctly for bedework."
209 fi
210
211 saveddir=`pwd`
212
213 trap 'cd $saveddir' 0
214 trap "exit 2" 1 2 3 15
215
216 export QUICKSTART_HOME=$saveddir
217
218 CLASSPATH=$ANT_HOME/lib/ant-launcher.jar
219 CLASSPATH=$CLASSPATH:$QUICKSTART_HOME/bedework/build/quickstart/antlib
220 #CLASSPATH=$CLASSPATH:$QUICKSTART_HOME/bedework/applib/log4j-1.2.8.jar
221
222 # Default some parameters
223
224 BWCONFIGS=
225 bwc=default
226 BWCONFIG=
227 offline=
228 quickstart=
229
230 # Projects we will build
231 pkgdefault=yes
232 bedework=
233 carddav=
234 caldav=
235 client=
236 exsynch=
237 monitor=
238 naming=
239 tzsvr=
240 webdav=
241
242 action=
243
244 if [ "$1" = "" ] ; then
245   usage
246   exit 1
247 fi
248
249 # look for actions first
250
251 if [ "$1" = "-reindex" ] ; then
252   actionReindex
253 fi
254
255 if [ "$1" = "-zoneinfo" ] ; then
256   actionZoneinfo $*
257 fi
258
259 if [ "$1" = "-buildwebcache" ] ; then
260   cd $QUICKSTART_HOME/cachedfeeder
261   ./buildWebCache
262   exit
263 fi
264
265 if [ "$1" = "-deploywebcache" ] ; then
266    cd $QUICKSTART_HOME/cachedfeeder
267   ./deployWebCache
268   exit
269 fi
270
271 if [ "$1" = "-deployurlbuilder" ] ; then
272    cd $QUICKSTART_HOME/cachedfeeder
273   ./deployUrlBuilder
274   exit
275 fi
276
277 while [ "$1" != "" ]
278 do
279   # Process the next arg
280   case $1       # Look at $1
281   in
282     -bwchome)         # Define location of configs
283       shift
284       BWCONFIGS="$1"
285       shift
286       ;;
287     -quickstart)
288       quickstart="yes"
289       shift
290       ;;
291     -usage | -help | -? | ?)
292       usage
293       exit
294       shift
295       ;;
296     -bwc)
297       shift
298       bwc="$1"
299       shift
300       ;;
301     -offline)
302       offline="-Dorg.bedework.offline.build=yes"
303       shift
304       ;;
305 # Projects
306     -carddav)
307       carddav="yes"
308       pkgdefault=
309       shift
310       ;;
311     -caldav)
312       caldav="yes"
313       pkgdefault=
314       shift
315       ;;
316     -client)
317       client="yes"
318       pkgdefault=
319       shift
320       ;;
321     -exsynch)
322       exsynch="yes"
323       pkgdefault=
324       shift
325       ;;
326     -webdav)
327       webdav="yes"
328       pkgdefault=
329       shift
330       ;;
331     -monitor)
332       monitor="yes"
333       pkgdefault=
334       shift
335       ;;
336     -naming)
337       naming="yes"
338       pkgdefault=
339       shift
340       ;;
341     -tzsvr)
342       tzsvr="yes"
343       pkgdefault=
344       shift
345       ;;
346     -*)
347       usage
348       exit 1
349       ;;
350     *)
351       # Assume we've reached the target(s)
352       break
353       ;;
354   esac
355 done
356
357 if [ "$quickstart" != "" ] ; then
358   if [ "$BWCONFIGS" != "" ] ; then
359     errorUsage "Cannot specify both -quickstart and -bwchome"
360   fi
361   if [ "$bwc" = "jboss" ] ; then
362         errorUsage "The jboss configuration has been removed from the quickstart.  It is now the default.  Remove the '-bwc jboss' option."
363   fi
364
365   BWCONFIGS=$QUICKSTART_HOME/bedework/config/bwbuild
366 elif [ "$BWCONFIGS" = "" ] ; then
367   BWCONFIGS=$HOME/bwbuild
368 fi
369
370 export BEDEWORK_CONFIGS_HOME=$BWCONFIGS
371 export BEDEWORK_CONFIG=$BWCONFIGS/$bwc
372
373 if [ ! -f "$BEDEWORK_CONFIG/build.properties" ] ; then
374   errorUsage "Configuration $BEDEWORK_CONFIG does not exist or is not a bedework configuration."
375 fi
376
377 # Make available for ant
378 export BWCONFIG="-Dorg.bedework.user.build.properties=$BEDEWORK_CONFIG/build.properties"
379
380 echo "BWCONFIGS=$BWCONFIGS"
381 echo "BWCONFIG=$BWCONFIG"
382
383 if [ "$caldav" != "" ] ; then
384   cd $QUICKSTART_HOME/bedework/projects/caldav
385 fi
386
387 if [ "$carddav" != "" ] ; then
388   cd $QUICKSTART_HOME/bedework-carddav
389 fi
390
391 if [ "$client" != "" ] ; then
392   cd $QUICKSTART_HOME/bwclient
393 fi
394
395 if [ "$exsynch" != "" ] ; then
396   cd $QUICKSTART_HOME/exchgsynch
397 fi
398
399 if [ "$monitor" != "" ] ; then
400   cd $QUICKSTART_HOME/MonitorApp
401 fi
402
403 if [ "$naming" != "" ] ; then
404   cd $QUICKSTART_HOME/bwnaming
405 fi
406
407 if [ "$tzsvr" != "" ] ; then
408   cd $QUICKSTART_HOME/bwtzsvr
409 fi
410
411 if [ "$webdav" != "" ] ; then
412   cd $QUICKSTART_HOME/bedework/projects/webdav
413 fi
414
415 $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.