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

Last change on this file since 7355 was 6915, checked in by kjdon, 20 years ago

oops, last commit I left in an exit; that wasn't supposed to be there

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