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

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

fixed a typo

  • 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 mkdir var
130 mkdir var/log
131 chmod 777 var var/log
132
133 ./scripts/mysql_install_db --datadir=./data --basedir=. --user=root --force
134 ./bin/mysqld_safe --user=root --datadir=./data --basedir=. --pid_file=gsdl3.pid --socket=/tmp/mysql.sock --err-log=./var/log/mysql.log &
135 sleep 2
136 ./bin/mysql --user=root --execute="GRANT SELECT,INSERT,DELETE,UPDATE,DROP,CREATE ON *.* TO gsdl3admin@localhost;"
137 ./bin/mysql --user=root --execute="GRANT SELECT ON *.* TO gsdl3reader@localhost;"
138
139 # set up any sample collections databases
140 #gs3mgdemo
141 ./bin/mysql --user=root --execute="create database localsite_gs3mgdemo;"
142 ./bin/mysql --user=root localsite_gs3mgdemo < $gsdl3home/web/sites/localsite/collect/gs3mgdemo/mysqldatadump.sql
143
144 ./bin/mysqladmin --user=root --socket=/tmp/mysql.sock shutdown
145 cd $gsdl3home
146fi
147
148#################################
149# WEB.XML FILE
150#################################
151# Edit the web/WEB-INF/web.xml to set gsdl3home
152if [ ! -f ./web/WEB-INF/web.xml ]; then
153 sed "s|@gsdl3home@|${gsdl3home}|" ./web/WEB-INF/web.xml.in > ./web/WEB-INF/web.xml
154fi
155
156#################################
157# SITE CONFIG FILES
158#################################
159
160# Edit the siteConfig.xml found in any site within the sites folder - port and hostname
161for SITE in $gsdl3home/web/sites/*; do
162 if [ -f $SITE/siteConfig.xml ] ; then
163 echo "Processing $SITE"
164 if [ "$hostname" != "localhost" ] ; then
165 sed "s|localhost|${hostname}|" $SITE/siteConfig.xml > $SITE/siteConfig.tmp && mv $SITE/siteConfig.tmp $SITE/siteConfig.xml
166 fi
167 if [ "$portnumber" != "8080" ] ; then
168 sed "s|8080|${portnumber}|" $SITE/siteConfig.xml > $SITE/siteConfig.tmp && mv $SITE/siteConfig.tmp $SITE/siteConfig.xml
169 fi
170 fi
171done
172
173############################
174# GSDL3 SCRIPTS
175#############################
176
177# We also edit the GSDL3 launching script and the SOAP deployment script
178cp gs3-launch.sh.in gs3-launch.sh
179cp gs3-soap-deploy-site.sh.in gs3-soap-deploy-site.sh
180
181if [ "$hostname" != "localhost" ] ; then
182 sed "s|localhost|${hostname}|" gs3-launch.sh > gs3-launch.tmp && mv gs3-launch.tmp gs3-launch.sh
183 sed "s|localhost|${hostname}|" gs3-soap-deploy-site.sh > gs3-soap.tmp && mv gs3-soap.tmp gs3-soap-deploy-site.sh
184
185fi
186if [ "$portnumber" != "8080" ] ; then
187 sed "s|8080|${portnumber}|" gs3-launch.sh > gs3-launch.tmp && mv gs3-launch.tmp gs3-launch.sh
188 sed "s|8080|${portnumber}|" gs3-soap-deploy-site.sh > gs3-soap.tmp && mv gs3-soap.tmp gs3-soap-deploy-site.sh
189fi
190
191# Make them executable
192chmod a+x gs3-launch.sh
193chmod a+x gs3-soap-deploy-site.sh
194
195############################
196# UNPACK SAMPLE COLLECTIONS
197############################
198
199# how can we stop these being done more than once? and do we need to?
200cd web/sites/localsite/collect
201# unpack import, index and metadata
202for f in */index; do
203 cd $f
204 if test -f index.zip; then
205 unzip index.zip
206 fi
207 cd ../../
208done
209
210for f in *; do
211 cd $f
212 if test -f import.zip; then
213 unzip import.zip
214 fi
215 cd ../../
216done
217
218for f in */metadata; do
219 cd $f
220 if test -f metadata.zip; then
221 unzip metadata.zip
222 fi
223 cd ../../
224done
225
226for f in */archives; do
227 cd $f
228 if test -f archives.zip; then
229 unzip archives.zip
230 fi
231 cd ../../
232done
233
234cd $gsdl3home
235
236#######################
237# COMPILATION
238######################
239
240echo "############################################################"
241echo "Will now configure and make the code - this may take a while"
242echo "############################################################"
243
244./configure
245make
246make install
247make docs
248
249#######################
250# COPY JAR FILES
251#######################
252
253# any jar files used by applets need to go into the web/lib directory. so we link to them
254cd $gsdl3home/web/lib
255ln -s ../../lib/java/phind.jar
256ln -s ../../lib/java/xml-apis.jar
257ln -s ../../lib/java/xercesImpl.jar
258cd $gsdl3home
259
260
261
262# And provide a nice little postscript
263echo ""
264echo "****************************************************************"
265echo "Greenstone 3 - Installation Complete!"
266echo ""
267echo "Run ./gs3-launch.sh to start the web server"
268echo ""
269echo "****************************************************************"
270echo ""
271
272exit 0
Note: See TracBrowser for help on using the repository browser.