1 | #!/bin/sh
|
---|
2 |
|
---|
3 | ## gs3-finalise.sh -- Install Greenstone 3
|
---|
4 |
|
---|
5 | if [ ! -f gs3-setup.sh ]; then
|
---|
6 | echo "You must run this script from within the Greenstone home directory"
|
---|
7 | exit 1
|
---|
8 | fi
|
---|
9 |
|
---|
10 | #check that GSDL3HOME is set
|
---|
11 | source gs3-setup.sh
|
---|
12 |
|
---|
13 | gsdl3home=$GSDL3HOME
|
---|
14 | # Prompt for the computer name
|
---|
15 | hostname="localhost"
|
---|
16 | echo ""
|
---|
17 | echo "Enter the full address of the host computer from which the greenstone"
|
---|
18 | echo "collections will be served, for example:"
|
---|
19 | echo "bob.greenstone.ac.nz"
|
---|
20 | echo "or press enter for default [Default = localhost]."
|
---|
21 | echo ""
|
---|
22 | printf "%s" "> "
|
---|
23 | read ans
|
---|
24 | if [ "$ans" != "" ] ; then
|
---|
25 | hostname="$ans"
|
---|
26 | fi
|
---|
27 |
|
---|
28 | # Prompt for the port number
|
---|
29 | portnumber="8080"
|
---|
30 | echo ""
|
---|
31 | echo "Enter the port number that the tomcat webserver will serve on,"
|
---|
32 | echo "or press enter for default [Default = 8080]."
|
---|
33 | echo ""
|
---|
34 | printf "%s" "> "
|
---|
35 | read ans
|
---|
36 | if [ "$ans" != "" ] ; then
|
---|
37 | portnumber="$ans"
|
---|
38 | fi
|
---|
39 |
|
---|
40 | # Edit the comms/jakata/tomcat/conf/server.xml file and set the port variable
|
---|
41 | if [ "$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
|
---|
43 | fi
|
---|
44 |
|
---|
45 | # Edit the siteConfig.xml found in any site within the sites folder - port and hostname
|
---|
46 | for 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
|
---|
56 | done
|
---|
57 |
|
---|
58 | # any jar files used by applets need to go into the web/lib directory. so we link to them
|
---|
59 | pushd $GSDL3HOME/web/lib
|
---|
60 | ln -s ../../lib/java/phind.jar
|
---|
61 | ln -s ../../lib/java/xml-apis.jar
|
---|
62 | ln -s ../../lib/java/xercesImpl.jar
|
---|
63 | popd
|
---|
64 |
|
---|
65 | # set up the sql db
|
---|
66 | user=`whoami`
|
---|
67 | pushd $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 &
|
---|
70 | sleep 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 |
|
---|
79 | popd
|
---|
80 | ./gs3-mysql-server.sh stop
|
---|
81 |
|
---|
82 |
|
---|
83 | # We also edit the GSDL3 launching script and the SOAP deployment script
|
---|
84 | cp gs3-launch.sh.in gs3-launch.sh
|
---|
85 | cp gs3-soap-deploy-site.sh.in gs3-soap-deploy-site.sh
|
---|
86 |
|
---|
87 | if [ "$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 |
|
---|
91 | fi
|
---|
92 | if [ "$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
|
---|
95 | fi
|
---|
96 |
|
---|
97 | # Make the GSDL3 script executable
|
---|
98 | chmod a+x gs3-launch.sh
|
---|
99 | chmod a+x gs3-soap-deploy-site.sh
|
---|
100 |
|
---|
101 | # And provide a nice little postscript
|
---|
102 | echo ""
|
---|
103 | echo "****************************************************************"
|
---|
104 | echo "Greenstone 3 - Installation Complete!"
|
---|
105 | echo ""
|
---|
106 | echo "Change to the folder denoted below and run ./gs3-launch.sh to start the"
|
---|
107 | echo "web server:"
|
---|
108 | echo ""
|
---|
109 | echo " $GSDL3HOME"
|
---|
110 | echo ""
|
---|
111 | echo "****************************************************************"
|
---|
112 | echo ""
|
---|
113 |
|
---|
114 | exit 0
|
---|