root/trunk/build/quickstart/linux/bw

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

Add a -reindex option to the bw script to reindex the data from the quickstart.

Changes to the indexer to index as the owner of collections - to allow access control to limit access correctly.

Fix the indexer factory - was missing a "/" in the path

  • 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 "     The default is a calendar build"
48   echo ""
49   echo "   Invokes ant to build or deploy the Bedework system. Uses a configuration"
50   echo "   directory which contains one directory per configuration."
51   echo ""
52   echo "   Within each configuration directory we expect a file called build.properties"
53   echo "   which should point to the property and options file needed for the deploy process"
54   echo ""
55   echo "   In general these files will be in the same directory as build.properties."
56   echo "   The environment variable BEDEWORK_CONFIG contains the path to the current"
57   echo "   configuration directory and can be used to build a path to the other files."
58   echo ""
59   echo "   ACTION defines an action to take usually in the context of the quickstart."
60   echo "    In a deployed system many of these actions are handled directly by a"
61   echo "    deployed application. ACTION may be one of"
62   echo "      -reindex - runs the indexer directly out of the quickstart bedework"
63   echo "                 dist directory to rebuild the lucene indexes"
64   echo ""
65 }
66
67 errorUsage() {
68   echo "*******************************************************"
69   echo "Error: $1"
70   echo "*******************************************************"
71   usage
72   exit 1
73 }
74
75 actionReindex() {
76   INDEXER=$QUICKSTART_HOME/bedework/dist/temp/shellscr/indexer
77  
78         if [ ! -d "$INDEXER" ] ; then
79           errorUsage "The indexer directory $INDEXER does not exist. You probably need to do a rebuild."
80         fi
81
82   cd $INDEXER
83   chmod +x bwrun
84   ./bwrun reindex-nostart -user admin -indexlocprefix ../../../../../
85  
86   exit 0
87 }
88
89 if [ -z "$JAVA_HOME" -o ! -d "$JAVA_HOME" ] ; then
90   errorUsage "JAVA_HOME is not defined correctly for bedework."
91 fi
92
93 saveddir=`pwd`
94
95 trap 'cd $saveddir' 0
96 trap "exit 2" 1 2 3 15
97
98 export QUICKSTART_HOME=$saveddir
99
100 # Default some parameters
101
102 BWCONFIGS=
103 bwc=default
104 BWCONFIG=
105 offline=
106 quickstart=
107
108 # Projects we will build
109 pkgdefault=yes
110 carddav=
111 caldav=
112 webdav=
113 bedework=
114 naming=
115 monitor=
116
117 action=
118
119 if [ "$1" = "" ] ; then
120   usage
121   exit 1
122 fi
123
124 # look for actions first
125
126 if [ "$1" = "-reindex" ] ; then
127   actionReindex
128 fi
129
130 while [ "$1" != "" ]
131 do
132   # Process the next arg
133   case $1       # Look at $1
134   in
135     -bwchome)         # Define location of configs
136       shift
137       BWCONFIGS="$1"
138       shift
139       ;;
140     -quickstart)
141       quickstart="yes"
142       shift
143       ;;
144     -usage | -help | -? | ?)
145       usage
146       exit
147       shift
148       ;;
149     -bwc)
150       shift
151       bwc="$1"
152       shift
153       ;;
154     -offline)
155       offline="-Dorg.bedework.offline.build=yes"
156       shift
157       ;;
158 # Projects
159     -carddav)
160       carddav="yes"
161       pkgdefault=
162       shift
163       ;;
164     -caldav)
165       caldav="yes"
166       pkgdefault=
167       shift
168       ;;
169     -webdav)
170       webdav="yes"
171       pkgdefault=
172       shift
173       ;;
174     -monitor)
175       monitor="yes"
176       pkgdefault=
177       shift
178       ;;
179     -naming)
180       naming="yes"
181       pkgdefault=
182       shift
183       ;;
184     -*)
185       usage
186       exit 1
187       ;;
188     *)
189       # Assume we've reached the target(s)
190       break
191       ;;
192   esac
193 done
194
195 if [ "$quickstart" != "" ] ; then
196   if [ "$BWCONFIGS" != "" ] ; then
197     errorUsage "Cannot specify both -quickstart and -bwchome"
198   fi
199
200   BWCONFIGS=$QUICKSTART_HOME/bedework/config/bwbuild
201 elif [ "$BWCONFIGS" = "" ] ; then
202   BWCONFIGS=$HOME/bwbuild
203 fi
204
205 export BEDEWORK_CONFIGS_HOME=$BWCONFIGS
206 export BEDEWORK_CONFIG=$BWCONFIGS/$bwc
207
208 if [ ! -f "$BEDEWORK_CONFIG/build.properties" ] ; then
209   errorUsage "Configuration $BEDEWORK_CONFIG does not exist or is not a bedework configuration."
210 fi
211
212 # Make available for ant
213 export BWCONFIG="-Dorg.bedework.user.build.properties=$BEDEWORK_CONFIG/build.properties"
214
215 echo "BWCONFIGS=$BWCONFIGS"
216 echo "BWCONFIG=$BWCONFIG"
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 if [ "$carddav" != "" ] ; then
223   cd $QUICKSTART_HOME/bedework-carddav
224 fi
225
226 if [ "$monitor" != "" ] ; then
227   cd $QUICKSTART_HOME/MonitorApp
228 fi
229
230 if [ "$naming" != "" ] ; then
231   cd $QUICKSTART_HOME/bwnaming
232 fi
233
234 if [ "$webdav" != "" ] ; then
235   cd $QUICKSTART_HOME/bedework/projects/webdav
236 fi
237
238 if [ "$caldav" != "" ] ; then
239   cd $QUICKSTART_HOME/bedework/projects/caldav
240 fi
241
242 $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.