source: gli/branches/2.75/gli.bat@ 14793

Last change on this file since 14793 was 14793, checked in by oranfry, 16 years ago

always check writability of GSDLHOME before commiting

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