source: trunk/gli/gli.sh@ 6702

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

Now with Russian strings!

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 6.4 KB
Line 
1#!/bin/sh
2glilang=
3
4echo
5if [ "$glilang" == "ru" ]; then
6else
7 echo 'Greenstone Librarian Interface (GLI)'
8 echo 'Copyright (C) 2004, New Zealand Digital Library Project, University Of Waikato'
9 echo 'GLI comes with ABSOLUTELY NO WARRANTY; for details see LICENSE.txt'
10 echo 'This is free software, and you are welcome to redistribute it'
11fi
12echo
13
14## -------- Run the Greenstone Librarian Interface --------
15
16# This script must be run from within the directory in which it lives
17thisdir=`pwd`
18if [ ! -f "${thisdir}/gli.sh" ]; then
19 if [ "$glilang" == "ru" ]; then
20 echo "üÔÏÔ ÓËÒÉÐÔ ÄÏÌÖÅÎ ÂÙÔØ ×ÚÑÔ ÉÚ ÄÉÒÅËÔÏÒÉÉ, × ËÏÔÏÒÏÊ ÏÎ ÒÁÓÐÏÌÏÖÅÎ"
21 else
22 echo "This script must be run from the directory in which it resides."
23 fi
24 exit 1
25fi
26
27
28## ---- Determine GSDLHOME ----
29gsdlpath=
30
31# Some users may set the above line manually
32if [ "$gsdlpath" == "" ]; then
33 # Check the environment variable first
34 if [ "$GSDLHOME" != "" ]; then
35 gsdlpath=$GSDLHOME
36
37 # If it is not set, assume that the GLI is installed as a subdirectory of Greenstone
38 else
39 pushd .. > /dev/null
40 gsdlpath=`pwd`
41 popd > /dev/null
42 fi
43fi
44
45# Check that the Greenstone installation looks OK
46if [ "$glilang" == "ru" ]; then
47 echo "ðÒÏ×ÅÒËÁ GSDL: $gsdlpath"
48else
49 echo "Checking GSDL: $gsdlpath"
50fi
51if [ ! -f "${gsdlpath}/setup.bash" ] ; then
52 echo
53 if [ "$glilang" == "ru" ]; then
54 echo "éÎÓÔÁÌÌÑÃÉÑ Greenstone ÎÅ ÂÙÌÁ ÎÁÊÄÅÎÁ ÉÌÉ ÏÎÁ ÎÅÐÏÌÎÁ."
55 echo "ðÏÐÒÏÂÕÊÔÅ ÐÏ×ÔÏÒÎÏ ÕÓÔÁÎÏ×ÉÔØ Greenstone, Á ÚÁÔÅÍ ××ÅÓÔÉ ÜÔÏÔ ÓËÒÉÐÔ ÓÎÏ×Á."
56 else
57 echo "The Greenstone installation could not be found, or is incomplete."
58 echo "Try reinstalling Greenstone then running this script again."
59 fi
60 exit 1
61fi
62
63# Setup Greenstone, unless it has already been done
64if [ "$GSDLHOME" == "" ]; then
65 pushd $gsdlpath > /dev/null
66 source setup.bash
67 popd > /dev/null
68fi
69
70
71## ---- Check Perl exists ----
72perlpath=
73
74# Some users may set the above line manually
75if [ "$perlpath" == "" ]; then
76 # Check if Perl is on the search path
77 perlpath=`which perl 2> /dev/null`
78fi
79
80# Check that a Perl executable has been found
81if [ "$glilang" == "ru" ]; then
82 echo "ðÒÏ×ÅÒËÁ Perl: $perlpath"
83else
84 echo "Checking Perl: $perlpath"
85fi
86if [ ! -x "$perlpath" ] ; then
87 echo
88 if [ "$glilang" == "ru" ]; then
89 echo "âÉÂÌÉÏÔÅÞÎÙÊ ÉÎÔÅÒÆÅÊÓ Greenstone ÔÒÅÂÕÅÔ Perl, ÞÔÏÂÙ ÉÍÅÔØ ×ÏÚÍÏÖÎÏÓÔØ"
90 echo "ÒÁÂÏÔÁÔØ, ÎÏ Perl ÎÅ ÂÙÌ × ×ÁÛÅÊ ÓÉÓÔÅÍÅ. ðÏÖÁÌÕÊÓÔÁ, ÐÏÄÔ×ÅÒÄÉÔÅ, ÞÔÏ "
91 echo "Perl ÕÓÔÁÎÏ×ÌÅÎ É ÎÁÈÏÄÉÔÓÑ ÎÁ ×ÁÛÅÍ ÐÕÔÉ ÐÏÉÓËÁ, ÚÁÔÅÍ ÐÏ×ÔÏÒÎÏ××ÅÄÉÔÅ"
92 echo "ÜÔÏÔ ÓËÒÉÐÔ."
93 else
94 echo "The Greenstone Librarian Interface requires perl in order to operate,"
95 echo "but perl could not be detected on your system. Please ensure that perl"
96 echo "is installed and is on your search path, then rerun this script."
97 fi
98 exit 1
99fi
100
101
102## ---- Check Java exists ----
103javapath=
104
105# Some users may set the above line manually
106if [ "$javapath" == "" ]; then
107
108 # If it is set, use the JAVA_HOME environment variable
109 if [ "$JAVA_HOME" != "" ]; then
110 javapath="$JAVA_HOME/bin/java"
111
112 # Check if Java is on the search path
113 else
114 javapath=`which java 2> /dev/null`
115 fi
116fi
117
118# Check that a Java executable has been found
119if [ "$glilang" == "ru" ]; then
120 echo "ðÒÏ×ÅÒËÁ Java: $javapath"
121else
122 echo "Checking Java: $javapath"
123fi
124if [ ! -x "$javapath" ]; then
125 echo
126 if [ "$glilang" == "ru" ]; then
127 echo "îÅ ÕÄÁÌÏÓØ ÏÐÒÅÄÅÌÉÔØ ÍÅÓÔÏÎÁÈÏÖÄÅÎÉÅ ÓÏÏÔ×ÅÔÓÔ×ÕÀÝÅÊ ×ÅÒÓÉÉ Java."
128 echo "÷Ù ÄÏÌÖÎÙ ÕÓÔÁÎÏ×ÉÔØ Java Runtime Environment (×ÅÒÓÉÀ 1.4 ÉÌÉ ×ÙÛÅ)"
129 echo "ÐÅÒÅÄ ××ÏÄÏÍ ÂÉÂÌÉÏÔÅÞÎÏÇÏ ÉÎÔÅÒÆÅÊÓÁ Greenstone."
130 else
131 echo "Failed to locate an appropriate version of Java. You must install a"
132 echo "Java Runtime Environment (version 1.4 or greater) before running the"
133 echo "Greenstone Librarian Interface."
134 fi
135 exit 1
136fi
137
138
139## -- Check the version of Java is new enough (1.4.0 or higher) to run the GLI --
140javaversion=`$javapath -version 2>&1 | sed -n 's/^java version \"\(.*\)\"/\1/p'`
141jvmajor=`echo $javaversion | sed -n 's/^\([0-9]*\).*$/\1/p'`
142jvminor=`echo $javaversion | sed -n 's/^[0-9]*\.\([0-9]*\).*$/\1/p'`
143
144jok=1
145if [ $jvmajor -lt 1 ] ; then
146 jok=0
147fi
148if [ $jvmajor -eq 1 ] && [ $jvminor -lt 4 ] ; then
149 jok=0
150fi
151if [ $jok -eq 0 ] ; then
152 echo
153 if [ "$glilang" == "ru" ]; then
154 echo "÷ÅÒÓÉÑ Java Runtime Environment, ËÏÔÏÒÕÀ ÷Ù ÕÓÔÁÎÏ×ÉÌÉ, ÏÞÅÎØ ÓÔÁÒÁ,"
155 echo "ÞÔÏÂÙ ÕÐÒÁ×ÌÑÔØ ÂÉÂÌÉÏÔÅÞÎÙÍ ÉÎÔÅÒÆÅÊÓÏÍ Greenstone. ðÏÖÁÌÕÊÓÔÁ, "
156 echo "ÕÓÔÁÎÏ×ÉÔÅ ÎÏ×ÕÀ ×ÅÒÓÉÀ JRE (×ÅÒÓÉÀ 1.4 ÉÌÉ ÂÏÌÅÅ ÎÏ×ÕÀ) É"
157 echo "ÐÅÒÅÕÓÔÁÎÏ×ÉÔÅ ÜÔÏÔ ÓËÒÉÐÔ"
158 else
159 echo "The version of the Java Runtime Environment you have installed is too"
160 echo "old to run the Greenstone Librarian Interface. Please install a new"
161 echo "version of the JRE (version 1.4 or newer) and rerun this script."
162 fi
163 exit 1
164fi
165
166## ---- Check that the GLI has been compiled ----
167if [ ! -f "classes/org/greenstone/gatherer/Gatherer.class" ] && [ ! -f "GLI.jar" ]; then
168 echo
169 if [ "$glilang" == "ru" ]; then
170 echo "÷Ù ÄÏÌÖÎÙ ËÏÍÐÉÌÉÒÏ×ÁÔØ ÂÉÂÌÉÏÔÅÞÎÙÊ ÉÎÔÅÒÆÅÊÓ Greenstone"
171 echo "(ÉÓÐÏÌØÚÕÑ makegli.sh) ÐÅÒÅÄ ××ÏÄÏÍ ÜÔÏÇÏ ÓËÒÉÐÔÁ"
172 else
173 echo "You need to compile the Greenstone Librarian Interface (using makegli.sh)"
174 echo "before running this script."
175 fi
176 exit 1
177fi
178
179if [ "$1" == "-test" ]; then
180 if [ "$glilang" == "ru" ]; then
181 else
182 echo "Testing class: $2"
183 echo "arguments $*"
184 fi
185 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
186 exit 0
187fi
188
189## ---- Finally, run the GLI ----
190echo
191if [ "$glilang" == "ru" ]; then
192 echo "ôÅËÕÝÉÊ ÂÉÂÌÉÏÔÅÞÎÙÊ ÉÎÔÅÒÆÅÊÓ Greenstone..."
193else
194 echo "Running the Greenstone Librarian Interface..."
195fi
196
197# Other arguments you can provide to GLI to work around memory limitations, or debug
198# -Xms<number>M To set minimum memory (by default 32MB)
199# -Xmx<number>M To set maximum memory (by default the nearest 2^n to the total remaining physical memory)
200# -verbose:gc To set garbage collection messages
201# -Xincgc For incremental garbage collection (significantly slows performance)
202# -Xprof Function call profiling
203# -Xloggc:<file> Write garbage collection log
204
205java -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 $*
206
207if [ "$glilang" == "ru" ]; then
208 echo "÷ÙÐÏÌÎÅÎÏ!"
209else
210 echo "Done!"
211fi
Note: See TracBrowser for help on using the repository browser.