source: trunk/gli/gli.sh@ 13015

Last change on this file since 13015 was 13015, checked in by mdewsnip, 18 years ago

Now passes in the GSDLOS environment variable.

  • 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
[12286]5if [ "$glilang" = "es" ]; then
[6959]6 echo "Interfaz de la Biblioteca Digital Greenstone (Greenstone Librarian Interface - GLI)"
[12453]7 echo "Copyright (C) 2006, 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"
[12286]11elif [ "$glilang" = "fr" ]; then
[6955]12 echo "Interface du Bibliothécaire Greenstone (Greenstone Librarian Interface - GLI)"
[12453]13 echo "Copyright (C) 2006, 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"
[12286]16elif [ "$glilang" = "ru" ]; then
[7041]17 echo "âÉÂÌÉÏÔÅÞÎÙÊ ÉÎÔÅÒÆÅÊÓ Greenstone (Greenstone Librarian Interface - GLI)"
[12453]18 echo "Copyright (C) 2006, New Zealand Digital Library Project, University Of Waikato"
[7041]19 echo "âéç ÎÅ ÄÁÅÔ áâóïìàôîï îéëáëéè çáòáîôéê; ÄÅÔÁÌÉ ÓÍ. × ÔÅËÓÔÅ LICENSE.TXT"
20 echo "üÔÏ - Ó×ÏÂÏÄÎÏ ÒÁÓÐÒÏÓÔÒÁÎÑÅÍÏÅ ÐÒÏÇÒÁÍÍÎÏÅ ÏÂÅÓÐÅÞÅÎÉÅ É ÷Ù ÍÏÖÅÔÅ ÒÁÓÐÒÏÓÔÒÁÎÑÔØ ÅÇÏ"
[6702]21else
[6955]22 echo "Greenstone Librarian Interface (GLI)"
[12453]23 echo "Copyright (C) 2006, 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
[12286]34 if [ "$glilang" = "es" ]; then
[6745]35 echo "Este guión deberá ejecutarse desde el directorio en el que reside."
[12286]36 elif [ "$glilang" = "fr" ]; then
[6712]37 echo "Ce script doit être exécuté à partir du répertoire dans lequel il se trouve."
[12286]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
[12286]51if [ "x$gsdlpath" = "x" ]; then
[4952]52 # Check the environment variable first
[12286]53 if [ "x$GSDLHOME" != "x" ]; 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
[12286]58 gsdlpath=`(cd .. && pwd)`
[4952]59 fi
60fi
61
62# Check that the Greenstone installation looks OK
[12286]63if [ "$glilang" = "es" ]; then
[6745]64 echo "Revisando GSDL: $gsdlpath"
[12286]65elif [ "$glilang" = "fr" ]; then
[6712]66 echo "Vérification de GSDL: $gsdlpath"
[12286]67elif [ "$glilang" = "ru" ]; then
[6702]68 echo "ðÒÏ×ÅÒËÁ GSDL: $gsdlpath"
69else
70 echo "Checking GSDL: $gsdlpath"
71fi
[5091]72if [ ! -f "${gsdlpath}/setup.bash" ] ; then
[5003]73 echo
[12286]74 if [ "$glilang" = "es" ]; then
[6745]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."
[12286]78 elif [ "$glilang" = "fr" ]; then
[6712]79 echo "L'installation de Greenstone est introuvable ou incomplète."
80 echo "Essayez de réinstaller Greenstone et exécutez ce script à nouveau."
[12286]81 elif [ "$glilang" = "ru" ]; then
[6702]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
[4952]88 exit 1
89fi
90
[5003]91# Setup Greenstone, unless it has already been done
[12286]92if [ "x$GSDLHOME" = "x" ]; then
93 cd "$gsdlpath"
94 . setup.bash
95 cd "$thisdir"
[5003]96fi
[4952]97
98
[5003]99## ---- Check Perl exists ----
[4952]100perlpath=
101
102# Some users may set the above line manually
[12286]103if [ "x$perlpath" = "x" ]; then
[5003]104 # Check if Perl is on the search path
[4952]105 perlpath=`which perl 2> /dev/null`
106fi
107
[5003]108# Check that a Perl executable has been found
[12286]109if [ "$glilang" = "es" ]; then
[6745]110 echo "Revisando Perl: $perlpath"
[12286]111elif [ "$glilang" = "fr" ]; then
[6712]112 echo "Vérification de Perl: $perlpath"
[12286]113elif [ "$glilang" = "ru" ]; then
[6702]114 echo "ðÒÏ×ÅÒËÁ Perl: $perlpath"
115else
116 echo "Checking Perl: $perlpath"
117fi
[4952]118if [ ! -x "$perlpath" ] ; then
[5003]119 echo
[12286]120 if [ "$glilang" = "es" ]; then
[6745]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."
[12286]125 elif [ "$glilang" = "fr" ]; then
[6712]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."
[12286]130 elif [ "$glilang" = "ru" ]; then
[6702]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
[4952]140 exit 1
141fi
142
143
[5003]144## ---- Check Java exists ----
[4952]145javapath=
146
147# Some users may set the above line manually
[12286]148if [ "x$javapath" = "x" ]; then
[5003]149
[6467]150 # If it is set, use the JAVA_HOME environment variable
[12286]151 if [ "x$JAVA_HOME" != "x" ]; then
[6467]152 javapath="$JAVA_HOME/bin/java"
[4952]153
[5003]154 # Check if Java is on the search path
[4952]155 else
156 javapath=`which java 2> /dev/null`
157 fi
158fi
159
[5003]160# Check that a Java executable has been found
[12286]161if [ "$glilang" = "es" ]; then
[6745]162 echo "Revisando Java: $javapath"
[12286]163elif [ "$glilang" = "fr" ]; then
[6712]164 echo "Vérification de Java: $javapath"
[12286]165elif [ "$glilang" = "ru" ]; then
[6702]166 echo "ðÒÏ×ÅÒËÁ Java: $javapath"
167else
168 echo "Checking Java: $javapath"
169fi
[4952]170if [ ! -x "$javapath" ]; then
[5003]171 echo
[12286]172 if [ "$glilang" = "es" ]; then
[6745]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."
[12286]176 elif [ "$glilang" = "fr" ]; then
[6712]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."
[12286]180 elif [ "$glilang" = "ru" ]; then
[6702]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
[4952]189 exit 1
190fi
191
192
193## -- Check the version of Java is new enough (1.4.0 or higher) to run the GLI --
[9347]194`$javapath -classpath . CheckJavaVersion > /dev/null`
[8901]195if [ $? -ne 2 ] ; then
[5003]196 echo
[12286]197 if [ "$glilang" = "es" ]; then
[6745]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."
[12286]203 elif [ "$glilang" = "fr" ]; then
[6712]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."
[12286]208 elif [ "$glilang" = "ru" ]; then
[6702]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
[4952]218 exit 1
219fi
220
[7676]221## ---- Set wgetpath manually if you don't want to use the default Greenstone version -----
[7664]222wgetpath=
223
[5003]224## ---- Check that the GLI has been compiled ----
[7748]225if [ ! -f "classes/org/greenstone/gatherer/GathererProg.class" ] && [ ! -f "GLI.jar" ]; then
[8901]226 echo
[12286]227 if [ "$glilang" = "es" ]; then
[6745]228 echo "Usted necesita compilar la Interfaz de la Biblioteca Digital Greenstone"
229 echo "(por medio de makegli.sh) antes de ejecutar este guión."
[12286]230 elif [ "$glilang" = "fr" ]; then
[6712]231 echo "Vous devez compiler le Greenstone Interface (en utilisant makegli.sh)"
232 echo "avant d'exécuter ce script."
[12286]233 elif [ "$glilang" = "ru" ]; then
[6702]234 echo "÷Ù ÄÏÌÖÎÙ ËÏÍÐÉÌÉÒÏ×ÁÔØ ÂÉÂÌÉÏÔÅÞÎÙÊ ÉÎÔÅÒÆÅÊÓ Greenstone"
235 echo "(ÉÓÐÏÌØÚÕÑ makegli.sh) ÐÅÒÅÄ ××ÏÄÏÍ ÜÔÏÇÏ ÓËÒÉÐÔÁ"
236 else
237 echo "You need to compile the Greenstone Librarian Interface (using makegli.sh)"
238 echo "before running this script."
239 fi
[4952]240 exit 1
241fi
242
[5003]243## ---- Finally, run the GLI ----
244echo
[12286]245if [ "$glilang" = "es" ]; then
[6745]246 echo "Ejecutando la Interfaz de la Biblioteca Digital Greenstone..."
[12286]247elif [ "$glilang" = "fr" ]; then
[6712]248 echo "Exécution de Greenstone Librarian Interface"
[12286]249elif [ "$glilang" = "ru" ]; then
[6702]250 echo "ôÅËÕÝÉÊ ÂÉÂÌÉÏÔÅÞÎÙÊ ÉÎÔÅÒÆÅÊÓ Greenstone..."
251else
252 echo "Running the Greenstone Librarian Interface..."
253fi
[4952]254
[12225]255stop_gli=0
256while [ "$stop_gli" = "0" ] ; do
257
[6211]258# Other arguments you can provide to GLI to work around memory limitations, or debug
259# -Xms<number>M To set minimum memory (by default 32MB)
260# -Xmx<number>M To set maximum memory (by default the nearest 2^n to the total remaining physical memory)
[4914]261# -verbose:gc To set garbage collection messages
[6211]262# -Xincgc For incremental garbage collection (significantly slows performance)
[4914]263# -Xprof Function call profiling
264# -Xloggc:<file> Write garbage collection log
265
266
[12225]267
[13015]268 $javapath -Xmx128M -classpath classes/:GLI.jar:lib/apache.jar:lib/qfslib.jar org.greenstone.gatherer.GathererProg -gsdl $GSDLHOME -gsdlos $GSDLOS -wget $wgetpath $*
[12225]269 exit_status=$?
270
271 if [ "$exit_status" != "2" ] ; then
272 stop_gli=1
273 else
274 echo
[12286]275 if [ "$glilang" = "es" ]; then
[12225]276 echo "Restarting/Ejecutando la Interfaz de la Biblioteca Digital Greenstone..."
[12286]277 elif [ "$glilang" = "fr" ]; then
[12225]278 echo "Restarting/Exécution de Greenstone Librarian Interface"
[12286]279 elif [ "$glilang" = "ru" ]; then
[12225]280 echo "Restarting/ôÅËÕÝÉÊ ÂÉÂÌÉÏÔÅÞÎÙÊ ÉÎÔÅÒÆÅÊÓ Greenstone..."
281 else
282 echo "Restarting the Greenstone Librarian Interface..."
283 fi
284
285 fi
286done
287
[12286]288if [ "$glilang" = "es" ]; then
[6745]289 echo "¡Hecho!"
[12286]290elif [ "$glilang" = "fr" ]; then
[6712]291 echo "Terminé!"
[12286]292elif [ "$glilang" = "ru" ]; then
[6702]293 echo "÷ÙÐÏÌÎÅÎÏ!"
294else
295 echo "Done!"
[12286]296fi
Note: See TracBrowser for help on using the repository browser.