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
RevLine 
[4914]1#!/bin/sh
[6752]2glilang=en
[4914]3
[6262]4echo
[6745]5if [ "$glilang" == "es" ]; then
[6707]6 echo "-- Still coming --"
[6745]7elif [ "$glilang" == "fr" ]; then
8 echo "-- Still coming --"
[6712]9elif [ "$glilang" == "ru" ]; then
10 echo "-- Still coming --"
[6702]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
[6223]17echo
[4952]18
[5003]19## -------- Run the Greenstone Librarian Interface --------
[4952]20
[5003]21# This script must be run from within the directory in which it lives
[4952]22thisdir=`pwd`
23if [ ! -f "${thisdir}/gli.sh" ]; then
[6745]24 if [ "$glilang" == "es" ]; then
25 echo "Este guión deberá ejecutarse desde el directorio en el que reside."
26 elif [ "$glilang" == "fr" ]; then
[6712]27 echo "Ce script doit être exécuté à partir du répertoire dans lequel il se trouve."
28 elif [ "$glilang" == "ru" ]; then
[6702]29 echo "üÔÏÔ ÓËÒÉÐÔ ÄÏÌÖÅÎ ÂÙÔØ ×ÚÑÔ ÉÚ ÄÉÒÅËÔÏÒÉÉ, × ËÏÔÏÒÏÊ ÏÎ ÒÁÓÐÏÌÏÖÅÎ"
30 else
31 echo "This script must be run from the directory in which it resides."
32 fi
[4952]33 exit 1
[4914]34fi
35
[4952]36
[5003]37## ---- Determine GSDLHOME ----
[6624]38gsdlpath=
[4952]39
40# Some users may set the above line manually
[5003]41if [ "$gsdlpath" == "" ]; then
[4952]42 # Check the environment variable first
43 if [ "$GSDLHOME" != "" ]; then
[5003]44 gsdlpath=$GSDLHOME
[4952]45
46 # If it is not set, assume that the GLI is installed as a subdirectory of Greenstone
47 else
48 pushd .. > /dev/null
[5003]49 gsdlpath=`pwd`
[4952]50 popd > /dev/null
51 fi
52fi
53
54# Check that the Greenstone installation looks OK
[6745]55if [ "$glilang" == "es" ]; then
56 echo "Revisando GSDL: $gsdlpath"
57elif [ "$glilang" == "fr" ]; then
[6712]58 echo "Vérification de GSDL: $gsdlpath"
59elif [ "$glilang" == "ru" ]; then
[6702]60 echo "ðÒÏ×ÅÒËÁ GSDL: $gsdlpath"
61else
62 echo "Checking GSDL: $gsdlpath"
63fi
[5091]64if [ ! -f "${gsdlpath}/setup.bash" ] ; then
[5003]65 echo
[6745]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
[6712]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
[6702]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
[4952]80 exit 1
81fi
82
[5003]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
[4952]89
90
[5003]91## ---- Check Perl exists ----
[4952]92perlpath=
93
94# Some users may set the above line manually
95if [ "$perlpath" == "" ]; then
[5003]96 # Check if Perl is on the search path
[4952]97 perlpath=`which perl 2> /dev/null`
98fi
99
[5003]100# Check that a Perl executable has been found
[6745]101if [ "$glilang" == "es" ]; then
102 echo "Revisando Perl: $perlpath"
103elif [ "$glilang" == "fr" ]; then
[6712]104 echo "Vérification de Perl: $perlpath"
105elif [ "$glilang" == "ru" ]; then
[6702]106 echo "ðÒÏ×ÅÒËÁ Perl: $perlpath"
107else
108 echo "Checking Perl: $perlpath"
109fi
[4952]110if [ ! -x "$perlpath" ] ; then
[5003]111 echo
[6745]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
[6712]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
[6702]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
[4952]132 exit 1
133fi
134
135
[5003]136## ---- Check Java exists ----
[4952]137javapath=
138
139# Some users may set the above line manually
140if [ "$javapath" == "" ]; then
[5003]141
[6467]142 # If it is set, use the JAVA_HOME environment variable
143 if [ "$JAVA_HOME" != "" ]; then
144 javapath="$JAVA_HOME/bin/java"
[4952]145
[5003]146 # Check if Java is on the search path
[4952]147 else
148 javapath=`which java 2> /dev/null`
149 fi
150fi
151
[5003]152# Check that a Java executable has been found
[6745]153if [ "$glilang" == "es" ]; then
154 echo "Revisando Java: $javapath"
155elif [ "$glilang" == "fr" ]; then
[6712]156 echo "Vérification de Java: $javapath"
157elif [ "$glilang" == "ru" ]; then
[6702]158 echo "ðÒÏ×ÅÒËÁ Java: $javapath"
159else
160 echo "Checking Java: $javapath"
161fi
[4952]162if [ ! -x "$javapath" ]; then
[5003]163 echo
[6745]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
[6712]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
[6702]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
[4952]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
[5003]198 echo
[6745]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
[6712]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
[6702]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
[4952]220 exit 1
221fi
222
[5003]223## ---- Check that the GLI has been compiled ----
[5027]224if [ ! -f "classes/org/greenstone/gatherer/Gatherer.class" ] && [ ! -f "GLI.jar" ]; then
[5003]225 echo
[6745]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
[6712]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
[6702]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
[4952]239 exit 1
240fi
241
[6211]242if [ "$1" == "-test" ]; then
[6745]243 if [ "$glilang" == "es" ]; then
[6707]244 echo "-- Still coming --"
[6745]245 elif [ "$glilang" == "fr" ]; then
246 echo "-- Still coming --"
[6712]247 elif [ "$glilang" == "ru" ]; then
248 echo "-- Still coming --"
[6702]249 else
250 echo "Testing class: $2"
251 echo "arguments $*"
252 fi
[6211]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
[6702]254 exit 0
[6211]255fi
[4952]256
[5003]257## ---- Finally, run the GLI ----
258echo
[6745]259if [ "$glilang" == "es" ]; then
260 echo "Ejecutando la Interfaz de la Biblioteca Digital Greenstone..."
261elif [ "$glilang" == "fr" ]; then
[6712]262 echo "Exécution de Greenstone Librarian Interface"
263elif [ "$glilang" == "ru" ]; then
[6702]264 echo "ôÅËÕÝÉÊ ÂÉÂÌÉÏÔÅÞÎÙÊ ÉÎÔÅÒÆÅÊÓ Greenstone..."
265else
266 echo "Running the Greenstone Librarian Interface..."
267fi
[4952]268
[6211]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)
[4914]272# -verbose:gc To set garbage collection messages
[6211]273# -Xincgc For incremental garbage collection (significantly slows performance)
[4914]274# -Xprof Function call profiling
275# -Xloggc:<file> Write garbage collection log
276
[6622]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 $*
[4914]278
[6745]279if [ "$glilang" == "es" ]; then
280 echo "¡Hecho!"
281elif [ "$glilang" == "fr" ]; then
[6712]282 echo "Terminé!"
283elif [ "$glilang" == "ru" ]; then
[6702]284 echo "÷ÙÐÏÌÎÅÎÏ!"
285else
286 echo "Done!"
287fi
Note: See TracBrowser for help on using the repository browser.