root/trunk/gli/gli.sh @ 13251

Revision 13251, 11.0 KB (checked in by kjdon, 13 years ago)

undid the changes from the last two commits as they were just test commits

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