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

Last change on this file since 7847 was 7836, checked in by kjdon, 20 years ago

our machines have permission denied for hostname command. so we don't need to rely on this, we will explicitly set the pid_file and err_log to be gsdl3.pid and gsdl3.log, rather than hostname.pid... hope this doesn't cause any trouble elsewhere.

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 3.9 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
11source gs3-setup.sh
12
13gsdl3home=$GSDL3HOME
14# Prompt for the computer name
15hostname="localhost"
16echo ""
17echo "Enter the full address of the host computer from which the greenstone"
18echo "collections will be served, for example:"
19echo "bob.greenstone.ac.nz"
20echo "or press enter for default [Default = localhost]."
21echo ""
22printf "%s" "> "
23read ans
24if [ "$ans" != "" ] ; then
25 hostname="$ans"
26fi
27
28# Prompt for the port number
29portnumber="8080"
30echo ""
31echo "Enter the port number that the tomcat webserver will serve on,"
32echo "or press enter for default [Default = 8080]."
33echo ""
34printf "%s" "> "
35read ans
36if [ "$ans" != "" ] ; then
37 portnumber="$ans"
38fi
39
40# Edit the comms/jakata/tomcat/conf/server.xml file and set the port variable
41if [ "$portnumber" != "8080" ] ; then
42 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
43fi
44
45# Edit the siteConfig.xml found in any site within the sites folder - port and hostname
46for SITE in $gsdl3home/web/sites/*; do
47 if [ -f $SITE/siteConfig.xml ] ; then
48 echo "Processing $SITE"
49 if [ "$hostname" != "localhost" ] ; then
50 sed "s|localhost|${hostname}|" $SITE/siteConfig.xml > $SITE/siteConfig.tmp && mv $SITE/siteConfig.tmp $SITE/siteConfig.xml
51 fi
52 if [ "$portnumber" != "8080" ] ; then
53 sed "s|8080|${portnumber}|" $SITE/siteConfig.xml > $SITE/siteConfig.tmp && mv $SITE/siteConfig.tmp $SITE/siteConfig.xml
54 fi
55 fi
56done
57
58# any jar files used by applets need to go into the web/lib directory. so we link to them
59pushd $GSDL3HOME/web/lib
60ln -s ../../lib/java/phind.jar
61ln -s ../../lib/java/xml-apis.jar
62ln -s ../../lib/java/xercesImpl.jar
63popd
64
65# set up the sql db
66user=`whoami`
67pushd $GSDL3HOME/packages/mysql
68./bin/mysql_install_db --datadir=$GSDL3HOME/packages/mysql/var --basedir=$GSDL3HOME/packages/mysql --user=$user
69./bin/mysqld_safe --datadir=$GSDL3HOME/packages/mysql/var --basedir=$GSDL3HOME/packages/mysql --pid_file=$GSDL3HOME/packages/mysql/var/gsdl3.pid --err-log=$GSDL3HOME/packages/mysql/var/gsdl3.err &
70sleep 2
71./bin/mysql --user=root --execute="GRANT SELECT,INSERT,DELETE,UPDATE,DROP,CREATE ON *.* TO gsdl3admin@localhost;"
72./bin/mysql --user=root --execute="GRANT SELECT ON *.* TO gsdl3reader@localhost;"
73
74# set up any sample collections databases
75#gs3mgdemo
76./bin/mysql --user=root --execute="create database localsite_gs3mgdemo;"
77./bin/mysql --user=root localsite_gs3mgdemo < $GSDL3HOME/web/sites/localsite/collect/gs3mgdemo/mysqldatadump.sql
78
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.