source: trunk/gli/gli.sh@ 6742

Last change on this file since 6742 was 6712, checked in by mdewsnip, 20 years ago

Now with French strings!

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 8.2 KB
Line 
1#!/bin/sh
2glilang=
3
4echo
5if [ "$glilang" == "fr" ]; then
6 echo "-- Still coming --"
7elif [ "$glilang" == "ru" ]; then
8 echo "-- Still coming --"
9else
10 echo 'Greenstone Librarian Interface (GLI)'
11 echo 'Copyright (C) 2004, New Zealand Digital Library Project, University Of Waikato'
12 echo 'GLI comes with ABSOLUTELY NO WARRANTY; for details see LICENSE.txt'
13 echo 'This is free software, and you are welcome to redistribute it'
14fi
15echo
16
17## -------- Run the Greenstone Librarian Interface --------
18
19# This script must be run from within the directory in which it lives
20thisdir=`pwd`
21if [ ! -f "${thisdir}/gli.sh" ]; then
22 if [ "$glilang" == "fr" ]; then
23 echo "Ce script doit être exécuté à partir du répertoire dans lequel il se trouve."
24 elif [ "$glilang" == "ru" ]; then
25 echo "üÔÏÔ ÓËÒÉÐÔ ÄÏÌÖÅÎ ÂÙÔØ ×ÚÑÔ ÉÚ ÄÉÒÅËÔÏÒÉÉ, × ËÏÔÏÒÏÊ ÏÎ ÒÁÓÐÏÌÏÖÅÎ"
26 else
27 echo "This script must be run from the directory in which it resides."
28 fi
29 exit 1
30fi
31
32
33## ---- Determine GSDLHOME ----
34gsdlpath=
35
36# Some users may set the above line manually
37if [ "$gsdlpath" == "" ]; then
38 # Check the environment variable first
39 if [ "$GSDLHOME" != "" ]; then
40 gsdlpath=$GSDLHOME
41
42 # If it is not set, assume that the GLI is installed as a subdirectory of Greenstone
43 else
44 pushd .. > /dev/null
45 gsdlpath=`pwd`
46 popd > /dev/null
47 fi
48fi
49
50# Check that the Greenstone installation looks OK
51if [ "$glilang" == "fr" ]; then
52 echo "Vérification de GSDL: $gsdlpath"
53elif [ "$glilang" == "ru" ]; then
54 echo "ðÒÏ×ÅÒËÁ GSDL: $gsdlpath"
55else
56 echo "Checking GSDL: $gsdlpath"
57fi
58if [ ! -f "${gsdlpath}/setup.bash" ] ; then
59 echo
60 if [ "$glilang" == "fr" ]; then
61 echo "L'installation de Greenstone est introuvable ou incomplète."
62 echo "Essayez de réinstaller Greenstone et exécutez ce script à nouveau."
63 elif [ "$glilang" == "ru" ]; then
64 echo "éÎÓÔÁÌÌÑÃÉÑ Greenstone ÎÅ ÂÙÌÁ ÎÁÊÄÅÎÁ ÉÌÉ ÏÎÁ ÎÅÐÏÌÎÁ."
65 echo "ðÏÐÒÏÂÕÊÔÅ ÐÏ×ÔÏÒÎÏ ÕÓÔÁÎÏ×ÉÔØ Greenstone, Á ÚÁÔÅÍ ××ÅÓÔÉ ÜÔÏÔ ÓËÒÉÐÔ ÓÎÏ×Á."
66 else
67 echo "The Greenstone installation could not be found, or is incomplete."
68 echo "Try reinstalling Greenstone then running this script again."
69 fi
70 exit 1
71fi
72
73# Setup Greenstone, unless it has already been done
74if [ "$GSDLHOME" == "" ]; then
75 pushd $gsdlpath > /dev/null
76 source setup.bash
77 popd > /dev/null
78fi
79
80
81## ---- Check Perl exists ----
82perlpath=
83
84# Some users may set the above line manually
85if [ "$perlpath" == "" ]; then
86 # Check if Perl is on the search path
87 perlpath=`which perl 2> /dev/null`
88fi
89
90# Check that a Perl executable has been found
91if [ "$glilang" == "fr" ]; then
92 echo "Vérification de Perl: $perlpath"
93elif [ "$glilang" == "ru" ]; then
94 echo "ðÒÏ×ÅÒËÁ Perl: $perlpath"
95else
96 echo "Checking Perl: $perlpath"
97fi
98if [ ! -x "$perlpath" ] ; then
99 echo
100 if [ "$glilang" == "fr" ]; then
101 echo "Greenstone Librarian Interface nécessite perl pour son fonctionnement,"
102 echo "mais perl n'a pas pu être détecté dans votre système. Veuillez vous "
103 echo "assurer que perl est installé et est spécifié dans votre chemin de "
104 echo "recherche, puis redémarrez ce script."
105 elif [ "$glilang" == "ru" ]; then
106 echo "âÉÂÌÉÏÔÅÞÎÙÊ ÉÎÔÅÒÆÅÊÓ Greenstone ÔÒÅÂÕÅÔ Perl, ÞÔÏÂÙ ÉÍÅÔØ ×ÏÚÍÏÖÎÏÓÔØ"
107 echo "ÒÁÂÏÔÁÔØ, ÎÏ Perl ÎÅ ÂÙÌ × ×ÁÛÅÊ ÓÉÓÔÅÍÅ. ðÏÖÁÌÕÊÓÔÁ, ÐÏÄÔ×ÅÒÄÉÔÅ, ÞÔÏ "
108 echo "Perl ÕÓÔÁÎÏ×ÌÅÎ É ÎÁÈÏÄÉÔÓÑ ÎÁ ×ÁÛÅÍ ÐÕÔÉ ÐÏÉÓËÁ, ÚÁÔÅÍ ÐÏ×ÔÏÒÎÏ××ÅÄÉÔÅ"
109 echo "ÜÔÏÔ ÓËÒÉÐÔ."
110 else
111 echo "The Greenstone Librarian Interface requires perl in order to operate,"
112 echo "but perl could not be detected on your system. Please ensure that perl"
113 echo "is installed and is on your search path, then rerun this script."
114 fi
115 exit 1
116fi
117
118
119## ---- Check Java exists ----
120javapath=
121
122# Some users may set the above line manually
123if [ "$javapath" == "" ]; then
124
125 # If it is set, use the JAVA_HOME environment variable
126 if [ "$JAVA_HOME" != "" ]; then
127 javapath="$JAVA_HOME/bin/java"
128
129 # Check if Java is on the search path
130 else
131 javapath=`which java 2> /dev/null`
132 fi
133fi
134
135# Check that a Java executable has been found
136if [ "$glilang" == "fr" ]; then
137 echo "Vérification de Java: $javapath"
138elif [ "$glilang" == "ru" ]; then
139 echo "ðÒÏ×ÅÒËÁ Java: $javapath"
140else
141 echo "Checking Java: $javapath"
142fi
143if [ ! -x "$javapath" ]; then
144 echo
145 if [ "$glilang" == "fr" ]; then
146 echo "Une version adéquate de Java n'a pas pu être localisée."
147 echo "Vous devez installer un Java Runtime Environment (version 1.4 ou"
148 echo "supérieur) avant de démarrer Greenstone Librarian Interface."
149 elif [ "$glilang" == "ru" ]; then
150 echo "îÅ ÕÄÁÌÏÓØ ÏÐÒÅÄÅÌÉÔØ ÍÅÓÔÏÎÁÈÏÖÄÅÎÉÅ ÓÏÏÔ×ÅÔÓÔ×ÕÀÝÅÊ ×ÅÒÓÉÉ Java."
151 echo "÷Ù ÄÏÌÖÎÙ ÕÓÔÁÎÏ×ÉÔØ Java Runtime Environment (×ÅÒÓÉÀ 1.4 ÉÌÉ ×ÙÛÅ)"
152 echo "ÐÅÒÅÄ ××ÏÄÏÍ ÂÉÂÌÉÏÔÅÞÎÏÇÏ ÉÎÔÅÒÆÅÊÓÁ Greenstone."
153 else
154 echo "Failed to locate an appropriate version of Java. You must install a"
155 echo "Java Runtime Environment (version 1.4 or greater) before running the"
156 echo "Greenstone Librarian Interface."
157 fi
158 exit 1
159fi
160
161
162## -- Check the version of Java is new enough (1.4.0 or higher) to run the GLI --
163javaversion=`$javapath -version 2>&1 | sed -n 's/^java version \"\(.*\)\"/\1/p'`
164jvmajor=`echo $javaversion | sed -n 's/^\([0-9]*\).*$/\1/p'`
165jvminor=`echo $javaversion | sed -n 's/^[0-9]*\.\([0-9]*\).*$/\1/p'`
166
167jok=1
168if [ $jvmajor -lt 1 ] ; then
169 jok=0
170fi
171if [ $jvmajor -eq 1 ] && [ $jvminor -lt 4 ] ; then
172 jok=0
173fi
174if [ $jok -eq 0 ] ; then
175 echo
176 if [ "$glilang" == "fr" ]; then
177 echo "La version de Java Runtime Environment que vous avez installée est"
178 echo "trop vielle pour faire fonctionner Greenstone Librarian Interface."
179 echo "Veuillez installer une nouvelle version du JRE (version 1.4 ou plus"
180 echo "récente) et redémarrez le script."
181 elif [ "$glilang" == "ru" ]; then
182 echo "÷ÅÒÓÉÑ Java Runtime Environment, ËÏÔÏÒÕÀ ÷Ù ÕÓÔÁÎÏ×ÉÌÉ, ÏÞÅÎØ ÓÔÁÒÁ,"
183 echo "ÞÔÏÂÙ ÕÐÒÁ×ÌÑÔØ ÂÉÂÌÉÏÔÅÞÎÙÍ ÉÎÔÅÒÆÅÊÓÏÍ Greenstone. ðÏÖÁÌÕÊÓÔÁ, "
184 echo "ÕÓÔÁÎÏ×ÉÔÅ ÎÏ×ÕÀ ×ÅÒÓÉÀ JRE (×ÅÒÓÉÀ 1.4 ÉÌÉ ÂÏÌÅÅ ÎÏ×ÕÀ) É"
185 echo "ÐÅÒÅÕÓÔÁÎÏ×ÉÔÅ ÜÔÏÔ ÓËÒÉÐÔ"
186 else
187 echo "The version of the Java Runtime Environment you have installed is too"
188 echo "old to run the Greenstone Librarian Interface. Please install a new"
189 echo "version of the JRE (version 1.4 or newer) and rerun this script."
190 fi
191 exit 1
192fi
193
194## ---- Check that the GLI has been compiled ----
195if [ ! -f "classes/org/greenstone/gatherer/Gatherer.class" ] && [ ! -f "GLI.jar" ]; then
196 echo
197 if [ "$glilang" == "fr" ]; then
198 echo "Vous devez compiler le Greenstone Interface (en utilisant makegli.sh)"
199 echo "avant d'exécuter ce script."
200 elif [ "$glilang" == "ru" ]; then
201 echo "÷Ù ÄÏÌÖÎÙ ËÏÍÐÉÌÉÒÏ×ÁÔØ ÂÉÂÌÉÏÔÅÞÎÙÊ ÉÎÔÅÒÆÅÊÓ Greenstone"
202 echo "(ÉÓÐÏÌØÚÕÑ makegli.sh) ÐÅÒÅÄ ××ÏÄÏÍ ÜÔÏÇÏ ÓËÒÉÐÔÁ"
203 else
204 echo "You need to compile the Greenstone Librarian Interface (using makegli.sh)"
205 echo "before running this script."
206 fi
207 exit 1
208fi
209
210if [ "$1" == "-test" ]; then
211 if [ "$glilang" == "fr" ]; then
212 echo "-- Still coming --"
213 elif [ "$glilang" == "ru" ]; then
214 echo "-- Still coming --"
215 else
216 echo "Testing class: $2"
217 echo "arguments $*"
218 fi
219 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
220 exit 0
221fi
222
223## ---- Finally, run the GLI ----
224echo
225if [ "$glilang" == "fr" ]; then
226 echo "Exécution de Greenstone Librarian Interface"
227elif [ "$glilang" == "ru" ]; then
228 echo "ôÅËÕÝÉÊ ÂÉÂÌÉÏÔÅÞÎÙÊ ÉÎÔÅÒÆÅÊÓ Greenstone..."
229else
230 echo "Running the Greenstone Librarian Interface..."
231fi
232
233# Other arguments you can provide to GLI to work around memory limitations, or debug
234# -Xms<number>M To set minimum memory (by default 32MB)
235# -Xmx<number>M To set maximum memory (by default the nearest 2^n to the total remaining physical memory)
236# -verbose:gc To set garbage collection messages
237# -Xincgc For incremental garbage collection (significantly slows performance)
238# -Xprof Function call profiling
239# -Xloggc:<file> Write garbage collection log
240
241java -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 $*
242
243if [ "$glilang" == "fr" ]; then
244 echo "Terminé!"
245elif [ "$glilang" == "ru" ]; then
246 echo "÷ÙÐÏÌÎÅÎÏ!"
247else
248 echo "Done!"
249fi
Note: See TracBrowser for help on using the repository browser.