[6433] | 1 | #!/bin/sh
|
---|
| 2 |
|
---|
| 3 | ## gs3-finalise.sh -- Install Greenstone 3
|
---|
| 4 |
|
---|
[6913] | 5 | if [ ! -f gs3-setup.sh ]; then
|
---|
| 6 | echo "You must run this script from within the Greenstone home directory"
|
---|
| 7 | exit 1
|
---|
| 8 | fi
|
---|
| 9 |
|
---|
[6433] | 10 | #check that GSDL3HOME is set
|
---|
| 11 | if test -z "$GSDL3HOME" ; then
|
---|
[6913] | 12 | source gs3-setup.sh
|
---|
[6433] | 13 | fi
|
---|
[6913] | 14 |
|
---|
[6433] | 15 | gsdl3home=$GSDL3HOME
|
---|
| 16 | # Prompt for the computer name
|
---|
| 17 | hostname="localhost"
|
---|
| 18 | echo ""
|
---|
| 19 | echo "Enter the full address of the host computer from which the greenstone"
|
---|
| 20 | echo "collections will be served, for example:"
|
---|
| 21 | echo "bob.greenstone.ac.nz"
|
---|
| 22 | echo "or press enter for default [Default = localhost]."
|
---|
| 23 | echo ""
|
---|
| 24 | printf "%s" "> "
|
---|
| 25 | read ans
|
---|
| 26 | if [ "$ans" != "" ] ; then
|
---|
| 27 | hostname="$ans"
|
---|
| 28 | fi
|
---|
| 29 |
|
---|
| 30 | # Prompt for the port number
|
---|
| 31 | portnumber="8080"
|
---|
| 32 | echo ""
|
---|
| 33 | echo "Enter the port number that the tomcat webserver will serve on,"
|
---|
| 34 | echo "or press enter for default [Default = 8080]."
|
---|
| 35 | echo ""
|
---|
| 36 | printf "%s" "> "
|
---|
| 37 | read ans
|
---|
| 38 | if [ "$ans" != "" ] ; then
|
---|
| 39 | portnumber="$ans"
|
---|
| 40 | fi
|
---|
| 41 |
|
---|
| 42 | # Edit the comms/jakata/tomcat/conf/server.xml file and set the gsdl3home and hostname variables
|
---|
| 43 | sed "s|@gsdl3home@|${gsdl3home}|" ./comms/jakarta/tomcat/conf/server.xml.in > ./comms/jakarta/tomcat/conf/server.xml
|
---|
| 44 | if [ "$portnumber" != "8080" ] ; then
|
---|
| 45 | 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
|
---|
| 46 | fi
|
---|
| 47 |
|
---|
| 48 | # Edit the web/WEB-INF/web.xml to set gsdl3home
|
---|
| 49 | sed "s|@gsdl3home@|${gsdl3home}|" ./web/WEB-INF/web.xml.in > ./web/WEB-INF/web.xml
|
---|
| 50 |
|
---|
| 51 | # Edit the siteConfig.xml found in any site within the sites folder
|
---|
| 52 | for SITE in $gsdl3home/web/sites/*; do
|
---|
| 53 | if [ -f $SITE/siteConfig.xml ] ; then
|
---|
| 54 | echo "Processing $SITE"
|
---|
| 55 | if [ "$hostname" != "localhost" ] ; then
|
---|
| 56 | sed "s|localhost|${hostname}|" $SITE/siteConfig.xml > $SITE/siteConfig.tmp && mv $SITE/siteConfig.tmp $SITE/siteConfig.xml
|
---|
| 57 | fi
|
---|
| 58 | if [ "$portnumber" != "8080" ] ; then
|
---|
| 59 | sed "s|8080|${portnumber}|" $SITE/siteConfig.xml > $SITE/siteConfig.tmp && mv $SITE/siteConfig.tmp $SITE/siteConfig.xml
|
---|
| 60 | fi
|
---|
| 61 | fi
|
---|
| 62 | done
|
---|
| 63 |
|
---|
[6492] | 64 | # any jar files used by applets need to go into the web/lib directory. so we link to them
|
---|
| 65 | pushd $GSDL3HOME/web/lib
|
---|
| 66 | ln -s ../../lib/java/phind.jar
|
---|
| 67 | ln -s ../../lib/java/xml-apis.jar
|
---|
| 68 | ln -s ../../lib/java/xercesImpl.jar
|
---|
| 69 | popd
|
---|
| 70 |
|
---|
[6433] | 71 | # set up the sql db
|
---|
[6561] | 72 | user=`whoami`
|
---|
[6433] | 73 | pushd $GSDL3HOME/packages/mysql
|
---|
[6547] | 74 | ./bin/mysql_install_db --datadir=$GSDL3HOME/packages/mysql/var --basedir=$GSDL3HOME/packages/mysql --user=$user
|
---|
| 75 | ./bin/mysqld_safe --datadir=$GSDL3HOME/packages/mysql/var --basedir=$GSDL3HOME/packages/mysql &
|
---|
[6561] | 76 | sleep 2
|
---|
[6433] | 77 | ./bin/mysql --user=root --execute="GRANT SELECT,INSERT,DELETE,UPDATE,DROP,CREATE ON *.* TO gsdl3admin@localhost;"
|
---|
| 78 | ./bin/mysql --user=root --execute="GRANT SELECT ON *.* TO gsdl3reader@localhost;"
|
---|
| 79 | popd
|
---|
[6561] | 80 | ./gs3-mysql-server.sh stop
|
---|
[6433] | 81 |
|
---|
| 82 |
|
---|
[6459] | 83 | # We also edit the GSDL3 launching script and the SOAP deployment script
|
---|
[6913] | 84 | cp gs3-launch.sh.in gs3-launch.sh
|
---|
| 85 | cp gs3-soap-deploy-site.sh.in gs3-soap-deploy-site.sh
|
---|
| 86 |
|
---|
[6433] | 87 | if [ "$hostname" != "localhost" ] ; then
|
---|
| 88 | sed "s|localhost|${hostname}|" gs3-launch.sh > gs3-launch.tmp && mv gs3-launch.tmp gs3-launch.sh
|
---|
[6459] | 89 | sed "s|localhost|${hostname}|" gs3-soap-deploy-site.sh > gs3-soap.tmp && mv gs3-soap.tmp gs3-soap-deploy-site.sh
|
---|
| 90 |
|
---|
[6433] | 91 | fi
|
---|
| 92 | if [ "$portnumber" != "8080" ] ; then
|
---|
| 93 | sed "s|8080|${portnumber}|" gs3-launch.sh > gs3-launch.tmp && mv gs3-launch.tmp gs3-launch.sh
|
---|
[6459] | 94 | sed "s|8080|${portnumber}|" gs3-soap-deploy-site.sh > gs3-soap.tmp && mv gs3-soap.tmp gs3-soap-deploy-site.sh
|
---|
[6433] | 95 | fi
|
---|
| 96 |
|
---|
| 97 | # Make the GSDL3 script executable
|
---|
[6459] | 98 | chmod a+x gs3-launch.sh
|
---|
| 99 | chmod a+x gs3-soap-deploy-site.sh
|
---|
[6433] | 100 |
|
---|
| 101 | # And provide a nice little postscript
|
---|
| 102 | echo ""
|
---|
| 103 | echo "****************************************************************"
|
---|
| 104 | echo "Greenstone 3 - Installation Complete!"
|
---|
| 105 | echo ""
|
---|
| 106 | echo "Change to the folder denoted below and run gs3-launch.sh to start the"
|
---|
| 107 | echo "web server:"
|
---|
| 108 | echo ""
|
---|
| 109 | echo " $GSDL3HOME"
|
---|
| 110 | echo ""
|
---|
| 111 | echo "****************************************************************"
|
---|
| 112 | echo ""
|
---|
| 113 |
|
---|
| 114 | exit 0
|
---|