root/gli/trunk/gli.sh @ 14977

Revision 14977, 11.0 KB (checked in by davidb, 11 years ago)

script made more general so fli.sh can cascade into calling gli.sh rather than fli.sh duplicating 99% of the gli.sh in its own file

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