1 | #!/bin/sh
|
---|
2 |
|
---|
3 | ## gs3-finalise.sh -- Install Greenstone 3
|
---|
4 |
|
---|
5 | #check that GSDL3HOME is set
|
---|
6 | if test -z "$GSDL3HOME" ; then
|
---|
7 | echo "You need to 'source gs3-setup.sh' before running this script"
|
---|
8 | exit;
|
---|
9 | fi
|
---|
10 | gsdl3home=$GSDL3HOME
|
---|
11 | # Prompt for the computer name
|
---|
12 | hostname="localhost"
|
---|
13 | echo ""
|
---|
14 | echo "Enter the full address of the host computer from which the greenstone"
|
---|
15 | echo "collections will be served, for example:"
|
---|
16 | echo "bob.greenstone.ac.nz"
|
---|
17 | echo "or press enter for default [Default = localhost]."
|
---|
18 | echo ""
|
---|
19 | printf "%s" "> "
|
---|
20 | read ans
|
---|
21 | if [ "$ans" != "" ] ; then
|
---|
22 | hostname="$ans"
|
---|
23 | fi
|
---|
24 |
|
---|
25 | # Prompt for the port number
|
---|
26 | portnumber="8080"
|
---|
27 | echo ""
|
---|
28 | echo "Enter the port number that the tomcat webserver will serve on,"
|
---|
29 | echo "or press enter for default [Default = 8080]."
|
---|
30 | echo ""
|
---|
31 | printf "%s" "> "
|
---|
32 | read ans
|
---|
33 | if [ "$ans" != "" ] ; then
|
---|
34 | portnumber="$ans"
|
---|
35 | fi
|
---|
36 |
|
---|
37 | # Edit the comms/jakata/tomcat/conf/server.xml file and set the gsdl3home and hostname variables
|
---|
38 | sed "s|@gsdl3home@|${gsdl3home}|" ./comms/jakarta/tomcat/conf/server.xml.in > ./comms/jakarta/tomcat/conf/server.xml
|
---|
39 | if [ "$portnumber" != "8080" ] ; then
|
---|
40 | 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
|
---|
41 | fi
|
---|
42 |
|
---|
43 | # Edit the web/WEB-INF/web.xml to set gsdl3home
|
---|
44 | sed "s|@gsdl3home@|${gsdl3home}|" ./web/WEB-INF/web.xml.in > ./web/WEB-INF/web.xml
|
---|
45 |
|
---|
46 | # Edit the siteConfig.xml found in any site within the sites folder
|
---|
47 | for SITE in $gsdl3home/web/sites/*; do
|
---|
48 | if [ -f $SITE/siteConfig.xml ] ; then
|
---|
49 | echo "Processing $SITE"
|
---|
50 | if [ "$hostname" != "localhost" ] ; then
|
---|
51 | sed "s|localhost|${hostname}|" $SITE/siteConfig.xml > $SITE/siteConfig.tmp && mv $SITE/siteConfig.tmp $SITE/siteConfig.xml
|
---|
52 | fi
|
---|
53 | if [ "$portnumber" != "8080" ] ; then
|
---|
54 | sed "s|8080|${portnumber}|" $SITE/siteConfig.xml > $SITE/siteConfig.tmp && mv $SITE/siteConfig.tmp $SITE/siteConfig.xml
|
---|
55 | fi
|
---|
56 | fi
|
---|
57 | done
|
---|
58 |
|
---|
59 | # any jar files used by applets need to go into the web/lib directory. so we link to them
|
---|
60 | pushd $GSDL3HOME/web/lib
|
---|
61 | ln -s ../../lib/java/phind.jar
|
---|
62 | ln -s ../../lib/java/xml-apis.jar
|
---|
63 | ln -s ../../lib/java/xercesImpl.jar
|
---|
64 | popd
|
---|
65 |
|
---|
66 | # set up the sql db
|
---|
67 | user=`whoami`
|
---|
68 | pushd $GSDL3HOME/packages/mysql
|
---|
69 | ./bin/mysql_install_db --datadir=$GSDL3HOME/packages/mysql/var --basedir=$GSDL3HOME/packages/mysql --user=$user
|
---|
70 | ./bin/mysqld_safe --datadir=$GSDL3HOME/packages/mysql/var --basedir=$GSDL3HOME/packages/mysql &
|
---|
71 | sleep 2
|
---|
72 | ./bin/mysql --user=root --execute="GRANT SELECT,INSERT,DELETE,UPDATE,DROP,CREATE ON *.* TO gsdl3admin@localhost;"
|
---|
73 | ./bin/mysql --user=root --execute="GRANT SELECT ON *.* TO gsdl3reader@localhost;"
|
---|
74 | popd
|
---|
75 | ./gs3-mysql-server.sh stop
|
---|
76 |
|
---|
77 |
|
---|
78 | # We also edit the GSDL3 launching script and the SOAP deployment script
|
---|
79 | if [ "$hostname" != "localhost" ] ; then
|
---|
80 | sed "s|localhost|${hostname}|" gs3-launch.sh > gs3-launch.tmp && mv gs3-launch.tmp gs3-launch.sh
|
---|
81 | sed "s|localhost|${hostname}|" gs3-soap-deploy-site.sh > gs3-soap.tmp && mv gs3-soap.tmp gs3-soap-deploy-site.sh
|
---|
82 |
|
---|
83 | fi
|
---|
84 | if [ "$portnumber" != "8080" ] ; then
|
---|
85 | sed "s|8080|${portnumber}|" gs3-launch.sh > gs3-launch.tmp && mv gs3-launch.tmp gs3-launch.sh
|
---|
86 | sed "s|8080|${portnumber}|" gs3-soap-deploy-site.sh > gs3-soap.tmp && mv gs3-soap.tmp gs3-soap-deploy-site.sh
|
---|
87 | fi
|
---|
88 |
|
---|
89 | # Make the GSDL3 script executable
|
---|
90 | chmod a+x gs3-launch.sh
|
---|
91 | chmod a+x gs3-soap-deploy-site.sh
|
---|
92 |
|
---|
93 | # And provide a nice little postscript
|
---|
94 | echo ""
|
---|
95 | echo "****************************************************************"
|
---|
96 | echo "Greenstone 3 - Installation Complete!"
|
---|
97 | echo ""
|
---|
98 | echo "Change to the folder denoted below and run gs3-launch.sh to start the"
|
---|
99 | echo "web server:"
|
---|
100 | echo ""
|
---|
101 | echo " $GSDL3HOME"
|
---|
102 | echo ""
|
---|
103 | echo "****************************************************************"
|
---|
104 | echo ""
|
---|
105 |
|
---|
106 | exit 0
|
---|