source: main/tags/2.63/gli/gli.sh@ 25200

Last change on this file since 25200 was 10687, checked in by kjdon, 19 years ago

added quotes around gsdlpath in line 95

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