root/gli/trunk/gli.bat @ 15354

Revision 15354, 12.9 KB (checked in by oranfry, 11 years ago)

In gli.bat and gli4gs3.bat, use the temp directory speicified in the TMP environment variable for all temp files

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
1@echo off
2set GLILANG=en
3
4
5::  -------- Run the Greenstone Librarian Interface --------
6
7:: This script must be run from within the directory in which it lives
8if exist gli.bat goto start
9    if "%GLILANG%" == "en" echo This script must be run from the directory in which it resides.
10    if "%GLILANG%" == "es" echo Este gui¢n deber  ejecutarse desde el directorio en el que reside.
11    if "%GLILANG%" == "fr" echo Ce script doit ˆtre ex‚cut‚ … partir du r‚pertoire dans lequel il se trouve.
12    if "%GLILANG%" == "ru" echo â®â áªàš¯â €®«Š¥­ ¡ëâì ¢§ïâ š§ €šà¥ªâ®àšš, ¢ ª®â®à®© ®­ à á¯®«®Š¥­
13    goto exit
14
15:start
16if "%OS%" == "Windows_NT" goto findGSDL
17    :: Invoke a new command processor to ensure there's enough environment space
18    if "%1" == "Second" goto findGSDL
19        command /E:2048 /C %0 Second %1 %2 %3 %4 %5 %6 %7 %8 %9
20        goto done
21
22:findGSDL
23echo.
24if "%GLILANG%" == "en" echo Greenstone Librarian Interface (GLI)
25if "%GLILANG%" == "en" echo Copyright (C) 2006, New Zealand Digital Library Project, University Of Waikato
26if "%GLILANG%" == "en" echo GLI comes with ABSOLUTELY NO WARRANTY; for details see LICENSE.txt
27if "%GLILANG%" == "en" echo This is free software, and you are welcome to redistribute it
28
29if "%GLILANG%" == "es" echo Interfaz de la Biblioteca Digital Greenstone (Greenstone Librarian Interface - GLI)
30if "%GLILANG%" == "es" echo Copyright (C) 2006, New Zealand Digital Library Project, University Of Waikato
31if "%GLILANG%" == "es" echo La Interfaz de la Biblioteca Digital Greenstone NO INCLUYE ABSOLUTAMENTE NINGUNA GARANTÖA.
32if "%GLILANG%" == "es" echo Para mayor informaci¢n vea los t‚rminos de la licencia en LICENSE.txt
33if "%GLILANG%" == "es" echo Este es un software abierto, por lo que lo invitamos a que lo distribuya de forma gratuita
34
35if "%GLILANG%" == "fr" echo Interface du Biblioth‚caire Greenstone (Greenstone Librarian Interface - GLI)
36if "%GLILANG%" == "fr" echo Copyright (C) 2006, New Zealand Digital Library Project, University Of Waikato
37if "%GLILANG%" == "fr" echo GLI est fourni sans AUCUNE GARANTIE; pour des d‚tails, voir LICENSE.txt
38if "%GLILANG%" == "fr" echo Ceci est un logiciel libre, et vous ˆtes invit‚ … le redistribuer
39
40if "%GLILANG%" == "ru" echo š¡«š®â¥ç­ë© š­â¥à䥩á Greenstone (Greenstone Librarian Interface - GLI)
41if "%GLILANG%" == "ru" echo Copyright (C) 2006, New Zealand Digital Library Project, University Of Waikato
42if "%GLILANG%" == "ru" echo ˆƒ ­¥ € ¥â €‘Ž‹ž’Ž ˆŠ€Šˆ• ƒ€€’ˆ‰; €¥â «š á¬. ¢ ⥪á⥠LICENSE.TXT
43if "%GLILANG%" == "ru" echo â® - ᢮¡®€­® à á¯à®áâ࠭塞®¥ ¯à®£à ¬¬­®¥ ®¡¥á¯¥ç¥­š¥ š ‚ë ¬®Š¥â¥ à á¯à®áâà ­ïâì ¥£®
44
45echo.
46::  ---- Determine GSDLHOME ----
47set GSDLPATH=
48
49:: Some users may set the above line manually
50if not "%GSDLPATH%" == "" goto testGSDL
51
52    :: The default location for the GLI is a subdirectory of Greenstone
53    set GSDLPATH=..
54
55    :: If it is set, use the GSDLHOME environment variable
56    if "%GSDLHOME%" == "" goto testGSDL
57    set GSDLPATH=%GSDLHOME%
58
59:testGSDL
60:: Check that the Greenstone installation looks OK
61if "%GLILANG%" == "en" echo Checking GSDL: %GSDLPATH%
62if "%GLILANG%" == "es" echo Revisando GSDL: %GSDLPATH%
63if "%GLILANG%" == "fr" echo V‚rification de GSDL: %GSDLPATH%
64if "%GLILANG%" == "ru" echo à®¢¥àª  GSDL: %GSDLPATH%
65if exist "%GSDLPATH%\setup.bat" goto prepGSDL
66    echo.
67    if "%GLILANG%" == "en" echo The Greenstone installation could not be found, or is incomplete.
68    if "%GLILANG%" == "en" echo Try reinstalling Greenstone then running this script again.
69
70    if "%GLILANG%" == "es" echo No se pudo encontrar la instalaci¢n de Greenstone o est  incompleta.
71    if "%GLILANG%" == "es" echo Trate de reinstalar Greenstone y a continuaci¢n ejecute nuevamente este gui¢n.
72
73    if "%GLILANG%" == "fr" echo L'installation de Greenstone est introuvable ou incomplŠte. Essayez
74    if "%GLILANG%" == "fr" echo de r‚installer Greenstone et ex‚cutez ce script … nouveau.
75
76    if "%GLILANG%" == "ru" echo ˆ­áâ ««ïæšï Greenstone ­¥ ¡ë«  ­ ©€¥­  š«š ®­  ­¥¯®«­ . ®¯à®¡ã©â¥ ¯®¢â®à­®
77    if "%GLILANG%" == "ru" echo ãáâ ­®¢šâì Greenstone,   § â¥¬ ¢¢¥áâš íâ®â áªàš¯â á­®¢ .
78    goto exit
79
80:prepGSDL
81:: Setup Greenstone, unless it has already been done
82if not "%GSDLHOME%" == "" goto doneGSDL
83    call "%GSDLPATH%\setup.bat" SetEnv > nul
84
85:doneGSDL
86:: GSDLPATH is no longer needed, since GSDLHOME should now be set
87set GSDLPATH=
88
89
90:findPerl
91::  ---- Check Perl exists ----
92set PERLPATH=
93
94:: Some users may set the above line manually - If you do this, you need to
95:: make sure that perl is in your path otherwise lucene collections may not
96:: work
97if not "%PERLPATH%" == "" goto testPerl
98
99    :: Check if Perl is on the search path
100    echo %PATH%| winutil\which.exe perl.exe | winutil\setvar.exe PERLPATH > %TMP%\setperl.bat
101    call %TMP%\setperl.bat
102    del %TMP%\setperl.bat
103    if not "%PERLPATH%" == "" goto testPerl
104
105    :: If not, try GSDLHOME\bin\windows\perl\bin
106    if exist "%GSDLHOME%\bin\windows\perl\bin\perl.exe" goto gsdlPerl
107
108    :: Still haven't found anything, so try looking in the registry (gulp!)
109    type nul > %TMP%\perl.reg
110    regedit /E %TMP%\perl.reg "HKEY_LOCAL_MACHINE\SOFTWARE\Perl"
111    type %TMP%\perl.reg > %TMP%\perl.txt
112    del %TMP%\perl.reg
113
114    winutil\findperl.exe %TMP%\perl.txt | winutil\setvar.exe PERLPATH > %TMP%\setperl.bat
115    del %TMP%\perl.txt
116    call %TMP%\setperl.bat
117    del %TMP%\setperl.bat
118
119    :: If nothing was found in the registry, we're stuck
120    if "%PERLPATH%" == "" goto noPerl
121
122    :: if have found perl in registry, but not in path, then we need to
123    :: add it to path for lucene stuff.
124    if "%OS%" == "Windows_NT" set PATH=%PATH%;%PERLPATH%
125    if "%OS%" == "" set PATH="%PATH%";"%PERLPATH%"
126    goto testPerl
127
128:gsdlPerl
129    set PERLPATH=%GSDLHOME%\bin\windows\perl\bin
130       
131:testPerl
132:: Check that a Perl executable has been found
133if "%GLILANG%" == "en" echo Checking Perl: %PERLPATH%
134if "%GLILANG%" == "es" echo Revisando Perl: %PERLPATH%
135if "%GLILANG%" == "fr" echo V‚rification de Perl: %PERLPATH%
136if "%GLILANG%" == "ru" echo à®¢¥àª  Perl: %PERLPATH%
137if exist "%PERLPATH%\perl.exe" goto findJava
138
139:noPerl
140    echo.
141    if "%GLILANG%" == "en" echo The Greenstone Librarian Interface requires perl in order to operate,
142    if "%GLILANG%" == "en" echo but perl could not be detected on your system. Please ensure that perl
143    if "%GLILANG%" == "en" echo is installed and is on your search path, then rerun this script.
144
145    if "%GLILANG%" == "es" echo La Interfaz de la Biblioteca Digital Greenstone requiere Perl para poder
146    if "%GLILANG%" == "es" echo operar, pero ‚ste no aparece en su sistema. Por favor aseg£rese de
147    if "%GLILANG%" == "es" echo que Perl est  instalado y se encuentra en su ruta de b£squeda.
148    if "%GLILANG%" == "es" echo A continuaci¢n ejecute nuevamente este gui¢n.
149
150    if "%GLILANG%" == "fr" echo Greenstone Librarian Interface n‚cessite perl pour son fonctionnement,
151    if "%GLILANG%" == "fr" echo mais perl n'a pas pu ˆtre d‚tect‚ dans votre systŠme. Veuillez vous
152    if "%GLILANG%" == "fr" echo assurer que perl est install‚ et est sp‚cifi‚ dans votre chemin de
153    if "%GLILANG%" == "fr" echo recherche, puis red‚marrez ce script.
154
155    if "%GLILANG%" == "ru" echo š¡«š®â¥ç­ë© š­â¥à䥩á Greenstone âॡã¥â Perl, çâ®¡ë š¬¥âì ¢®§¬®Š­®áâì
156    if "%GLILANG%" == "ru" echo à ¡®â âì, ­® Perl ­¥ ¡ë« ¢ ¢ è¥© ášá⥬¥. ®Š «ã©áâ , ¯®€â¢¥à€šâ¥,
157    if "%GLILANG%" == "ru" echo çâ® Perl ãáâ ­®¢«¥­ š ­ å®€šâáï ­  ¢ è¥¬ ¯ãâš ¯®šáª , § â¥¬
158    if "%GLILANG%" == "ru" echo ¯®¢â®à­®¢¢¥€šâ¥ íâ®â áªàš¯â.
159    goto exit
160
161
162:findJava
163:: ---- Check Java exists ----
164set JAVAPATH=
165
166:: Some users may set the above line manually
167if not "%JAVAPATH%" == "" goto testJava
168
169    :: If it is set, use the JAVA_HOME environment variable
170    if not "%JAVA_HOME%" == "" goto javahome
171
172    :: Check if Java is on the search path
173    echo %PATH%| winutil\which.exe java.exe | winutil\setvar.exe JAVAPATH > %TMP%\setjava.bat
174    call %TMP%\setjava.bat
175    del %TMP%\setjava.bat
176    if not "%JAVAPATH%" == "" goto testJava
177
178    :: Still haven't found anything, so try looking in the registry (gulp!)
179    type nul > %TMP%\jdk.reg
180    regedit /E %TMP%\jdk.reg "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit"
181    type %TMP%\jdk.reg > %TMP%\jdk.txt
182    del %TMP%\jdk.reg
183    type nul > %TMP%\jre.reg
184    regedit /E %TMP%\jre.reg "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment"
185    type %TMP%\jre.reg > %TMP%\jre.txt
186    del %TMP%\jre.reg
187
188    winutil\findjava.exe %TMP%\jdk.txt %TMP%\jre.txt | winutil\setvar.exe JAVAPATH > %TMP%\setjava.bat
189    del %TMP%\jdk.txt
190    del %TMP%\jre.txt
191    call %TMP%\setjava.bat
192    del %TMP%\setjava.bat
193
194    :: If nothing was found in the registry, we're stuck
195    if "%JAVAPATH%" == "" goto noJava
196
197    set JAVAPATH=%JAVAPATH%\bin
198    goto testJava
199
200:javahome
201    set JAVAPATH=%JAVA_HOME%\bin
202
203:testJava
204:: Check that a Java executable has been found
205if "%GLILANG%" == "en" echo Checking Java: %JAVAPATH%
206if "%GLILANG%" == "es" echo Revisando Java: %JAVAPATH%
207if "%GLILANG%" == "fr" echo V‚rification de Java: %JAVAPATH%
208if "%GLILANG%" == "ru" echo à®¢¥àª  Java: %JAVAPATH%
209if exist "%JAVAPATH%\java.exe" goto checkGLI
210
211:noJava
212    echo.
213    if "%GLILANG%" == "en" echo Failed to locate an appropriate version of Java. You must install a
214    if "%GLILANG%" == "en" echo Java Runtime Environment (version 1.4 or greater) before running the
215    if "%GLILANG%" == "en" echo Greenstone Librarian Interface.
216
217    if "%GLILANG%" == "es" echo No se pudo localizar una versi¢n apropiada de Java. Usted deber 
218    if "%GLILANG%" == "es" echo instalar un Ambiente de Ejecuci¢n Java (versi¢n 1.4 o superior)
219    if "%GLILANG%" == "es" echo antes de correr la Interfaz de la Biblioteca Digital Greenstone.
220
221    if "%GLILANG%" == "fr" echo Une version ad‚quate de Java n'a pas pu ˆtre localis‚e. Vous devez
222    if "%GLILANG%" == "fr" echo installer un Java Runtime Environment (version 1.4 ou sup‚rieur)
223    if "%GLILANG%" == "fr" echo avant de d‚marrer Greenstone Librarian Interface.
224
225    if "%GLILANG%" == "ru" echo ¥ 〠«®áì ®¯à¥€¥«šâì ¬¥áâ®­ å®Š€¥­š¥ ᮮ⢥âáâ¢ãî饩 ¢¥àášš Java.
226    if "%GLILANG%" == "ru" echo ‚ë €®«Š­ë ãáâ ­®¢šâì Java Runtime Environment (¢¥àášî 1.4 š«š ¢ëè¥) ¯¥à¥€ ¢¢®€®¬
227    if "%GLILANG%" == "ru" echo ¡š¡«š®â¥ç­®£® š­â¥àä¥©á  Greenstone.
228    goto exit
229
230
231:checkGLI
232:: ---- Check that the GLI has been compiled ----
233if exist "classes/org/greenstone/gatherer/Gatherer.class" goto runGLI
234if exist "GLI.jar" goto runGLI
235    echo.
236    if "%GLILANG%" == "en" echo You need to compile the Greenstone Librarian Interface (using makegli.bat)
237    if "%GLILANG%" == "en" echo before running this script.
238
239    if "%GLILANG%" == "es" echo Usted necesita compilar la Interfaz de la Biblioteca Digital Greenstone
240    if "%GLILANG%" == "es" echo (por medio de makegli.bat) antes de ejecutar este gui¢n.
241
242    if "%GLILANG%" == "fr" echo Vous devez compiler le Greenstone Interface (en utilisant makegli.bat)
243    if "%GLILANG%" == "fr" echo avant d'ex‚cuter ce script.
244
245    if "%GLILANG%" == "ru" echo ‚ë €®«Š­ë ª®¬¯š«šà®¢ âì ¡š¡«š®â¥ç­ë© š­â¥à䥩á Greenstone (šá¯®«ì§ãï makegli.bat)
246    if "%GLILANG%" == "ru" echo ¯¥à¥€ ¢¢®€®¬ í⮣® áªàš¯â 
247    goto exit
248
249
250:runGLI
251:: ---- Finally, run the GLI ----
252echo.
253
254if "%GLILANG%" == "en" echo Running the Greenstone Librarian Interface...
255if "%GLILANG%" == "es" echo Ejecutando la Interfaz de la Biblioteca Digital Greenstone...
256if "%GLILANG%" == "fr" echo Ex‚cution de Greenstone Librarian Interface
257if "%GLILANG%" == "ru" echo ’¥ªãéš© ¡š¡«š®â¥ç­ë© š­â¥à䥩á Greenstone...
258
259:: -Xms32M          To set minimum memory
260:: -Xmx32M          To set maximum memory
261:: -verbose:gc      To set garbage collection messages
262:: -Xincgc          For incremental garbage collection
263:: -Xprof           Function call profiling
264:: -Xloggc:<file>   Write garbage collection log
265
266if exist "%GSDLHOME%\server.exe" goto localLib
267
268:webLib
269    "%JAVAPATH%\java" -Xmx128M -cp classes/;GLI.jar;lib/apache.jar;lib/qfslib.jar org.greenstone.gatherer.GathererProg -gsdl %GSDLHOME% -gsdlos %GSDLOS% -perl %PERLPATH% %1 %2 %3 %4 %5 %6 %7 %8 %9
270
271    if ERRORLEVEL 2 goto webLib
272
273    if "%GLILANG%" == "en" echo Done!
274    if "%GLILANG%" == "es" echo ­Hecho!
275    if "%GLILANG%" == "fr" echo Termin‚!
276    if "%GLILANG%" == "ru" echo ‚믮«­¥­®!
277    goto done
278
279:localLib
280    "%JAVAPATH%\java" -Xmx128M -cp classes/;GLI.jar;lib/apache.jar;lib/qfslib.jar org.greenstone.gatherer.GathererProg -gsdl %GSDLHOME% -gsdlos %GSDLOS% -perl %PERLPATH% -local_library %GSDLHOME%\server.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
281
282    if ERRORLEVEL 2 goto localLib
283
284    if "%GLILANG%" == "en" echo Done!
285    if "%GLILANG%" == "es" echo ­Hecho!
286    if "%GLILANG%" == "fr" echo Termin‚!
287    if "%GLILANG%" == "ru" echo ‚믮«­¥­®!
288    goto done
289
290:exit
291echo.
292pause
293
294:done
295:: ---- Clean up ----
296set PERLPATH=
297set JAVAPATH=
Note: See TracBrowser for help on using the browser.