source: trunk/gli/gli.sh@ 6841

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

Now specifies English explicitly.

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 10.2 KB
Line 
1#!/bin/sh
2glilang=en
3
4echo
5if [ "$glilang" == "es" ]; then
6 echo "-- Still coming --"
7elif [ "$glilang" == "fr" ]; then
8 echo "-- Still coming --"
9elif [ "$glilang" == "ru" ]; then
10 echo "-- Still coming --"
11else
12 echo 'Greenstone Librarian Interface (GLI)'
13 echo 'Copyright (C) 2004, New Zealand Digital Library Project, University Of Waikato'
14 echo 'GLI comes with ABSOLUTELY NO WARRANTY; for details see LICENSE.txt'
15 echo 'This is free software, and you are welcome to redistribute it'
16fi
17echo
18
19## -------- Run the Greenstone Librarian Interface --------
20
21# This script must be run from within the directory in which it lives
22thisdir=`pwd`
23if [ ! -f "${thisdir}/gli.sh" ]; then
24 if [ "$glilang" == "es" ]; then
25 echo "Este guión deberá ejecutarse desde el directorio en el que reside."
26 elif [ "$glilang" == "fr" ]; then
27 echo "Ce script doit être exécuté à partir du répertoire dans lequel il se trouve."
28 elif [ "$glilang" == "ru" ]; then
29 echo "üÔÏÔ ÓËÒÉÐÔ ÄÏÌÖÅÎ ÂÙÔØ ×ÚÑÔ ÉÚ ÄÉÒÅËÔÏÒÉÉ, × ËÏÔÏÒÏÊ ÏÎ ÒÁÓÐÏÌÏÖÅÎ"
30 else
31 echo "This script must be run from the directory in which it resides."
32 fi
33 exit 1
34fi
35
36
37## ---- Determine GSDLHOME ----
38gsdlpath=
39
40# Some users may set the above line manually
41if [ "$gsdlpath" == "" ]; then
42 # Check the environment variable first
43 if [ "$GSDLHOME" != "" ]; then
44 gsdlpath=$GSDLHOME
45
46 # If it is not set, assume that the GLI is installed as a subdirectory of Greenstone
47 else
48 pushd .. > /dev/null
49 gsdlpath=`pwd`
50 popd > /dev/null
51 fi
52fi
53
54# Check that the Greenstone installation looks OK
55if [ "$glilang" == "es" ]; then
56 echo "Revisando GSDL: $gsdlpath"
57elif [ "$glilang" == "fr" ]; then
58 echo "Vérification de GSDL: $gsdlpath"
59elif [ "$glilang" == "ru" ]; then
60 echo "ðÒÏ×ÅÒËÁ GSDL: $gsdlpath"
61else
62 echo "Checking GSDL: $gsdlpath"
63fi
64if [ ! -f "${gsdlpath}/setup.bash" ] ; then
65 echo
66 if [ "$glilang" == "es" ]; then
67 echo "No se pudo encontrar la instalación de Greenstone o está incompleta."
68 echo "Trate de reinstalar Greenstone y a continuación ejecute nuevamente"
69 echo "este guión."
70 elif [ "$glilang" == "fr" ]; then
71 echo "L'installation de Greenstone est introuvable ou incomplète."
72 echo "Essayez de réinstaller Greenstone et exécutez ce script à nouveau."
73 elif [ "$glilang" == "ru" ]; then
74 echo "éÎÓÔÁÌÌÑÃÉÑ Greenstone ÎÅ ÂÙÌÁ ÎÁÊÄÅÎÁ ÉÌÉ ÏÎÁ ÎÅÐÏÌÎÁ."
75 echo "ðÏÐÒÏÂÕÊÔÅ ÐÏ×ÔÏÒÎÏ ÕÓÔÁÎÏ×ÉÔØ Greenstone, Á ÚÁÔÅÍ ××ÅÓÔÉ ÜÔÏÔ ÓËÒÉÐÔ ÓÎÏ×Á."
76 else
77 echo "The Greenstone installation could not be found, or is incomplete."
78 echo "Try reinstalling Greenstone then running this script again."
79 fi
80 exit 1
81fi
82
83# Setup Greenstone, unless it has already been done
84if [ "$GSDLHOME" == "" ]; then
85 pushd $gsdlpath > /dev/null
86 source setup.bash
87 popd > /dev/null
88fi
89
90
91## ---- Check Perl exists ----
92perlpath=
93
94# Some users may set the above line manually
95if [ "$perlpath" == "" ]; then
96 # Check if Perl is on the search path
97 perlpath=`which perl 2> /dev/null`
98fi
99
100# Check that a Perl executable has been found
101if [ "$glilang" == "es" ]; then
102 echo "Revisando Perl: $perlpath"
103elif [ "$glilang" == "fr" ]; then
104 echo "Vérification de Perl: $perlpath"
105elif [ "$glilang" == "ru" ]; then
106 echo "ðÒÏ×ÅÒËÁ Perl: $perlpath"
107else
108 echo "Checking Perl: $perlpath"
109fi
110if [ ! -x "$perlpath" ] ; then
111 echo
112 if [ "$glilang" == "es" ]; then
113 echo "La Interfaz de la Biblioteca Digital Greenstone requiere Perl para "
114 echo "poder operar, pero éste no aparece en su sistema. Por favor asegúrese "
115 echo "de que Perl está instalado y se encuentra en su ruta de búsqueda. A "
116 echo "continuación ejecute nuevamente este guión."
117 elif [ "$glilang" == "fr" ]; then
118 echo "Greenstone Librarian Interface nécessite perl pour son fonctionnement,"
119 echo "mais perl n'a pas pu être détecté dans votre système. Veuillez vous "
120 echo "assurer que perl est installé et est spécifié dans votre chemin de "
121 echo "recherche, puis redémarrez ce script."
122 elif [ "$glilang" == "ru" ]; then
123 echo "âÉÂÌÉÏÔÅÞÎÙÊ ÉÎÔÅÒÆÅÊÓ Greenstone ÔÒÅÂÕÅÔ Perl, ÞÔÏÂÙ ÉÍÅÔØ ×ÏÚÍÏÖÎÏÓÔØ"
124 echo "ÒÁÂÏÔÁÔØ, ÎÏ Perl ÎÅ ÂÙÌ × ×ÁÛÅÊ ÓÉÓÔÅÍÅ. ðÏÖÁÌÕÊÓÔÁ, ÐÏÄÔ×ÅÒÄÉÔÅ, ÞÔÏ "
125 echo "Perl ÕÓÔÁÎÏ×ÌÅÎ É ÎÁÈÏÄÉÔÓÑ ÎÁ ×ÁÛÅÍ ÐÕÔÉ ÐÏÉÓËÁ, ÚÁÔÅÍ ÐÏ×ÔÏÒÎÏ××ÅÄÉÔÅ"
126 echo "ÜÔÏÔ ÓËÒÉÐÔ."
127 else
128 echo "The Greenstone Librarian Interface requires perl in order to operate,"
129 echo "but perl could not be detected on your system. Please ensure that perl"
130 echo "is installed and is on your search path, then rerun this script."
131 fi
132 exit 1
133fi
134
135
136## ---- Check Java exists ----
137javapath=
138
139# Some users may set the above line manually
140if [ "$javapath" == "" ]; then
141
142 # If it is set, use the JAVA_HOME environment variable
143 if [ "$JAVA_HOME" != "" ]; then
144 javapath="$JAVA_HOME/bin/java"
145
146 # Check if Java is on the search path
147 else
148 javapath=`which java 2> /dev/null`
149 fi
150fi
151
152# Check that a Java executable has been found
153if [ "$glilang" == "es" ]; then
154 echo "Revisando Java: $javapath"
155elif [ "$glilang" == "fr" ]; then
156 echo "Vérification de Java: $javapath"
157elif [ "$glilang" == "ru" ]; then
158 echo "ðÒÏ×ÅÒËÁ Java: $javapath"
159else
160 echo "Checking Java: $javapath"
161fi
162if [ ! -x "$javapath" ]; then
163 echo
164 if [ "$glilang" == "es" ]; then
165 echo "No se pudo localizar una versión apropiada de Java. Usted deberá "
166 echo "instalar un Ambiente de Ejecución Java (versión 1.4 o superior) "
167 echo "antes de correr la Interfaz de la Biblioteca Digital Greenstone."
168 elif [ "$glilang" == "fr" ]; then
169 echo "Une version adéquate de Java n'a pas pu être localisée."
170 echo "Vous devez installer un Java Runtime Environment (version 1.4 ou"
171 echo "supérieur) avant de démarrer Greenstone Librarian Interface."
172 elif [ "$glilang" == "ru" ]; then
173 echo "îÅ ÕÄÁÌÏÓØ ÏÐÒÅÄÅÌÉÔØ ÍÅÓÔÏÎÁÈÏÖÄÅÎÉÅ ÓÏÏÔ×ÅÔÓÔ×ÕÀÝÅÊ ×ÅÒÓÉÉ Java."
174 echo "÷Ù ÄÏÌÖÎÙ ÕÓÔÁÎÏ×ÉÔØ Java Runtime Environment (×ÅÒÓÉÀ 1.4 ÉÌÉ ×ÙÛÅ)"
175 echo "ÐÅÒÅÄ ××ÏÄÏÍ ÂÉÂÌÉÏÔÅÞÎÏÇÏ ÉÎÔÅÒÆÅÊÓÁ Greenstone."
176 else
177 echo "Failed to locate an appropriate version of Java. You must install a"
178 echo "Java Runtime Environment (version 1.4 or greater) before running the"
179 echo "Greenstone Librarian Interface."
180 fi
181 exit 1
182fi
183
184
185## -- Check the version of Java is new enough (1.4.0 or higher) to run the GLI --
186javaversion=`$javapath -version 2>&1 | sed -n 's/^java version \"\(.*\)\"/\1/p'`
187jvmajor=`echo $javaversion | sed -n 's/^\([0-9]*\).*$/\1/p'`
188jvminor=`echo $javaversion | sed -n 's/^[0-9]*\.\([0-9]*\).*$/\1/p'`
189
190jok=1
191if [ $jvmajor -lt 1 ] ; then
192 jok=0
193fi
194if [ $jvmajor -eq 1 ] && [ $jvminor -lt 4 ] ; then
195 jok=0
196fi
197if [ $jok -eq 0 ] ; then
198 echo
199 if [ "$glilang" == "es" ]; then
200 echo "La versión del Ambiente de Ejecución Java (JRE por sus siglas en "
201 echo "inglés) que usted tiene instalada es demasiado vieja para ejecutar "
202 echo "la Interfaz de la Biblioteca Digital Greenstone. Por favor instale "
203 echo "una nueva versión del Ambiente de Ejecución Java (versión 1.4 o "
204 echo "posterior) y ejecute nuevamente este guión."
205 elif [ "$glilang" == "fr" ]; then
206 echo "La version de Java Runtime Environment que vous avez installée est"
207 echo "trop vielle pour faire fonctionner Greenstone Librarian Interface."
208 echo "Veuillez installer une nouvelle version du JRE (version 1.4 ou plus"
209 echo "récente) et redémarrez le script."
210 elif [ "$glilang" == "ru" ]; then
211 echo "÷ÅÒÓÉÑ Java Runtime Environment, ËÏÔÏÒÕÀ ÷Ù ÕÓÔÁÎÏ×ÉÌÉ, ÏÞÅÎØ ÓÔÁÒÁ,"
212 echo "ÞÔÏÂÙ ÕÐÒÁ×ÌÑÔØ ÂÉÂÌÉÏÔÅÞÎÙÍ ÉÎÔÅÒÆÅÊÓÏÍ Greenstone. ðÏÖÁÌÕÊÓÔÁ, "
213 echo "ÕÓÔÁÎÏ×ÉÔÅ ÎÏ×ÕÀ ×ÅÒÓÉÀ JRE (×ÅÒÓÉÀ 1.4 ÉÌÉ ÂÏÌÅÅ ÎÏ×ÕÀ) É"
214 echo "ÐÅÒÅÕÓÔÁÎÏ×ÉÔÅ ÜÔÏÔ ÓËÒÉÐÔ"
215 else
216 echo "The version of the Java Runtime Environment you have installed is too"
217 echo "old to run the Greenstone Librarian Interface. Please install a new"
218 echo "version of the JRE (version 1.4 or newer) and rerun this script."
219 fi
220 exit 1
221fi
222
223## ---- Check that the GLI has been compiled ----
224if [ ! -f "classes/org/greenstone/gatherer/Gatherer.class" ] && [ ! -f "GLI.jar" ]; then
225 echo
226 if [ "$glilang" == "es" ]; then
227 echo "Usted necesita compilar la Interfaz de la Biblioteca Digital Greenstone"
228 echo "(por medio de makegli.sh) antes de ejecutar este guión."
229 elif [ "$glilang" == "fr" ]; then
230 echo "Vous devez compiler le Greenstone Interface (en utilisant makegli.sh)"
231 echo "avant d'exécuter ce script."
232 elif [ "$glilang" == "ru" ]; then
233 echo "÷Ù ÄÏÌÖÎÙ ËÏÍÐÉÌÉÒÏ×ÁÔØ ÂÉÂÌÉÏÔÅÞÎÙÊ ÉÎÔÅÒÆÅÊÓ Greenstone"
234 echo "(ÉÓÐÏÌØÚÕÑ makegli.sh) ÐÅÒÅÄ ××ÏÄÏÍ ÜÔÏÇÏ ÓËÒÉÐÔÁ"
235 else
236 echo "You need to compile the Greenstone Librarian Interface (using makegli.sh)"
237 echo "before running this script."
238 fi
239 exit 1
240fi
241
242if [ "$1" == "-test" ]; then
243 if [ "$glilang" == "es" ]; then
244 echo "-- Still coming --"
245 elif [ "$glilang" == "fr" ]; then
246 echo "-- Still coming --"
247 elif [ "$glilang" == "ru" ]; then
248 echo "-- Still coming --"
249 else
250 echo "Testing class: $2"
251 echo "arguments $*"
252 fi
253 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
254 exit 0
255fi
256
257## ---- Finally, run the GLI ----
258echo
259if [ "$glilang" == "es" ]; then
260 echo "Ejecutando la Interfaz de la Biblioteca Digital Greenstone..."
261elif [ "$glilang" == "fr" ]; then
262 echo "Exécution de Greenstone Librarian Interface"
263elif [ "$glilang" == "ru" ]; then
264 echo "ôÅËÕÝÉÊ ÂÉÂÌÉÏÔÅÞÎÙÊ ÉÎÔÅÒÆÅÊÓ Greenstone..."
265else
266 echo "Running the Greenstone Librarian Interface..."
267fi
268
269# Other arguments you can provide to GLI to work around memory limitations, or debug
270# -Xms<number>M To set minimum memory (by default 32MB)
271# -Xmx<number>M To set maximum memory (by default the nearest 2^n to the total remaining physical memory)
272# -verbose:gc To set garbage collection messages
273# -Xincgc For incremental garbage collection (significantly slows performance)
274# -Xprof Function call profiling
275# -Xloggc:<file> Write garbage collection log
276
277java -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 $*
278
279if [ "$glilang" == "es" ]; then
280 echo "¡Hecho!"
281elif [ "$glilang" == "fr" ]; then
282 echo "Terminé!"
283elif [ "$glilang" == "ru" ]; then
284 echo "÷ÙÐÏÌÎÅÎÏ!"
285else
286 echo "Done!"
287fi
Note: See TracBrowser for help on using the repository browser.