source: trunk/gsdl3/gs3-finalise.sh@ 6683

Last change on this file since 6683 was 6561, checked in by kjdon, 20 years ago

fixed some bugs

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