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
RevLine 
[5824]1@echo off
[6749]2set GLILANG=en
[5824]3
[6749]4
[5824]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
[6749]9    if "%GLILANG%" == "en" echo This script must be run from the directory in which it resides.
[6753]10    if "%GLILANG%" == "es" echo Este gui¢n deber  ejecutarse desde el directorio en el que reside.
[6749]11    if "%GLILANG%" == "fr" echo Ce script doit ˆtre ex‚cut‚ … partir du r‚pertoire dans lequel il se trouve.
[6754]12    if "%GLILANG%" == "ru" echo â®â áªàš¯â €®«Š¥­ ¡ëâì ¢§ïâ š§ €šà¥ªâ®àšš, ¢ ª®â®à®© ®­ à á¯®«®Š¥­
[5824]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
[6669]22:findGSDL
[6667]23echo.
[6749]24if "%GLILANG%" == "en" echo Greenstone Librarian Interface (GLI)
[12453]25if "%GLILANG%" == "en" echo Copyright (C) 2006, New Zealand Digital Library Project, University Of Waikato
[6749]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
[6959]29if "%GLILANG%" == "es" echo Interfaz de la Biblioteca Digital Greenstone (Greenstone Librarian Interface - GLI)
[12453]30if "%GLILANG%" == "es" echo Copyright (C) 2006, New Zealand Digital Library Project, University Of Waikato
[6959]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
[6753]34
[6955]35if "%GLILANG%" == "fr" echo Interface du Biblioth‚caire Greenstone (Greenstone Librarian Interface - GLI)
[12453]36if "%GLILANG%" == "fr" echo Copyright (C) 2006, New Zealand Digital Library Project, University Of Waikato
[6955]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
[6754]39
[7041]40if "%GLILANG%" == "ru" echo š¡«š®â¥ç­ë© š­â¥à䥩á Greenstone (Greenstone Librarian Interface - GLI)
[12453]41if "%GLILANG%" == "ru" echo Copyright (C) 2006, New Zealand Digital Library Project, University Of Waikato
[7041]42if "%GLILANG%" == "ru" echo ˆƒ ­¥ € ¥â €‘Ž‹ž’Ž ˆŠ€Šˆ• ƒ€€’ˆ‰; €¥â «š á¬. ¢ ⥪á⥠LICENSE.TXT
43if "%GLILANG%" == "ru" echo â® - ᢮¡®€­® à á¯à®áâ࠭塞®¥ ¯à®£à ¬¬­®¥ ®¡¥á¯¥ç¥­š¥ š ‚ë ¬®Š¥â¥ à á¯à®áâà ­ïâì ¥£®
44
[6667]45echo.
[5824]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
[10625]55    :: If it is set, use the GSDLHOME environment variable
[5824]56    if "%GSDLHOME%" == "" goto testGSDL
57    set GSDLPATH=%GSDLHOME%
58
59:testGSDL
60:: Check that the Greenstone installation looks OK
[6749]61if "%GLILANG%" == "en" echo Checking GSDL: %GSDLPATH%
[6753]62if "%GLILANG%" == "es" echo Revisando GSDL: %GSDLPATH%
[6749]63if "%GLILANG%" == "fr" echo V‚rification de GSDL: %GSDLPATH%
[6754]64if "%GLILANG%" == "ru" echo à®¢¥àª  GSDL: %GSDLPATH%
[5824]65if exist "%GSDLPATH%\setup.bat" goto prepGSDL
66    echo.
[6749]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
[6753]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
[6749]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.
[6754]75
76    if "%GLILANG%" == "ru" echo ˆ­áâ ««ïæšï Greenstone ­¥ ¡ë«  ­ ©€¥­  š«š ®­  ­¥¯®«­ . ®¯à®¡ã©â¥ ¯®¢â®à­®
77    if "%GLILANG%" == "ru" echo ãáâ ­®¢šâì Greenstone,   § â¥¬ ¢¢¥áâš íâ®â áªàš¯â á­®¢ .
[5824]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
[15199]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
[5824]97if not "%PERLPATH%" == "" goto testPerl
98
99    :: Check if Perl is on the search path
[15354]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
[5824]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!)
[15354]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
[5824]113
[15354]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
[5824]118
119    :: If nothing was found in the registry, we're stuck
120    if "%PERLPATH%" == "" goto noPerl
121
[15199]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%"
[5824]126    goto testPerl
127
128:gsdlPerl
129    set PERLPATH=%GSDLHOME%\bin\windows\perl\bin
[15199]130       
[5824]131:testPerl
132:: Check that a Perl executable has been found
[6749]133if "%GLILANG%" == "en" echo Checking Perl: %PERLPATH%
[6753]134if "%GLILANG%" == "es" echo Revisando Perl: %PERLPATH%
[6749]135if "%GLILANG%" == "fr" echo V‚rification de Perl: %PERLPATH%
[6754]136if "%GLILANG%" == "ru" echo à®¢¥àª  Perl: %PERLPATH%
[5824]137if exist "%PERLPATH%\perl.exe" goto findJava
138
139:noPerl
140    echo.
[6749]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
[6753]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
[6749]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.
[6754]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 ¯®¢â®à­®¢¢¥€šâ¥ íâ®â áªàš¯â.
[5824]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
[6467]169    :: If it is set, use the JAVA_HOME environment variable
170    if not "%JAVA_HOME%" == "" goto javahome
[5824]171
172    :: Check if Java is on the search path
[15354]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
[5824]176    if not "%JAVAPATH%" == "" goto testJava
177
178    :: Still haven't found anything, so try looking in the registry (gulp!)
[15354]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
[5824]187
[15354]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
[5824]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
[6467]201    set JAVAPATH=%JAVA_HOME%\bin
[5824]202
203:testJava
204:: Check that a Java executable has been found
[6749]205if "%GLILANG%" == "en" echo Checking Java: %JAVAPATH%
[6753]206if "%GLILANG%" == "es" echo Revisando Java: %JAVAPATH%
[6749]207if "%GLILANG%" == "fr" echo V‚rification de Java: %JAVAPATH%
[6754]208if "%GLILANG%" == "ru" echo à®¢¥àª  Java: %JAVAPATH%
[5824]209if exist "%JAVAPATH%\java.exe" goto checkGLI
210
211:noJava
212    echo.
[6749]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
[6753]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
[6749]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.
[6754]224
225    if "%GLILANG%" == "ru" echo ¥ 〠«®áì ®¯à¥€¥«šâì ¬¥áâ®­ å®Š€¥­š¥ ᮮ⢥âáâ¢ãî饩 ¢¥àášš Java.
226    if "%GLILANG%" == "ru" echo ‚ë €®«Š­ë ãáâ ­®¢šâì Java Runtime Environment (¢¥àášî 1.4 š«š ¢ëè¥) ¯¥à¥€ ¢¢®€®¬
227    if "%GLILANG%" == "ru" echo ¡š¡«š®â¥ç­®£® š­â¥àä¥©á  Greenstone.
[5824]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.
[6749]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
[6753]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
[10787]242    if "%GLILANG%" == "fr" echo Vous devez compiler le Greenstone Interface (en utilisant makegli.bat)
[6749]243    if "%GLILANG%" == "fr" echo avant d'ex‚cuter ce script.
[6754]244
245    if "%GLILANG%" == "ru" echo ‚ë €®«Š­ë ª®¬¯š«šà®¢ âì ¡š¡«š®â¥ç­ë© š­â¥à䥩á Greenstone (šá¯®«ì§ãï makegli.bat)
246    if "%GLILANG%" == "ru" echo ¯¥à¥€ ¢¢®€®¬ í⮣® áªàš¯â 
[5824]247    goto exit
248
249
250:runGLI
251:: ---- Finally, run the GLI ----
252echo.
[7680]253
[6749]254if "%GLILANG%" == "en" echo Running the Greenstone Librarian Interface...
[6753]255if "%GLILANG%" == "es" echo Ejecutando la Interfaz de la Biblioteca Digital Greenstone...
[6749]256if "%GLILANG%" == "fr" echo Ex‚cution de Greenstone Librarian Interface
[6754]257if "%GLILANG%" == "ru" echo ’¥ªãéš© ¡š¡«š®â¥ç­ë© š­â¥à䥩á Greenstone...
[5824]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
[12695]266if exist "%GSDLHOME%\server.exe" goto localLib
267
[12689]268:webLib
[13027]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
[5824]270
[12689]271    if ERRORLEVEL 2 goto webLib
272
[6749]273    if "%GLILANG%" == "en" echo Done!
[6753]274    if "%GLILANG%" == "es" echo ­Hecho!
[6749]275    if "%GLILANG%" == "fr" echo Termin‚!
[6754]276    if "%GLILANG%" == "ru" echo ‚믮«­¥­®!
[5927]277    goto done
[5824]278
279:localLib
[13027]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
[5824]281
[12689]282    if ERRORLEVEL 2 goto localLib
283
[6749]284    if "%GLILANG%" == "en" echo Done!
[6753]285    if "%GLILANG%" == "es" echo ­Hecho!
[6749]286    if "%GLILANG%" == "fr" echo Termin‚!
[6754]287    if "%GLILANG%" == "ru" echo ‚믮«­¥­®!
[5927]288    goto done
[5824]289
290:exit
291echo.
292pause
293
[5927]294:done
[5824]295:: ---- Clean up ----
296set PERLPATH=
297set JAVAPATH=
Note: See TracBrowser for help on using the browser.