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

Last change on this file since 9475 was 9475, checked in by kjdon, 19 years ago

changed the organisation of the collections: metadata.zip and archives.zip are now at top level, not inside the sub dir

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