[7865] | 1 | #!/bin/sh
|
---|
| 2 |
|
---|
| 3 | if [ ! -f gs3-setup.sh ]; then
|
---|
| 4 | echo "You must run this script from within the Greenstone 3 home directory"
|
---|
| 5 | exit 1
|
---|
| 6 | fi
|
---|
| 7 |
|
---|
| 8 | source gs3-setup.sh
|
---|
| 9 |
|
---|
| 10 | gsdl3home=$GSDL3HOME
|
---|
| 11 |
|
---|
| 12 | #########################
|
---|
| 13 | # CHECK NECESSARY BITS
|
---|
| 14 | #########################
|
---|
| 15 | if test -z "$CVSROOT" ; then
|
---|
| 16 | echo "You need to set the environment variable CVSROOT before running"
|
---|
| 17 | echo "this script. Please use the same path that you used to check out"
|
---|
| 18 | echo "the Greentone repository. If you are not using anonymous cvs, you"
|
---|
| 19 | echo "also need to set the variable CVS_RSH to ssh."
|
---|
| 20 | exit;
|
---|
| 21 | fi
|
---|
| 22 |
|
---|
| 23 | ############################
|
---|
| 24 | # GET INFO FROM USER
|
---|
| 25 | ############################
|
---|
| 26 |
|
---|
| 27 | # Prompt for the computer name
|
---|
| 28 | hostname="localhost"
|
---|
| 29 | echo ""
|
---|
| 30 | echo "Enter the full address of the host computer from which the greenstone"
|
---|
| 31 | echo "collections will be served, for example:"
|
---|
| 32 | echo "bob.greenstone.ac.nz"
|
---|
| 33 | echo "or press enter for default [Default = localhost]."
|
---|
| 34 | echo ""
|
---|
| 35 | printf "%s" "> "
|
---|
| 36 | read ans
|
---|
| 37 | if [ "$ans" != "" ] ; then
|
---|
| 38 | hostname="$ans"
|
---|
| 39 | fi
|
---|
| 40 |
|
---|
| 41 | # Prompt for the port number
|
---|
| 42 | portnumber="8080"
|
---|
| 43 | echo ""
|
---|
| 44 | echo "Enter the port number that the tomcat webserver will serve on,"
|
---|
| 45 | echo "or press enter for default [Default = 8080]."
|
---|
| 46 | echo ""
|
---|
| 47 | printf "%s" "> "
|
---|
| 48 | read ans
|
---|
| 49 | if [ "$ans" != "" ] ; then
|
---|
| 50 | portnumber="$ans"
|
---|
| 51 | fi
|
---|
| 52 |
|
---|
| 53 | #################################
|
---|
| 54 | # CHECKOUT ALL THE BITS FROM CVS
|
---|
| 55 | #################################
|
---|
| 56 |
|
---|
| 57 | # firstly, remove unwanted directories
|
---|
| 58 | cvs update -dRP
|
---|
| 59 |
|
---|
| 60 | # now check out extra bits
|
---|
| 61 | cd packages
|
---|
| 62 | if [ ! -d mgpp ]; then
|
---|
| 63 | cvs co -P mgpp
|
---|
| 64 | fi
|
---|
| 65 | cd $gsdl3home
|
---|
| 66 |
|
---|
| 67 | ###############################
|
---|
| 68 | # SETUP TOMCAT
|
---|
| 69 | ###############################
|
---|
| 70 |
|
---|
| 71 | cd comms/jakarta/
|
---|
| 72 | # unpack tomcat and rename directory
|
---|
| 73 | if [ ! -d tomcat ]; then
|
---|
| 74 | unzip jakarta-tomcat-4.1.30.zip
|
---|
| 75 | mv jakarta-tomcat-4.1.30 tomcat
|
---|
| 76 | fi
|
---|
| 77 |
|
---|
| 78 | #edit the tomcat setclasspath script to add our classpath
|
---|
| 79 | if [ ! -f ./tomcat/bin/setclasspath.sh.orig ]; then
|
---|
| 80 | mv ./tomcat/bin/setclasspath.sh ./tomcat/bin/setclasspath.sh.orig
|
---|
| 81 | cat ./tomcat/bin/setclasspath.sh.orig | sed 's,CLASSPATH=,CLASSPATH=\"$CLASSPATH\":,' > ./tomcat/bin/setclasspath.sh
|
---|
| 82 | fi
|
---|
| 83 |
|
---|
| 84 | # copy the modified server.xml into tomcat
|
---|
[8061] | 85 | if [ ! -f ./tomcat/conf/server-withexamples.xml.config ]; then
|
---|
[7975] | 86 | mv ./tomcat/conf/server.xml ./tomcat/conf/server-withexamples.xml.config
|
---|
| 87 | cat server.xml.in | sed "s|@gsdl3home@|${gsdl3home}|" > ./tomcat/conf/server.xml
|
---|
| 88 | fi
|
---|
[7865] | 89 |
|
---|
| 90 | # Edit the server.xml config file to set the port number
|
---|
| 91 | if [ "$portnumber" != "8080" ] ; then
|
---|
| 92 | cat ./tomcat/conf/server.xml | sed "s|8080|${portnumber}|" > server.xml.tmp
|
---|
| 93 | mv server.xml.tmp ./tomcat/conf/server.xml
|
---|
| 94 | fi
|
---|
| 95 |
|
---|
| 96 | #make everyone happy by giving the right permissions to the shell scripts
|
---|
| 97 | chmod a+x ./tomcat/bin/*.sh
|
---|
| 98 |
|
---|
| 99 | cd $gsdl3home
|
---|
| 100 |
|
---|
| 101 | ###############################
|
---|
[7874] | 102 | # SETUP SOAP
|
---|
[7865] | 103 | ###############################
|
---|
| 104 | cd comms/soap
|
---|
| 105 | # unpack soap and rename directory
|
---|
| 106 | if [ ! -d soap ]; then
|
---|
| 107 | unzip soap-bin-2.3.1.zip
|
---|
| 108 | mv soap-2_3_1 soap
|
---|
| 109 | cp soap/lib/soap.jar $gsdl3home/lib/java
|
---|
| 110 | # move the localsite deployment description into the soap webapp - localsite comes predeployed
|
---|
| 111 | cp DeployedServices.ds soap/webapps/soap/
|
---|
| 112 | # disable soap by renaming the web.xml file
|
---|
| 113 | mv ./soap/webapps/soap/WEB-INF/web.xml ./soap/webapps/soap/WEB-INF/web.xml.disabled
|
---|
| 114 | fi
|
---|
| 115 | cd $gsdl3home
|
---|
| 116 |
|
---|
| 117 | #edit the SOAPServer config file
|
---|
| 118 | if [ ! -f ./resources/java/SOAPServer.cfg ]; then
|
---|
| 119 | sed "s|@gsdl3home@|${gsdl3home}|" ./resources/java/SOAPServer.cfg.in > ./resources/java/SOAPServer.cfg
|
---|
| 120 | fi
|
---|
| 121 |
|
---|
[7874] | 122 | ################################
|
---|
| 123 | # SETUP MYSQL + SAMPLE DATABASES
|
---|
| 124 | ################################
|
---|
| 125 |
|
---|
| 126 | if [ ! -d packages/mysql/data ]; then
|
---|
| 127 | cd packages/mysql
|
---|
| 128 | unzip mysql-4.0.20-linux.zip
|
---|
[7990] | 129 | mkdir var
|
---|
| 130 | mkdir var/log
|
---|
| 131 | chmod 777 var var/log
|
---|
| 132 |
|
---|
[7946] | 133 | ./scripts/mysql_install_db --datadir=./data --basedir=. --user=root --force
|
---|
[7975] | 134 | ./bin/mysqld_safe --user=root --datadir=./data --basedir=. --pid_file=gsdl3.pid --socket=/tmp/mysql.sock --err-log=./var/log/mysql.log &
|
---|
[7874] | 135 | sleep 2
|
---|
| 136 | ./bin/mysql --user=root --execute="GRANT SELECT,INSERT,DELETE,UPDATE,DROP,CREATE ON *.* TO gsdl3admin@localhost;"
|
---|
[8935] | 137 | ./bin/mysql --user=root --execute="GRANT SELECT,INSERT,DELETE,UPDATE,DROP,CREATE ON *.* TO gsdl3admin@%;"
|
---|
[7874] | 138 | ./bin/mysql --user=root --execute="GRANT SELECT ON *.* TO gsdl3reader@localhost;"
|
---|
| 139 |
|
---|
| 140 | # set up any sample collections databases
|
---|
| 141 | #gs3mgdemo
|
---|
| 142 | ./bin/mysql --user=root --execute="create database localsite_gs3mgdemo;"
|
---|
| 143 | ./bin/mysql --user=root localsite_gs3mgdemo < $gsdl3home/web/sites/localsite/collect/gs3mgdemo/mysqldatadump.sql
|
---|
| 144 |
|
---|
[7975] | 145 | ./bin/mysqladmin --user=root --socket=/tmp/mysql.sock shutdown
|
---|
[7874] | 146 | cd $gsdl3home
|
---|
| 147 | fi
|
---|
| 148 |
|
---|
[7865] | 149 | #################################
|
---|
| 150 | # WEB.XML FILE
|
---|
| 151 | #################################
|
---|
| 152 | # Edit the web/WEB-INF/web.xml to set gsdl3home
|
---|
| 153 | if [ ! -f ./web/WEB-INF/web.xml ]; then
|
---|
| 154 | sed "s|@gsdl3home@|${gsdl3home}|" ./web/WEB-INF/web.xml.in > ./web/WEB-INF/web.xml
|
---|
| 155 | fi
|
---|
| 156 |
|
---|
| 157 | #################################
|
---|
| 158 | # SITE CONFIG FILES
|
---|
| 159 | #################################
|
---|
| 160 |
|
---|
| 161 | # Edit the siteConfig.xml found in any site within the sites folder - port and hostname
|
---|
| 162 | for SITE in $gsdl3home/web/sites/*; do
|
---|
| 163 | if [ -f $SITE/siteConfig.xml ] ; then
|
---|
| 164 | echo "Processing $SITE"
|
---|
| 165 | if [ "$hostname" != "localhost" ] ; then
|
---|
| 166 | sed "s|localhost|${hostname}|" $SITE/siteConfig.xml > $SITE/siteConfig.tmp && mv $SITE/siteConfig.tmp $SITE/siteConfig.xml
|
---|
| 167 | fi
|
---|
| 168 | if [ "$portnumber" != "8080" ] ; then
|
---|
| 169 | sed "s|8080|${portnumber}|" $SITE/siteConfig.xml > $SITE/siteConfig.tmp && mv $SITE/siteConfig.tmp $SITE/siteConfig.xml
|
---|
| 170 | fi
|
---|
| 171 | fi
|
---|
| 172 | done
|
---|
| 173 |
|
---|
| 174 | ############################
|
---|
| 175 | # GSDL3 SCRIPTS
|
---|
| 176 | #############################
|
---|
| 177 |
|
---|
| 178 | # We also edit the GSDL3 launching script and the SOAP deployment script
|
---|
| 179 | cp gs3-launch.sh.in gs3-launch.sh
|
---|
| 180 | cp gs3-soap-deploy-site.sh.in gs3-soap-deploy-site.sh
|
---|
| 181 |
|
---|
| 182 | if [ "$hostname" != "localhost" ] ; then
|
---|
| 183 | sed "s|localhost|${hostname}|" gs3-launch.sh > gs3-launch.tmp && mv gs3-launch.tmp gs3-launch.sh
|
---|
| 184 | sed "s|localhost|${hostname}|" gs3-soap-deploy-site.sh > gs3-soap.tmp && mv gs3-soap.tmp gs3-soap-deploy-site.sh
|
---|
| 185 |
|
---|
| 186 | fi
|
---|
| 187 | if [ "$portnumber" != "8080" ] ; then
|
---|
| 188 | sed "s|8080|${portnumber}|" gs3-launch.sh > gs3-launch.tmp && mv gs3-launch.tmp gs3-launch.sh
|
---|
| 189 | sed "s|8080|${portnumber}|" gs3-soap-deploy-site.sh > gs3-soap.tmp && mv gs3-soap.tmp gs3-soap-deploy-site.sh
|
---|
| 190 | fi
|
---|
| 191 |
|
---|
| 192 | # Make them executable
|
---|
| 193 | chmod a+x gs3-launch.sh
|
---|
| 194 | chmod a+x gs3-soap-deploy-site.sh
|
---|
| 195 |
|
---|
| 196 | ############################
|
---|
| 197 | # UNPACK SAMPLE COLLECTIONS
|
---|
| 198 | ############################
|
---|
| 199 |
|
---|
| 200 | # how can we stop these being done more than once? and do we need to?
|
---|
| 201 | cd web/sites/localsite/collect
|
---|
| 202 | # unpack import, index and metadata
|
---|
| 203 | for f in */index; do
|
---|
| 204 | cd $f
|
---|
| 205 | if test -f index.zip; then
|
---|
| 206 | unzip index.zip
|
---|
| 207 | fi
|
---|
| 208 | cd ../../
|
---|
| 209 | done
|
---|
| 210 |
|
---|
[8051] | 211 | for f in *; do
|
---|
[7865] | 212 | cd $f
|
---|
| 213 | if test -f import.zip; then
|
---|
| 214 | unzip import.zip
|
---|
| 215 | fi
|
---|
[8076] | 216 | cd ../
|
---|
[7865] | 217 | done
|
---|
| 218 |
|
---|
| 219 | for f in */metadata; do
|
---|
| 220 | cd $f
|
---|
| 221 | if test -f metadata.zip; then
|
---|
| 222 | unzip metadata.zip
|
---|
| 223 | fi
|
---|
| 224 | cd ../../
|
---|
| 225 | done
|
---|
| 226 |
|
---|
| 227 | for f in */archives; do
|
---|
| 228 | cd $f
|
---|
| 229 | if test -f archives.zip; then
|
---|
| 230 | unzip archives.zip
|
---|
| 231 | fi
|
---|
| 232 | cd ../../
|
---|
| 233 | done
|
---|
| 234 |
|
---|
| 235 | cd $gsdl3home
|
---|
| 236 |
|
---|
| 237 | #######################
|
---|
| 238 | # COMPILATION
|
---|
| 239 | ######################
|
---|
| 240 |
|
---|
[7874] | 241 | echo "############################################################"
|
---|
[7865] | 242 | echo "Will now configure and make the code - this may take a while"
|
---|
[7874] | 243 | echo "############################################################"
|
---|
[7865] | 244 |
|
---|
| 245 | ./configure
|
---|
| 246 | make
|
---|
| 247 | make install
|
---|
| 248 | make docs
|
---|
| 249 |
|
---|
[8937] | 250 | # compile the test servlet
|
---|
| 251 | cd $gsdl3home/web/WEB-INF/classes
|
---|
| 252 | javac TestServlet.java
|
---|
| 253 | cd $gsdl3home
|
---|
| 254 |
|
---|
[7865] | 255 | #######################
|
---|
| 256 | # COPY JAR FILES
|
---|
| 257 | #######################
|
---|
| 258 |
|
---|
| 259 | # any jar files used by applets need to go into the web/lib directory. so we link to them
|
---|
| 260 | cd $gsdl3home/web/lib
|
---|
[8935] | 261 | ln -sf ../../lib/java/phind.jar
|
---|
| 262 | ln -sf ../../lib/java/xml-apis.jar
|
---|
| 263 | ln -sf ../../lib/java/xercesImpl.jar
|
---|
[7865] | 264 | cd $gsdl3home
|
---|
| 265 |
|
---|
| 266 |
|
---|
| 267 |
|
---|
| 268 | # And provide a nice little postscript
|
---|
| 269 | echo ""
|
---|
| 270 | echo "****************************************************************"
|
---|
| 271 | echo "Greenstone 3 - Installation Complete!"
|
---|
| 272 | echo ""
|
---|
| 273 | echo "Run ./gs3-launch.sh to start the web server"
|
---|
| 274 | echo ""
|
---|
| 275 | echo "****************************************************************"
|
---|
| 276 | echo ""
|
---|
| 277 |
|
---|
| 278 | exit 0
|
---|