#!/bin/sh ## gs3-finalise.sh -- Install Greenstone 3 #check that GSDL3HOME is set if test -z "$GSDL3HOME" ; then echo "You need to 'source gs3-setup.sh' before running this script" exit; fi gsdl3home=$GSDL3HOME # Prompt for the computer name hostname="localhost" echo "" echo "Enter the full address of the host computer from which the greenstone" echo "collections will be served, for example:" echo "bob.greenstone.ac.nz" echo "or press enter for default [Default = localhost]." echo "" printf "%s" "> " read ans if [ "$ans" != "" ] ; then hostname="$ans" fi # Prompt for the port number portnumber="8080" echo "" echo "Enter the port number that the tomcat webserver will serve on," echo "or press enter for default [Default = 8080]." echo "" printf "%s" "> " read ans if [ "$ans" != "" ] ; then portnumber="$ans" fi # Edit the comms/jakata/tomcat/conf/server.xml file and set the gsdl3home and hostname variables sed "s|@gsdl3home@|${gsdl3home}|" ./comms/jakarta/tomcat/conf/server.xml.in > ./comms/jakarta/tomcat/conf/server.xml if [ "$portnumber" != "8080" ] ; then sed "s|8080|${portnumber}|" ./comms/jakarta/tomcat/conf/server.xml > ./comms/jakarta/tomcat/conf/server.tmp && mv ./comms/jakarta/tomcat/conf/server.tmp ./comms/jakarta/tomcat/conf/server.xml fi # Edit the web/WEB-INF/web.xml to set gsdl3home sed "s|@gsdl3home@|${gsdl3home}|" ./web/WEB-INF/web.xml.in > ./web/WEB-INF/web.xml # Edit the siteConfig.xml found in any site within the sites folder for SITE in $gsdl3home/web/sites/*; do if [ -f $SITE/siteConfig.xml ] ; then echo "Processing $SITE" if [ "$hostname" != "localhost" ] ; then sed "s|localhost|${hostname}|" $SITE/siteConfig.xml > $SITE/siteConfig.tmp && mv $SITE/siteConfig.tmp $SITE/siteConfig.xml fi if [ "$portnumber" != "8080" ] ; then sed "s|8080|${portnumber}|" $SITE/siteConfig.xml > $SITE/siteConfig.tmp && mv $SITE/siteConfig.tmp $SITE/siteConfig.xml fi fi done # any jar files used by applets need to go into the web/lib directory. so we link to them pushd $GSDL3HOME/web/lib ln -s ../../lib/java/phind.jar ln -s ../../lib/java/xml-apis.jar ln -s ../../lib/java/xercesImpl.jar popd # set up the sql db user=`whoami` pushd $GSDL3HOME/packages/mysql ./bin/mysql_install_db --datadir=$GSDL3HOME/packages/mysql/var --basedir=$GSDL3HOME/packages/mysql --user=$user ./bin/mysqld_safe --datadir=$GSDL3HOME/packages/mysql/var --basedir=$GSDL3HOME/packages/mysql & sleep 2 ./bin/mysql --user=root --execute="GRANT SELECT,INSERT,DELETE,UPDATE,DROP,CREATE ON *.* TO gsdl3admin@localhost;" ./bin/mysql --user=root --execute="GRANT SELECT ON *.* TO gsdl3reader@localhost;" popd ./gs3-mysql-server.sh stop # We also edit the GSDL3 launching script and the SOAP deployment script if [ "$hostname" != "localhost" ] ; then sed "s|localhost|${hostname}|" gs3-launch.sh > gs3-launch.tmp && mv gs3-launch.tmp gs3-launch.sh sed "s|localhost|${hostname}|" gs3-soap-deploy-site.sh > gs3-soap.tmp && mv gs3-soap.tmp gs3-soap-deploy-site.sh fi if [ "$portnumber" != "8080" ] ; then sed "s|8080|${portnumber}|" gs3-launch.sh > gs3-launch.tmp && mv gs3-launch.tmp gs3-launch.sh sed "s|8080|${portnumber}|" gs3-soap-deploy-site.sh > gs3-soap.tmp && mv gs3-soap.tmp gs3-soap-deploy-site.sh fi # Make the GSDL3 script executable chmod a+x gs3-launch.sh chmod a+x gs3-soap-deploy-site.sh # And provide a nice little postscript echo "" echo "****************************************************************" echo "Greenstone 3 - Installation Complete!" echo "" echo "Change to the folder denoted below and run gs3-launch.sh to start the" echo "web server:" echo "" echo " $GSDL3HOME" echo "" echo "****************************************************************" echo "" exit 0