[4914] | 1 | #!/bin/sh
|
---|
[6752] | 2 | glilang=en
|
---|
[4914] | 3 |
|
---|
[6262] | 4 | echo
|
---|
[6745] | 5 | if [ "$glilang" == "es" ]; then
|
---|
[6707] | 6 | echo "-- Still coming --"
|
---|
[6745] | 7 | elif [ "$glilang" == "fr" ]; then
|
---|
| 8 | echo "-- Still coming --"
|
---|
[6712] | 9 | elif [ "$glilang" == "ru" ]; then
|
---|
| 10 | echo "-- Still coming --"
|
---|
[6702] | 11 | else
|
---|
| 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'
|
---|
| 16 | fi
|
---|
[6223] | 17 | echo
|
---|
[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] | 22 | thisdir=`pwd`
|
---|
| 23 | if [ ! -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] | 34 | fi
|
---|
| 35 |
|
---|
[4952] | 36 |
|
---|
[5003] | 37 | ## ---- Determine GSDLHOME ----
|
---|
[6624] | 38 | gsdlpath=
|
---|
[4952] | 39 |
|
---|
| 40 | # Some users may set the above line manually
|
---|
[5003] | 41 | if [ "$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
|
---|
| 52 | fi
|
---|
| 53 |
|
---|
| 54 | # Check that the Greenstone installation looks OK
|
---|
[6745] | 55 | if [ "$glilang" == "es" ]; then
|
---|
| 56 | echo "Revisando GSDL: $gsdlpath"
|
---|
| 57 | elif [ "$glilang" == "fr" ]; then
|
---|
[6712] | 58 | echo "Vérification de GSDL: $gsdlpath"
|
---|
| 59 | elif [ "$glilang" == "ru" ]; then
|
---|
[6702] | 60 | echo "ðÒÏ×ÅÒËÁ GSDL: $gsdlpath"
|
---|
| 61 | else
|
---|
| 62 | echo "Checking GSDL: $gsdlpath"
|
---|
| 63 | fi
|
---|
[5091] | 64 | if [ ! -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
|
---|
| 81 | fi
|
---|
| 82 |
|
---|
[5003] | 83 | # Setup Greenstone, unless it has already been done
|
---|
| 84 | if [ "$GSDLHOME" == "" ]; then
|
---|
| 85 | pushd $gsdlpath > /dev/null
|
---|
| 86 | source setup.bash
|
---|
| 87 | popd > /dev/null
|
---|
| 88 | fi
|
---|
[4952] | 89 |
|
---|
| 90 |
|
---|
[5003] | 91 | ## ---- Check Perl exists ----
|
---|
[4952] | 92 | perlpath=
|
---|
| 93 |
|
---|
| 94 | # Some users may set the above line manually
|
---|
| 95 | if [ "$perlpath" == "" ]; then
|
---|
[5003] | 96 | # Check if Perl is on the search path
|
---|
[4952] | 97 | perlpath=`which perl 2> /dev/null`
|
---|
| 98 | fi
|
---|
| 99 |
|
---|
[5003] | 100 | # Check that a Perl executable has been found
|
---|
[6745] | 101 | if [ "$glilang" == "es" ]; then
|
---|
| 102 | echo "Revisando Perl: $perlpath"
|
---|
| 103 | elif [ "$glilang" == "fr" ]; then
|
---|
[6712] | 104 | echo "Vérification de Perl: $perlpath"
|
---|
| 105 | elif [ "$glilang" == "ru" ]; then
|
---|
[6702] | 106 | echo "ðÒÏ×ÅÒËÁ Perl: $perlpath"
|
---|
| 107 | else
|
---|
| 108 | echo "Checking Perl: $perlpath"
|
---|
| 109 | fi
|
---|
[4952] | 110 | if [ ! -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
|
---|
| 133 | fi
|
---|
| 134 |
|
---|
| 135 |
|
---|
[5003] | 136 | ## ---- Check Java exists ----
|
---|
[4952] | 137 | javapath=
|
---|
| 138 |
|
---|
| 139 | # Some users may set the above line manually
|
---|
| 140 | if [ "$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
|
---|
| 150 | fi
|
---|
| 151 |
|
---|
[5003] | 152 | # Check that a Java executable has been found
|
---|
[6745] | 153 | if [ "$glilang" == "es" ]; then
|
---|
| 154 | echo "Revisando Java: $javapath"
|
---|
| 155 | elif [ "$glilang" == "fr" ]; then
|
---|
[6712] | 156 | echo "Vérification de Java: $javapath"
|
---|
| 157 | elif [ "$glilang" == "ru" ]; then
|
---|
[6702] | 158 | echo "ðÒÏ×ÅÒËÁ Java: $javapath"
|
---|
| 159 | else
|
---|
| 160 | echo "Checking Java: $javapath"
|
---|
| 161 | fi
|
---|
[4952] | 162 | if [ ! -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
|
---|
| 182 | fi
|
---|
| 183 |
|
---|
| 184 |
|
---|
| 185 | ## -- Check the version of Java is new enough (1.4.0 or higher) to run the GLI --
|
---|
| 186 | javaversion=`$javapath -version 2>&1 | sed -n 's/^java version \"\(.*\)\"/\1/p'`
|
---|
| 187 | jvmajor=`echo $javaversion | sed -n 's/^\([0-9]*\).*$/\1/p'`
|
---|
| 188 | jvminor=`echo $javaversion | sed -n 's/^[0-9]*\.\([0-9]*\).*$/\1/p'`
|
---|
| 189 |
|
---|
| 190 | jok=1
|
---|
| 191 | if [ $jvmajor -lt 1 ] ; then
|
---|
| 192 | jok=0
|
---|
| 193 | fi
|
---|
| 194 | if [ $jvmajor -eq 1 ] && [ $jvminor -lt 4 ] ; then
|
---|
| 195 | jok=0
|
---|
| 196 | fi
|
---|
| 197 | if [ $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
|
---|
| 221 | fi
|
---|
| 222 |
|
---|
[5003] | 223 | ## ---- Check that the GLI has been compiled ----
|
---|
[5027] | 224 | if [ ! -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
|
---|
| 240 | fi
|
---|
| 241 |
|
---|
[6211] | 242 | if [ "$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] | 255 | fi
|
---|
[4952] | 256 |
|
---|
[5003] | 257 | ## ---- Finally, run the GLI ----
|
---|
| 258 | echo
|
---|
[6745] | 259 | if [ "$glilang" == "es" ]; then
|
---|
| 260 | echo "Ejecutando la Interfaz de la Biblioteca Digital Greenstone..."
|
---|
| 261 | elif [ "$glilang" == "fr" ]; then
|
---|
[6712] | 262 | echo "Exécution de Greenstone Librarian Interface"
|
---|
| 263 | elif [ "$glilang" == "ru" ]; then
|
---|
[6702] | 264 | echo "ôÅËÕÝÉÊ ÂÉÂÌÉÏÔÅÞÎÙÊ ÉÎÔÅÒÆÅÊÓ Greenstone..."
|
---|
| 265 | else
|
---|
| 266 | echo "Running the Greenstone Librarian Interface..."
|
---|
| 267 | fi
|
---|
[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] | 277 | java -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] | 279 | if [ "$glilang" == "es" ]; then
|
---|
| 280 | echo "¡Hecho!"
|
---|
| 281 | elif [ "$glilang" == "fr" ]; then
|
---|
[6712] | 282 | echo "Terminé!"
|
---|
| 283 | elif [ "$glilang" == "ru" ]; then
|
---|
[6702] | 284 | echo "÷ÙÐÏÌÎÅÎÏ!"
|
---|
| 285 | else
|
---|
| 286 | echo "Done!"
|
---|
| 287 | fi |
---|