source: trunk/gsdl3/gs3-install.sh@ 7988

Last change on this file since 7988 was 7975, checked in by kjdon, 20 years ago

added a few more args to mysql scripts

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 7.6 KB
Line 
1#!/bin/sh
2
3if [ ! -f gs3-setup.sh ]; then
4 echo "You must run this script from within the Greenstone 3 home directory"
5 exit 1
6fi
7
8source gs3-setup.sh
9
10gsdl3home=$GSDL3HOME
11
12#########################
13# CHECK NECESSARY BITS
14#########################
15if test -z "$CVSROOT" ; then
16 echo "You need to set the environment variable CVSROOT before running"
17 echo "this script. Please use the same path that you used to check out"
18 echo "the Greentone repository. If you are not using anonymous cvs, you"
19 echo "also need to set the variable CVS_RSH to ssh."
20 exit;
21fi
22
23############################
24# GET INFO FROM USER
25############################
26
27# Prompt for the computer name
28hostname="localhost"
29echo ""
30echo "Enter the full address of the host computer from which the greenstone"
31echo "collections will be served, for example:"
32echo "bob.greenstone.ac.nz"
33echo "or press enter for default [Default = localhost]."
34echo ""
35printf "%s" "> "
36read ans
37if [ "$ans" != "" ] ; then
38 hostname="$ans"
39fi
40
41# Prompt for the port number
42portnumber="8080"
43echo ""
44echo "Enter the port number that the tomcat webserver will serve on,"
45echo "or press enter for default [Default = 8080]."
46echo ""
47printf "%s" "> "
48read ans
49if [ "$ans" != "" ] ; then
50 portnumber="$ans"
51fi
52
53#################################
54# CHECKOUT ALL THE BITS FROM CVS
55#################################
56
57# firstly, remove unwanted directories
58cvs update -dRP
59
60# now check out extra bits
61cd packages
62if [ ! -d mgpp ]; then
63 cvs co -P mgpp
64fi
65cd $gsdl3home
66
67###############################
68# SETUP TOMCAT
69###############################
70
71cd comms/jakarta/
72# unpack tomcat and rename directory
73if [ ! -d tomcat ]; then
74 unzip jakarta-tomcat-4.1.30.zip
75 mv jakarta-tomcat-4.1.30 tomcat
76fi
77
78#edit the tomcat setclasspath script to add our classpath
79if [ ! -f ./tomcat/bin/setclasspath.sh.orig ]; then
80 mv ./tomcat/bin/setclasspath.sh ./tomcat/bin/setclasspath.sh.orig
81 cat ./tomcat/bin/setclasspath.sh.orig | sed 's,CLASSPATH=,CLASSPATH=\"$CLASSPATH\":,' > ./tomcat/bin/setclasspath.sh
82fi
83
84# copy the modified server.xml into tomcat
85if [ ! -f ./tomcat/conf/server-withexamples.xml.config]; then
86 mv ./tomcat/conf/server.xml ./tomcat/conf/server-withexamples.xml.config
87 cat server.xml.in | sed "s|@gsdl3home@|${gsdl3home}|" > ./tomcat/conf/server.xml
88fi
89
90# Edit the server.xml config file to set the port number
91if [ "$portnumber" != "8080" ] ; then
92 cat ./tomcat/conf/server.xml | sed "s|8080|${portnumber}|" > server.xml.tmp
93 mv server.xml.tmp ./tomcat/conf/server.xml
94fi
95
96#make everyone happy by giving the right permissions to the shell scripts
97chmod a+x ./tomcat/bin/*.sh
98
99cd $gsdl3home
100
101###############################
102# SETUP SOAP
103###############################
104cd comms/soap
105# unpack soap and rename directory
106if [ ! -d soap ]; then
107 unzip soap-bin-2.3.1.zip
108 mv soap-2_3_1 soap
109 cp soap/lib/soap.jar $gsdl3home/lib/java
110# move the localsite deployment description into the soap webapp - localsite comes predeployed
111 cp DeployedServices.ds soap/webapps/soap/
112 # disable soap by renaming the web.xml file
113 mv ./soap/webapps/soap/WEB-INF/web.xml ./soap/webapps/soap/WEB-INF/web.xml.disabled
114fi
115cd $gsdl3home
116
117#edit the SOAPServer config file
118if [ ! -f ./resources/java/SOAPServer.cfg ]; then
119 sed "s|@gsdl3home@|${gsdl3home}|" ./resources/java/SOAPServer.cfg.in > ./resources/java/SOAPServer.cfg
120fi
121
122################################
123# SETUP MYSQL + SAMPLE DATABASES
124################################
125
126if [ ! -d packages/mysql/data ]; then
127 cd packages/mysql
128 unzip mysql-4.0.20-linux.zip
129
130 ./scripts/mysql_install_db --datadir=./data --basedir=. --user=root --force
131 ./bin/mysqld_safe --user=root --datadir=./data --basedir=. --pid_file=gsdl3.pid --socket=/tmp/mysql.sock --err-log=./var/log/mysql.log &
132 sleep 2
133 ./bin/mysql --user=root --execute="GRANT SELECT,INSERT,DELETE,UPDATE,DROP,CREATE ON *.* TO gsdl3admin@localhost;"
134 ./bin/mysql --user=root --execute="GRANT SELECT ON *.* TO gsdl3reader@localhost;"
135
136 # set up any sample collections databases
137 #gs3mgdemo
138 ./bin/mysql --user=root --execute="create database localsite_gs3mgdemo;"
139 ./bin/mysql --user=root localsite_gs3mgdemo < $gsdl3home/web/sites/localsite/collect/gs3mgdemo/mysqldatadump.sql
140
141 ./bin/mysqladmin --user=root --socket=/tmp/mysql.sock shutdown
142 cd $gsdl3home
143fi
144
145#################################
146# WEB.XML FILE
147#################################
148# Edit the web/WEB-INF/web.xml to set gsdl3home
149if [ ! -f ./web/WEB-INF/web.xml ]; then
150 sed "s|@gsdl3home@|${gsdl3home}|" ./web/WEB-INF/web.xml.in > ./web/WEB-INF/web.xml
151fi
152
153#################################
154# SITE CONFIG FILES
155#################################
156
157# Edit the siteConfig.xml found in any site within the sites folder - port and hostname
158for SITE in $gsdl3home/web/sites/*; do
159 if [ -f $SITE/siteConfig.xml ] ; then
160 echo "Processing $SITE"
161 if [ "$hostname" != "localhost" ] ; then
162 sed "s|localhost|${hostname}|" $SITE/siteConfig.xml > $SITE/siteConfig.tmp && mv $SITE/siteConfig.tmp $SITE/siteConfig.xml
163 fi
164 if [ "$portnumber" != "8080" ] ; then
165 sed "s|8080|${portnumber}|" $SITE/siteConfig.xml > $SITE/siteConfig.tmp && mv $SITE/siteConfig.tmp $SITE/siteConfig.xml
166 fi
167 fi
168done
169
170############################
171# GSDL3 SCRIPTS
172#############################
173
174# We also edit the GSDL3 launching script and the SOAP deployment script
175cp gs3-launch.sh.in gs3-launch.sh
176cp gs3-soap-deploy-site.sh.in gs3-soap-deploy-site.sh
177
178if [ "$hostname" != "localhost" ] ; then
179 sed "s|localhost|${hostname}|" gs3-launch.sh > gs3-launch.tmp && mv gs3-launch.tmp gs3-launch.sh
180 sed "s|localhost|${hostname}|" gs3-soap-deploy-site.sh > gs3-soap.tmp && mv gs3-soap.tmp gs3-soap-deploy-site.sh
181
182fi
183if [ "$portnumber" != "8080" ] ; then
184 sed "s|8080|${portnumber}|" gs3-launch.sh > gs3-launch.tmp && mv gs3-launch.tmp gs3-launch.sh
185 sed "s|8080|${portnumber}|" gs3-soap-deploy-site.sh > gs3-soap.tmp && mv gs3-soap.tmp gs3-soap-deploy-site.sh
186fi
187
188# Make them executable
189chmod a+x gs3-launch.sh
190chmod a+x gs3-soap-deploy-site.sh
191
192############################
193# UNPACK SAMPLE COLLECTIONS
194############################
195
196# how can we stop these being done more than once? and do we need to?
197cd web/sites/localsite/collect
198# unpack import, index and metadata
199for f in */index; do
200 cd $f
201 if test -f index.zip; then
202 unzip index.zip
203 fi
204 cd ../../
205done
206
207for f in */import; do
208 cd $f
209 if test -f import.zip; then
210 unzip import.zip
211 fi
212 cd ../../
213done
214
215for f in */metadata; do
216 cd $f
217 if test -f metadata.zip; then
218 unzip metadata.zip
219 fi
220 cd ../../
221done
222
223for f in */archives; do
224 cd $f
225 if test -f archives.zip; then
226 unzip archives.zip
227 fi
228 cd ../../
229done
230
231cd $gsdl3home
232
233#######################
234# COMPILATION
235######################
236
237echo "############################################################"
238echo "Will now configure and make the code - this may take a while"
239echo "############################################################"
240
241./configure
242make
243make install
244make docs
245
246#######################
247# COPY JAR FILES
248#######################
249
250# any jar files used by applets need to go into the web/lib directory. so we link to them
251cd $gsdl3home/web/lib
252ln -s ../../lib/java/phind.jar
253ln -s ../../lib/java/xml-apis.jar
254ln -s ../../lib/java/xercesImpl.jar
255cd $gsdl3home
256
257
258
259# And provide a nice little postscript
260echo ""
261echo "****************************************************************"
262echo "Greenstone 3 - Installation Complete!"
263echo ""
264echo "Run ./gs3-launch.sh to start the web server"
265echo ""
266echo "****************************************************************"
267echo ""
268
269exit 0
Note: See TracBrowser for help on using the repository browser.