root/gli/branches/2.75/gli.bat @ 14793

Revision 14793, 13.0 KB (checked in by oranfry, 12 years ago)

always check writability of GSDLHOME before commiting

  • 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:: test writability of GSDLHOME
89@call %GSDLHOME%\gli\checkwritability.bat
90
91
92:findPerl
93::  ---- Check Perl exists ----
94set PERLPATH=
95
96:: Some users may set the above line manually
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 > %SystemRoot%\Temp\setperl.bat
101    call %SystemRoot%\Temp\setperl.bat
102    del %SystemRoot%\Temp\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 > %SystemRoot%\Temp\perl.reg
110    regedit /E %SystemRoot%\Temp\perl.reg "HKEY_LOCAL_MACHINE\SOFTWARE\Perl"
111    type %SystemRoot%\Temp\perl.reg > %SystemRoot%\Temp\perl.txt
112    del %SystemRoot%\Temp\perl.reg
113
114    winutil\findperl.exe %SystemRoot%\Temp\perl.txt | winutil\setvar.exe PERLPATH > %SystemRoot%\Temp\setperl.bat
115    del %SystemRoot%\Temp\perl.txt
116    call %SystemRoot%\Temp\setperl.bat
117    del %SystemRoot%\Temp\setperl.bat
118
119    :: If nothing was found in the registry, we're stuck
120    if "%PERLPATH%" == "" goto noPerl
121
122    goto testPerl
123
124:gsdlPerl
125    set PERLPATH=%GSDLHOME%\bin\windows\perl\bin
126
127:testPerl
128:: Check that a Perl executable has been found
129if "%GLILANG%" == "en" echo Checking Perl: %PERLPATH%
130if "%GLILANG%" == "es" echo Revisando Perl: %PERLPATH%
131if "%GLILANG%" == "fr" echo V‚rification de Perl: %PERLPATH%
132if "%GLILANG%" == "ru" echo à®¢¥àª  Perl: %PERLPATH%
133if exist "%PERLPATH%\perl.exe" goto findJava
134
135:noPerl
136    echo.
137    if "%GLILANG%" == "en" echo The Greenstone Librarian Interface requires perl in order to operate,
138    if "%GLILANG%" == "en" echo but perl could not be detected on your system. Please ensure that perl
139    if "%GLILANG%" == "en" echo is installed and is on your search path, then rerun this script.
140
141    if "%GLILANG%" == "es" echo La Interfaz de la Biblioteca Digital Greenstone requiere Perl para poder
142    if "%GLILANG%" == "es" echo operar, pero ‚ste no aparece en su sistema. Por favor aseg£rese de
143    if "%GLILANG%" == "es" echo que Perl est  instalado y se encuentra en su ruta de b£squeda.
144    if "%GLILANG%" == "es" echo A continuaci¢n ejecute nuevamente este gui¢n.
145
146    if "%GLILANG%" == "fr" echo Greenstone Librarian Interface n‚cessite perl pour son fonctionnement,
147    if "%GLILANG%" == "fr" echo mais perl n'a pas pu ˆtre d‚tect‚ dans votre systŠme. Veuillez vous
148    if "%GLILANG%" == "fr" echo assurer que perl est install‚ et est sp‚cifi‚ dans votre chemin de
149    if "%GLILANG%" == "fr" echo recherche, puis red‚marrez ce script.
150
151    if "%GLILANG%" == "ru" echo š¡«š®â¥ç­ë© š­â¥à䥩á Greenstone âॡã¥â Perl, çâ®¡ë š¬¥âì ¢®§¬®Š­®áâì
152    if "%GLILANG%" == "ru" echo à ¡®â âì, ­® Perl ­¥ ¡ë« ¢ ¢ è¥© ášá⥬¥. ®Š «ã©áâ , ¯®€â¢¥à€šâ¥,
153    if "%GLILANG%" == "ru" echo çâ® Perl ãáâ ­®¢«¥­ š ­ å®€šâáï ­  ¢ è¥¬ ¯ãâš ¯®šáª , § â¥¬
154    if "%GLILANG%" == "ru" echo ¯®¢â®à­®¢¢¥€šâ¥ íâ®â áªàš¯â.
155    goto exit
156
157
158:findJava
159:: ---- Check Java exists ----
160set JAVAPATH=
161
162:: Some users may set the above line manually
163if not "%JAVAPATH%" == "" goto testJava
164
165    :: If it is set, use the JAVA_HOME environment variable
166    if not "%JAVA_HOME%" == "" goto javahome
167
168    :: Check if Java is on the search path
169    echo %PATH%| winutil\which.exe java.exe | winutil\setvar.exe JAVAPATH > %SystemRoot%\Temp\setjava.bat
170    call %SystemRoot%\Temp\setjava.bat
171    del %SystemRoot%\Temp\setjava.bat
172    if not "%JAVAPATH%" == "" goto testJava
173
174    :: Still haven't found anything, so try looking in the registry (gulp!)
175    type nul > %SystemRoot%\Temp\jdk.reg
176    regedit /E %SystemRoot%\Temp\jdk.reg "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit"
177    type %SystemRoot%\Temp\jdk.reg > %SystemRoot%\Temp\jdk.txt
178    del %SystemRoot%\Temp\jdk.reg
179    type nul > %SystemRoot%\Temp\jre.reg
180    regedit /E %SystemRoot%\Temp\jre.reg "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment"
181    type %SystemRoot%\Temp\jre.reg > %SystemRoot%\Temp\jre.txt
182    del %SystemRoot%\Temp\jre.reg
183
184    winutil\findjava.exe %SystemRoot%\Temp\jdk.txt %SystemRoot%\Temp\jre.txt | winutil\setvar.exe JAVAPATH > %SystemRoot%\Temp\setjava.bat
185    del %SystemRoot%\Temp\jdk.txt
186    del %SystemRoot%\Temp\jre.txt
187    call %SystemRoot%\Temp\setjava.bat
188    del %SystemRoot%\Temp\setjava.bat
189
190    :: If nothing was found in the registry, we're stuck
191    if "%JAVAPATH%" == "" goto noJava
192
193    set JAVAPATH=%JAVAPATH%\bin
194    goto testJava
195
196:javahome
197    set JAVAPATH=%JAVA_HOME%\bin
198
199:testJava
200:: Check that a Java executable has been found
201if "%GLILANG%" == "en" echo Checking Java: %JAVAPATH%
202if "%GLILANG%" == "es" echo Revisando Java: %JAVAPATH%
203if "%GLILANG%" == "fr" echo V‚rification de Java: %JAVAPATH%
204if "%GLILANG%" == "ru" echo à®¢¥àª  Java: %JAVAPATH%
205if exist "%JAVAPATH%\java.exe" goto checkGLI
206
207:noJava
208    echo.
209    if "%GLILANG%" == "en" echo Failed to locate an appropriate version of Java. You must install a
210    if "%GLILANG%" == "en" echo Java Runtime Environment (version 1.4 or greater) before running the
211    if "%GLILANG%" == "en" echo Greenstone Librarian Interface.
212
213    if "%GLILANG%" == "es" echo No se pudo localizar una versi¢n apropiada de Java. Usted deber 
214    if "%GLILANG%" == "es" echo instalar un Ambiente de Ejecuci¢n Java (versi¢n 1.4 o superior)
215    if "%GLILANG%" == "es" echo antes de correr la Interfaz de la Biblioteca Digital Greenstone.
216
217    if "%GLILANG%" == "fr" echo Une version ad‚quate de Java n'a pas pu ˆtre localis‚e. Vous devez
218    if "%GLILANG%" == "fr" echo installer un Java Runtime Environment (version 1.4 ou sup‚rieur)
219    if "%GLILANG%" == "fr" echo avant de d‚marrer Greenstone Librarian Interface.
220
221    if "%GLILANG%" == "ru" echo ¥ 〠«®áì ®¯à¥€¥«šâì ¬¥áâ®­ å®Š€¥­š¥ ᮮ⢥âáâ¢ãî饩 ¢¥àášš Java.
222    if "%GLILANG%" == "ru" echo ‚ë €®«Š­ë ãáâ ­®¢šâì Java Runtime Environment (¢¥àášî 1.4 š«š ¢ëè¥) ¯¥à¥€ ¢¢®€®¬
223    if "%GLILANG%" == "ru" echo ¡š¡«š®â¥ç­®£® š­â¥àä¥©á  Greenstone.
224    goto exit
225
226
227:checkGLI
228:: ---- Check that the GLI has been compiled ----
229if exist "classes/org/greenstone/gatherer/Gatherer.class" goto runGLI
230if exist "GLI.jar" goto runGLI
231    echo.
232    if "%GLILANG%" == "en" echo You need to compile the Greenstone Librarian Interface (using makegli.bat)
233    if "%GLILANG%" == "en" echo before running this script.
234
235    if "%GLILANG%" == "es" echo Usted necesita compilar la Interfaz de la Biblioteca Digital Greenstone
236    if "%GLILANG%" == "es" echo (por medio de makegli.bat) antes de ejecutar este gui¢n.
237
238    if "%GLILANG%" == "fr" echo Vous devez compiler le Greenstone Interface (en utilisant makegli.bat)
239    if "%GLILANG%" == "fr" echo avant d'ex‚cuter ce script.
240
241    if "%GLILANG%" == "ru" echo ‚ë €®«Š­ë ª®¬¯š«šà®¢ âì ¡š¡«š®â¥ç­ë© š­â¥à䥩á Greenstone (šá¯®«ì§ãï makegli.bat)
242    if "%GLILANG%" == "ru" echo ¯¥à¥€ ¢¢®€®¬ í⮣® áªàš¯â 
243    goto exit
244
245
246:runGLI
247:: ---- Finally, run the GLI ----
248echo.
249
250if "%GLILANG%" == "en" echo Running the Greenstone Librarian Interface...
251if "%GLILANG%" == "es" echo Ejecutando la Interfaz de la Biblioteca Digital Greenstone...
252if "%GLILANG%" == "fr" echo Ex‚cution de Greenstone Librarian Interface
253if "%GLILANG%" == "ru" echo ’¥ªãéš© ¡š¡«š®â¥ç­ë© š­â¥à䥩á Greenstone...
254
255:: -Xms32M          To set minimum memory
256:: -Xmx32M          To set maximum memory
257:: -verbose:gc      To set garbage collection messages
258:: -Xincgc          For incremental garbage collection
259:: -Xprof           Function call profiling
260:: -Xloggc:<file>   Write garbage collection log
261
262if exist "%GSDLHOME%\server.exe" goto localLib
263
264:webLib
265    "%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
266
267    if ERRORLEVEL 2 goto webLib
268
269    if "%GLILANG%" == "en" echo Done!
270    if "%GLILANG%" == "es" echo ­Hecho!
271    if "%GLILANG%" == "fr" echo Termin‚!
272    if "%GLILANG%" == "ru" echo ‚믮«­¥­®!
273    goto done
274
275:localLib
276    "%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
277
278    if ERRORLEVEL 2 goto localLib
279
280    if "%GLILANG%" == "en" echo Done!
281    if "%GLILANG%" == "es" echo ­Hecho!
282    if "%GLILANG%" == "fr" echo Termin‚!
283    if "%GLILANG%" == "ru" echo ‚믮«­¥­®!
284    goto done
285
286:exit
287echo.
288pause
289
290:done
291:: ---- Clean up ----
292set PERLPATH=
293set JAVAPATH=
Note: See TracBrowser for help on using the browser.