source: trunk/gli/gli.sh@ 11246

Last change on this file since 11246 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
RevLine 
[4914]1#!/bin/sh
[6752]2glilang=en
[4914]3
[6262]4echo
[6745]5if [ "$glilang" == "es" ]; then
[6959]6 echo "Interfaz de la Biblioteca Digital Greenstone (Greenstone Librarian Interface - GLI)"
[9656]7 echo "Copyright (C) 2005, New Zealand Digital Library Project, University Of Waikato"
[6959]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"
[6745]11elif [ "$glilang" == "fr" ]; then
[6955]12 echo "Interface du Bibliothécaire Greenstone (Greenstone Librarian Interface - GLI)"
[9656]13 echo "Copyright (C) 2005, New Zealand Digital Library Project, University Of Waikato"
[6955]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"
[6712]16elif [ "$glilang" == "ru" ]; then
[7041]17 echo "âÉÂÌÉÏÔÅÞÎÙÊ ÉÎÔÅÒÆÅÊÓ Greenstone (Greenstone Librarian Interface - GLI)"
[9656]18 echo "Copyright (C) 2005, New Zealand Digital Library Project, University Of Waikato"
[7041]19 echo "âéç ÎÅ ÄÁÅÔ áâóïìàôîï îéëáëéè çáòáîôéê; ÄÅÔÁÌÉ ÓÍ. × ÔÅËÓÔÅ LICENSE.TXT"
20 echo "üÔÏ - Ó×ÏÂÏÄÎÏ ÒÁÓÐÒÏÓÔÒÁÎÑÅÍÏÅ ÐÒÏÇÒÁÍÍÎÏÅ ÏÂÅÓÐÅÞÅÎÉÅ É ÷Ù ÍÏÖÅÔÅ ÒÁÓÐÒÏÓÔÒÁÎÑÔØ ÅÇÏ"
[6702]21else
[6955]22 echo "Greenstone Librarian Interface (GLI)"
[9656]23 echo "Copyright (C) 2005, New Zealand Digital Library Project, University Of Waikato"
[6955]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"
[6702]26fi
[6223]27echo
[4952]28
[5003]29## -------- Run the Greenstone Librarian Interface --------
[4952]30
[5003]31# This script must be run from within the directory in which it lives
[4952]32thisdir=`pwd`
33if [ ! -f "${thisdir}/gli.sh" ]; then
[6745]34 if [ "$glilang" == "es" ]; then
35 echo "Este guión deberá ejecutarse desde el directorio en el que reside."
36 elif [ "$glilang" == "fr" ]; then
[6712]37 echo "Ce script doit être exécuté à partir du répertoire dans lequel il se trouve."
38 elif [ "$glilang" == "ru" ]; then
[6702]39 echo "üÔÏÔ ÓËÒÉÐÔ ÄÏÌÖÅÎ ÂÙÔØ ×ÚÑÔ ÉÚ ÄÉÒÅËÔÏÒÉÉ, × ËÏÔÏÒÏÊ ÏÎ ÒÁÓÐÏÌÏÖÅÎ"
40 else
41 echo "This script must be run from the directory in which it resides."
42 fi
[4952]43 exit 1
[4914]44fi
45
[4952]46
[5003]47## ---- Determine GSDLHOME ----
[6624]48gsdlpath=
[4952]49
50# Some users may set the above line manually
[5003]51if [ "$gsdlpath" == "" ]; then
[4952]52 # Check the environment variable first
53 if [ "$GSDLHOME" != "" ]; then
[5003]54 gsdlpath=$GSDLHOME
[4952]55
56 # If it is not set, assume that the GLI is installed as a subdirectory of Greenstone
57 else
58 pushd .. > /dev/null
[5003]59 gsdlpath=`pwd`
[4952]60 popd > /dev/null
61 fi
62fi
63
64# Check that the Greenstone installation looks OK
[6745]65if [ "$glilang" == "es" ]; then
66 echo "Revisando GSDL: $gsdlpath"
67elif [ "$glilang" == "fr" ]; then
[6712]68 echo "Vérification de GSDL: $gsdlpath"
69elif [ "$glilang" == "ru" ]; then
[6702]70 echo "ðÒÏ×ÅÒËÁ GSDL: $gsdlpath"
71else
72 echo "Checking GSDL: $gsdlpath"
73fi
[5091]74if [ ! -f "${gsdlpath}/setup.bash" ] ; then
[5003]75 echo
[6745]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
[6712]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
[6702]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
[4952]90 exit 1
91fi
92
[5003]93# Setup Greenstone, unless it has already been done
94if [ "$GSDLHOME" == "" ]; then
[10687]95 pushd "$gsdlpath" > /dev/null
[5003]96 source setup.bash
97 popd > /dev/null
98fi
[4952]99
100
[5003]101## ---- Check Perl exists ----
[4952]102perlpath=
103
104# Some users may set the above line manually
105if [ "$perlpath" == "" ]; then
[5003]106 # Check if Perl is on the search path
[4952]107 perlpath=`which perl 2> /dev/null`
108fi
109
[5003]110# Check that a Perl executable has been found
[6745]111if [ "$glilang" == "es" ]; then
112 echo "Revisando Perl: $perlpath"
113elif [ "$glilang" == "fr" ]; then
[6712]114 echo "Vérification de Perl: $perlpath"
115elif [ "$glilang" == "ru" ]; then
[6702]116 echo "ðÒÏ×ÅÒËÁ Perl: $perlpath"
117else
118 echo "Checking Perl: $perlpath"
119fi
[4952]120if [ ! -x "$perlpath" ] ; then
[5003]121 echo
[6745]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
[6712]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
[6702]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
[4952]142 exit 1
143fi
144
145
[5003]146## ---- Check Java exists ----
[4952]147javapath=
148
149# Some users may set the above line manually
150if [ "$javapath" == "" ]; then
[5003]151
[6467]152 # If it is set, use the JAVA_HOME environment variable
153 if [ "$JAVA_HOME" != "" ]; then
154 javapath="$JAVA_HOME/bin/java"
[4952]155
[5003]156 # Check if Java is on the search path
[4952]157 else
158 javapath=`which java 2> /dev/null`
159 fi
160fi
161
[5003]162# Check that a Java executable has been found
[6745]163if [ "$glilang" == "es" ]; then
164 echo "Revisando Java: $javapath"
165elif [ "$glilang" == "fr" ]; then
[6712]166 echo "Vérification de Java: $javapath"
167elif [ "$glilang" == "ru" ]; then
[6702]168 echo "ðÒÏ×ÅÒËÁ Java: $javapath"
169else
170 echo "Checking Java: $javapath"
171fi
[4952]172if [ ! -x "$javapath" ]; then
[5003]173 echo
[6745]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
[6712]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
[6702]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
[4952]191 exit 1
192fi
193
194
195## -- Check the version of Java is new enough (1.4.0 or higher) to run the GLI --
[9347]196`$javapath -classpath . CheckJavaVersion > /dev/null`
[8901]197if [ $? -ne 2 ] ; 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
[7676]223## ---- Set wgetpath manually if you don't want to use the default Greenstone version -----
[7664]224wgetpath=
225
[5003]226## ---- Check that the GLI has been compiled ----
[7748]227if [ ! -f "classes/org/greenstone/gatherer/GathererProg.class" ] && [ ! -f "GLI.jar" ]; then
[8901]228 echo
[6745]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
[6712]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
[6702]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
[4952]242 exit 1
243fi
244
[6211]245if [ "$1" == "-test" ]; then
[6745]246 if [ "$glilang" == "es" ]; then
[6959]247 echo "Clase de prueba: $2"
248 echo "Argumentos $*"
[6745]249 elif [ "$glilang" == "fr" ]; then
[6955]250 echo "Classe de test: $2"
251 echo "Arguments $*"
[6712]252 elif [ "$glilang" == "ru" ]; then
[7041]253 echo "éÓÐÙÔÁÔÅÌØÎÙÊ ËÌÁÓÓ: $2"
254 echo "ðÁÒÁÍÅÔÒÙ $*"
[6702]255 else
256 echo "Testing class: $2"
[6955]257 echo "Arguments $*"
[6702]258 fi
[8254]259 $javapath -classpath classes/:GLI.jar:lib/apache.jar:lib/qfslib.jar:lib/mail.jar:lib/activation.jar $2 $3
[6702]260 exit 0
[6211]261fi
[4952]262
[5003]263## ---- Finally, run the GLI ----
264echo
[6745]265if [ "$glilang" == "es" ]; then
266 echo "Ejecutando la Interfaz de la Biblioteca Digital Greenstone..."
267elif [ "$glilang" == "fr" ]; then
[6712]268 echo "Exécution de Greenstone Librarian Interface"
269elif [ "$glilang" == "ru" ]; then
[6702]270 echo "ôÅËÕÝÉÊ ÂÉÂÌÉÏÔÅÞÎÙÊ ÉÎÔÅÒÆÅÊÓ Greenstone..."
271else
272 echo "Running the Greenstone Librarian Interface..."
273fi
[4952]274
[6211]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)
[4914]278# -verbose:gc To set garbage collection messages
[6211]279# -Xincgc For incremental garbage collection (significantly slows performance)
[4914]280# -Xprof Function call profiling
281# -Xloggc:<file> Write garbage collection log
282
[8254]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 $*
[4914]284
[6745]285if [ "$glilang" == "es" ]; then
286 echo "¡Hecho!"
287elif [ "$glilang" == "fr" ]; then
[6712]288 echo "Terminé!"
289elif [ "$glilang" == "ru" ]; then
[6702]290 echo "÷ÙÐÏÌÎÅÎÏ!"
291else
292 echo "Done!"
293fi
Note: See TracBrowser for help on using the repository browser.