source: trunk/gli/gli.sh@ 6670

Last change on this file since 6670 was 6670, checked in by mdewsnip, 20 years ago

Changed copyright messages to 2004.

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 5.9 KB
Line 
1#!/bin/sh
2
3echo
4echo 'Greenstone Librarian Interface (GLI)'
5echo 'Copyright (C) 2004, 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
126# Commented out until after UNESCO release
127# Some users may set the above line manually
128#if [ "$wgetpath" == "" ]; then
129# # Check if WGet is on the search path
130# wgetpath=`which wget 2> /dev/null`
131#fi
132
133# Check that a WGet executable has been found
134#echo "Checking WGet: $wgetpath"
135#if [ ! -x "$wgetpath" ]; then
136# echo
137# echo "Failed to locate an appropriate version of WGet. Web mirroring will"
138# echo "be disabled. Greenstone Librarian Interface requires WGet installed"
139# echo "in order to fully access this feature."
140#else
141 ## -- Check the version of WGet is new enough (1.9 or higher) to run properly --
142# wgetversion=`$wgetpath --version 2>&1 | sed -n 's/^GNU Wget \(.*\)/\1/p'`
143# wvmajor=`echo $wgetversion | sed -n 's/^\([0-9]*\).*$/\1/p'`
144# wvminor=`echo $wgetversion | sed -n 's/^[0-9]*\.\(.*\)$/\1/p'`
145
146# wok="WGet1.9"
147# if [ $wvmajor -lt 1 ] ; then
148# wok="<WGet1.9"
149# fi
150# if [ $wvmajor -eq 1 ] && [ $wvminor -lt 9 ] ; then
151# wok="<WGet1.9"
152# fi
153# if [ $wok == "<WGet1.9" ] ; then
154# echo
155# echo "The version of the WGet you have installed has a known bug when"
156# echo "mirroring files which contain encoded characters such as space and"
157# echo "tilde in their URL. While this shouldn't be a problem, we recommend"
158# echo "installing WGet 1.9 or higher."
159# fi
160#fi
161
162## ---- Check that the GLI has been compiled ----
163if [ ! -f "classes/org/greenstone/gatherer/Gatherer.class" ] && [ ! -f "GLI.jar" ]; then
164 echo
165 echo "You need to compile the Greenstone Librarian Interface (using makegli.sh)"
166 echo "before running this script."
167 exit 1
168fi
169
170if [ "$1" == "-test" ]; then
171 echo "Testing class: $2"
172 echo "arguments $*"
173 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
174 exit 1
175fi
176
177## ---- Finally, run the GLI ----
178echo
179echo "Running the Greenstone Librarian Interface..."
180
181# Other arguments you can provide to GLI to work around memory limitations, or debug
182# -Xms<number>M To set minimum memory (by default 32MB)
183# -Xmx<number>M To set maximum memory (by default the nearest 2^n to the total remaining physical memory)
184# -verbose:gc To set garbage collection messages
185# -Xincgc For incremental garbage collection (significantly slows performance)
186# -Xprof Function call profiling
187# -Xloggc:<file> Write garbage collection log
188
189java -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 $*
190
191echo "Done!"
Note: See TracBrowser for help on using the repository browser.