source: trunk/gli/gli.sh@ 6624

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

removed johns paths

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 5.8 KB
Line 
1#!/bin/sh
2
3echo
4echo 'Greenstone Librarian Interface (GLI)'
5echo 'Copyright (C) 2003 The New Zealand Digital Library Project, University Of Waikato'
6echo 'GLI comes with ABSOLUTELY NO WARRANTY; for details see LICENSE.txt'
7echo 'This is free software, and you are welcome to redistribute it'
8echo
9
10## -------- Run the Greenstone Librarian Interface --------
11
12# This script must be run from within the directory in which it lives
13thisdir=`pwd`
14if [ ! -f "${thisdir}/gli.sh" ]; then
15 echo "This script must be run from the directory in which it resides."
16 exit 1
17fi
18
19
20## ---- Determine GSDLHOME ----
21gsdlpath=
22
23# Some users may set the above line manually
24if [ "$gsdlpath" == "" ]; then
25 # Check the environment variable first
26 if [ "$GSDLHOME" != "" ]; then
27 gsdlpath=$GSDLHOME
28
29 # If it is not set, assume that the GLI is installed as a subdirectory of Greenstone
30 else
31 pushd .. > /dev/null
32 gsdlpath=`pwd`
33 popd > /dev/null
34 fi
35fi
36
37# Check that the Greenstone installation looks OK
38echo "Checking GSDL: $gsdlpath"
39if [ ! -f "${gsdlpath}/setup.bash" ] ; then
40 echo
41 echo "The Greenstone installation could not be found, or is incomplete."
42 echo "Try reinstalling Greenstone then running this script again."
43 exit 1
44fi
45
46# Setup Greenstone, unless it has already been done
47if [ "$GSDLHOME" == "" ]; then
48 pushd $gsdlpath > /dev/null
49 source setup.bash
50 popd > /dev/null
51fi
52
53
54## ---- Check Perl exists ----
55perlpath=
56
57# Some users may set the above line manually
58if [ "$perlpath" == "" ]; then
59 # Check if Perl is on the search path
60 perlpath=`which perl 2> /dev/null`
61fi
62
63# Check that a Perl executable has been found
64echo "Checking Perl: $perlpath"
65if [ ! -x "$perlpath" ] ; then
66 echo
67 echo "The Greenstone Librarian Interface requires perl in order to operate,"
68 echo "but perl could not be detected on your system. Please ensure that perl"
69 echo "is installed and is on your search path, then rerun this script."
70 exit 1
71fi
72
73
74## ---- Check Java exists ----
75javapath=
76
77# Some users may set the above line manually
78if [ "$javapath" == "" ]; then
79
80 # If it is set, use the JAVA_HOME environment variable
81 if [ "$JAVA_HOME" != "" ]; then
82 javapath="$JAVA_HOME/bin/java"
83
84 # Check if Java is on the search path
85 else
86 javapath=`which java 2> /dev/null`
87 fi
88fi
89
90# Check that a Java executable has been found
91echo "Checking Java: $javapath"
92if [ ! -x "$javapath" ]; then
93 echo
94 echo "Failed to locate an appropriate version of Java. You must install a"
95 echo "Java Runtime Environment (version 1.4 or greater) before running the"
96 echo "Greenstone Librarian Interface."
97 exit 1
98fi
99
100
101## -- Check the version of Java is new enough (1.4.0 or higher) to run the GLI --
102javaversion=`$javapath -version 2>&1 | sed -n 's/^java version \"\(.*\)\"/\1/p'`
103jvmajor=`echo $javaversion | sed -n 's/^\([0-9]*\).*$/\1/p'`
104jvminor=`echo $javaversion | sed -n 's/^[0-9]*\.\([0-9]*\).*$/\1/p'`
105
106jok=1
107if [ $jvmajor -lt 1 ] ; then
108 jok=0
109fi
110if [ $jvmajor -eq 1 ] && [ $jvminor -lt 4 ] ; then
111 jok=0
112fi
113if [ $jok -eq 0 ] ; then
114 echo
115 echo "The version of the Java Runtime Environment you have installed is too"
116 echo "old to run the Greenstone Librarian Interface. Please install a new"
117 echo "version of the JRE (version 1.4 or newer) and rerun this script."
118 exit 1
119fi
120
121## ---- Check WGet exists ----
122wgetpath=
123
124wok="NoWGet"
125# Some users may set the above line manually
126if [ "$wgetpath" == "" ]; then
127 # Check if WGet is on the search path
128 wgetpath=`which wget 2> /dev/null`
129fi
130
131# Check that a WGet executable has been found
132echo "Checking WGet: $wgetpath"
133if [ ! -x "$wgetpath" ]; then
134 echo
135 echo "Failed to locate an appropriate version of WGet. Web mirroring will"
136 echo "be disabled. Greenstone Librarian Interface requires WGet installed"
137 echo "in order to fully access this feature."
138else
139 ## -- Check the version of WGet is new enough (1.9 or higher) to run properly --
140 wgetversion=`$wgetpath --version 2>&1 | sed -n 's/^GNU Wget \(.*\)/\1/p'`
141 wvmajor=`echo $wgetversion | sed -n 's/^\([0-9]*\).*$/\1/p'`
142 wvminor=`echo $wgetversion | sed -n 's/^[0-9]*\.\(.*\)$/\1/p'`
143
144 wok="WGet1.9"
145 if [ $wvmajor -lt 1 ] ; then
146 wok="<WGet1.9"
147 fi
148 if [ $wvmajor -eq 1 ] && [ $wvminor -lt 9 ] ; then
149 wok="<WGet1.9"
150 fi
151 if [ $wok == "<WGet1.9" ] ; then
152 echo
153 echo "The version of the WGet you have installed has a known bug when"
154 echo "mirroring files which contain encoded characters such as space and"
155 echo "tilde in their URL. While this shouldn't be a problem, we recommend"
156 echo "installing WGet 1.9 or higher."
157 fi
158fi
159
160## ---- Check that the GLI has been compiled ----
161if [ ! -f "classes/org/greenstone/gatherer/Gatherer.class" ] && [ ! -f "GLI.jar" ]; then
162 echo
163 echo "You need to compile the Greenstone Librarian Interface (using makegli.sh)"
164 echo "before running this script."
165 exit 1
166fi
167
168if [ "$1" == "-test" ]; then
169 echo "Testing class: $2"
170 echo "arguments $*"
171 java -classpath classes/:GLI.jar:lib/apache.jar:lib/calpa.jar:lib/jp.jar:lib/polloxml.jar:lib/qfslib.jar:lib/skinlf.jar $2 $3
172 exit 1
173fi
174
175## ---- Finally, run the GLI ----
176echo
177echo "Running the Greenstone Librarian Interface..."
178
179# Other arguments you can provide to GLI to work around memory limitations, or debug
180# -Xms<number>M To set minimum memory (by default 32MB)
181# -Xmx<number>M To set maximum memory (by default the nearest 2^n to the total remaining physical memory)
182# -verbose:gc To set garbage collection messages
183# -Xincgc For incremental garbage collection (significantly slows performance)
184# -Xprof Function call profiling
185# -Xloggc:<file> Write garbage collection log
186
187java -classpath classes/:GLI.jar:lib/apache.jar:lib/calpa.jar:lib/jp.jar:lib/polloxml.jar:lib/qfslib.jar:lib/skinlf.jar org.greenstone.gatherer.Gatherer -gsdl $GSDLHOME -wget $wok$wgetpath $*
188
189echo "Done!"
Note: See TracBrowser for help on using the repository browser.