source: gli/trunk/gems.bat@ 16548

Last change on this file since 16548 was 16548, checked in by ak19, 13 years ago

Minor cosmetic change.

  • Property svn:mime-type set to application/octet-stream
File size: 13.0 KB
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 gems.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‚ …
12 partir du r‚pertoire dans lequel il se trouve.
13 if "%GLILANG%" == "ru" echo â®â áªàš¯â €®«Š¥­ ¡ëâì ¢§ïâ š§ €šà¥ªâ®àšš, ¢ ª®â®à®© ®­ à á¯®«®Š¥­
14 goto exit
15
16:start
17if "%OS%" == "Windows_NT" goto progName
18 :: Invoke a new command processor to ensure there's enough environment space
19 if "%1" == "Second" goto progName
20 command /E:2048 /C %0 Second %1 %2 %3 %4 %5 %6 %7 %8 %9
21 goto done
22
23
24:progName
25if "%GLILANG%" == "es" set PROGNAME=Editar conjuntos de metadatos
26if "%GLILANG%" == "fr" set PROGNAME=Editer les jeux de méta-données
27if "%GLILANG%" == "ru" set PROGNAME=Ðåäàêòèðîâàòü íàáîðû ìåòàäàííûõ
28:: if the PROGNAME is still not set, then set the language to English
29if "%PROGNAME%" == "" set PROGNAME=Greenstone Editor for Metadata Sets
30
31if "%PROGABBR%" == "" set PROGABBR=GEMS
32if "%PROGNAME_EN%" == "" set PROGNAME_EN=Greenstone Editor for Metadata Sets
33
34:findGSDL
35echo.
36if "%GLILANG%" == "en" echo %PROGNAME% (%PROGABBR%)
37if "%GLILANG%" == "en" echo Copyright (C) 2006, New Zealand Digital Library Project, University Of Waikato
38if "%GLILANG%" == "en" echo %PROGABBR% comes with ABSOLUTELY NO WARRANTY; for details see LICENSE.txt
39if "%GLILANG%" == "en" echo This is free software, and you are welcome to redistribute it
40
41if "%GLILANG%" == "es" echo %PROGNAME% (%PROGNAME_EN% - %PROGABBR%)
42if "%GLILANG%" == "es" echo Copyright (C) 2006, New Zealand Digital Library Project, University Of Waikato
43if "%GLILANG%" == "es" echo %PROGABBR% NO INCLUYE ABSOLUTAMENTE NINGUNA GARANTÖA.
44if "%GLILANG%" == "es" echo Para mayor informaci¢n vea los t‚rminos de la licencia en LICENSE.txt
45if "%GLILANG%" == "es" echo Este es un software abierto, por lo que lo invitamos a que lo distribuya de forma gratuita
46
47if "%GLILANG%" == "fr" echo %PROGNAME% (%PROGNAME_EN% - %PROGABBR%)
48if "%GLILANG%" == "fr" echo Copyright (C) 2006, New Zealand Digital Library Project, University Of Waikato
49if "%GLILANG%" == "fr" echo %PROGABBR% est fourni sans AUCUNE GARANTIE; pour des d‚tails, voir LICENSE.txt
50if "%GLILANG%" == "fr" echo Ceci est un logiciel libre, et vous ˆtes invit‚ …
51 le redistribuer
52
53if "%GLILANG%" == "ru" echo š¡«š®â¥ç­ë© š­â¥à䥩á %PROGNAME% (%PROGNAME_EN% - %PROGABBR%)
54if "%GLILANG%" == "ru" echo Copyright (C) 2006, New Zealand Digital Library Project, University Of Waikato
55if "%GLILANG%" == "ru" echo ˆƒ ­¥ € ¥â €‘Ž‹ž’Ž ˆŠ€Šˆ• ƒ€€’ˆ‰; €¥â «š á¬. ¢ ⥪á⥠LICENSE.TXT
56if "%GLILANG%" == "ru" echo â® - ᢮¡®€­® à á¯à®áâ࠭塞®¥ ¯à®£à ¬¬­®¥ ®¡¥á¯¥ç¥­š¥ š ‚ë ¬®Š¥â¥ à á¯à®áâà ­ïâì ¥£®
57
58echo.
59:: ---- Determine path to Greenstone home for GS2 and GS3 ----
60set GSDLPATH=
61:: Some users may set the above line manually, or it may be set as an argument
62
63set _VERSION=
64if not "%GSDLPATH%" == "" goto getVer
65 :: Otherwise gsdlpath is not yet set
66 :: Check the env vars first
67 if not "%GSDL3SRCHOME%" == "" goto ver3
68 if not "%GSDLHOME%" == "" goto ver2
69 :: If not set, the default location for the GLI is a subdirectory of Greenstone
70 set GSDLPATH=..
71 goto getVer
72
73:getVer
74call gsdlver.bat %GSDLPATH% %_VERSION% SetEnv > nul
75if "%_VERSION%" == "1" goto exit
76::if we are running GS2, free up any pre-set GS3 environment variables since we won't need them
77if "%_VERSION%" == "2" set GSDL3SRCHOME=
78if "%_VERSION%" == "2" set GSDL3HOME=
79goto testGSDL
80
81
82:ver3
83set _VERSION=3
84set GSDLPATH=%GSDL3SRCHOME%
85:: if GS2 is now also set, then both GS3 and GS2 are set:
86:: warn the user that we have defaulted to GS3
87if not "%GSDLHOME%" == "" echo Both Greenstone 2 and Greenstone 3 environments are set.
88if not "%GSDLHOME%" == "" echo It is assumed you want to run Greenstone 3.
89if not "%GSDLHOME%" == "" echo If you want to run Greenstone 2, please unset the
90if not "%GSDLHOME%" == "" echo environment variable GSDL3SRCHOME before running GLI.
91if not "%GSDLHOME%" == "" echo.
92goto testGSDL
93
94
95:ver2
96set _VERSION=2
97set GSDLPATH=%GSDLHOME%
98::free up the GS3 environment variables since we are running GS2 and don't need them
99set GSDL3SRCHOME=
100set GSDL3HOME=
101goto testGSDL
102
103
104:testGSDL
105set CHECK=1
106call chkinst.bat "%GSDLPATH%" %_VERSION% %GLILANG% %CHECK% SetEnv > nul
107if "%CHECK%" == "1" goto exit
108 :: otherwise installation worked well
109 goto prepGSDL
110
111
112:prepGSDL
113:: Greenstone 3 case
114if "%_VERSION%" == "3" goto prepGS3
115
116if not "%_VERSION%" == "2" echo "Greenstone version unknown"
117if not "%_VERSION%" == "2" goto :exit
118
119:: Otherwise, we are dealing with Greenstone 2
120:: Setup Greenstone 2, unless it has already been done
121if not "%GSDLHOME%" == "" goto doneGSDL
122 call "%GSDLPATH%\setup.bat" SetEnv > nul
123 goto doneGSDL
124
125
126:prepGS3
127set GSDL2PATH=
128: Some users may set the above line manually
129
130if "%GSDL3SRCHOME%" == "" goto setup3
131 if "%GSDL3HOME%" == "" goto setup3
132 ::otherwise
133 goto gs2build
134
135
136:setup3
137:: Setup Greenstone 3, unless it has already been done
138 cd | winutil\setvar.exe GLIDIR > %TMP%\setgli.bat
139 call %TMP%\setgli.bat
140 del %TMP%\setgli.bat
141 cd "%GSDLPATH%"
142 call gs3-setup.bat SetEnv > nul
143 cd %GLIDIR%
144 goto gs2build
145
146
147:gs2build
148 :: If Greenstone version 3 is running, we want to set gsdl2path
149 :: Determine GSDLHOME for GS3
150 if not "%GSDL2PATH%" == "" goto setupGS2
151 :: GSDL2PATH is not yet set.
152 :: And if GSDLHOME is not set either, then assume
153 :: that the gs2build subdir of GS3 exists
154 if "%GSDLHOME%" == "" set GSDL2PATH=%GSDL3SRCHOME%\gs2build
155 if "%GSDLHOME%" == "" goto setupGS2
156 :: Otherwise GSDLHOME is set, so set GSDL2PATH to GSDLHOME
157 echo GSDLHOME environment variable is set to %GSDLHOME%.
158 echo Will use this to find build scripts.
159 set GSDL2PATH=%GSDLHOME%
160
161:setupGS2
162set CHECK=1
163call chkinst.bat "%GSDL2PATH%" 2 %GLILANG% %CHECK% SetEnv > nul
164if "%CHECK%" == "1" goto exit
165 :: otherwise installation worked well
166 :: Setup Greenstone, unless it has already been done
167 if "%GSDLHOME%" == "" call "%GSDL2PATH%\setup.bat" SetEnv > nul
168 :: Either way, we can now dispose of GSDL2PATH
169 set GSDL2PATH=
170 goto doneGSDL
171
172
173:doneGSDL
174:: GSDLPATH is no longer needed, since GSDLHOME should now be set
175set GSDLPATH=
176
177
178:findJava
179:: ---- Check Java exists ----
180set JAVAPATH=
181
182:: Some users may set the above line manually
183if not "%JAVAPATH%" == "" goto testJava
184
185 :: If it is set, use the JAVA_HOME environment variable
186 if not "%JAVA_HOME%" == "" goto javahome
187
188 :: Check if Java is on the search path
189 echo %PATH%| winutil\which.exe java.exe | winutil\setvar.exe JAVAPATH > %TMP%\setjava.bat
190 call %TMP%\setjava.bat
191 del %TMP%\setjava.bat
192 if not "%JAVAPATH%" == "" goto testJava
193
194 :: Still haven't found anything, so try looking in the registry (gulp!)
195 type nul > %TMP%\jdk.reg
196 regedit /E %TMP%\jdk.reg "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit"
197 type %TMP%\jdk.reg > %TMP%\jdk.txt
198 del %TMP%\jdk.reg
199 type nul > %TMP%\jre.reg
200 regedit /E %TMP%\jre.reg "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment"
201 type %TMP%\jre.reg > %TMP%\jre.txt
202 del %TMP%\jre.reg
203
204 winutil\findjava.exe %TMP%\jdk.txt %TMP%\jre.txt | winutil\setvar.exe JAVAPATH > %TMP%\setjava.bat
205 del %TMP%\jdk.txt
206 del %TMP%\jre.txt
207 call %TMP%\setjava.bat
208 del %TMP%\setjava.bat
209
210 :: If nothing was found in the registry, we're stuck
211 if "%JAVAPATH%" == "" goto noJava
212
213 set JAVAPATH=%JAVAPATH%\bin
214 goto testJava
215
216:javahome
217 set JAVAPATH=%JAVA_HOME%\bin
218
219:testJava
220:: Check that a Java executable has been found
221if "%GLILANG%" == "en" echo Checking Java: %JAVAPATH%
222if "%GLILANG%" == "es" echo Revisando Java: %JAVAPATH%
223if "%GLILANG%" == "fr" echo V‚rification de Java: %JAVAPATH%
224if "%GLILANG%" == "ru" echo à®¢¥àª  Java: %JAVAPATH%
225if exist "%JAVAPATH%\java.exe" goto checkJV
226
227:noJava
228 echo.
229 if "%GLILANG%" == "en" echo Failed to locate an appropriate version of Java. You must install a
230 if "%GLILANG%" == "en" echo Java Runtime Environment (version 1.4 or greater) before running the
231 if "%GLILANG%" == "en" echo %PROGNAME%.
232
233 if "%GLILANG%" == "es" echo No se pudo localizar una versi¢n apropiada de Java. Usted deber 
234 if "%GLILANG%" == "es" echo instalar un Ambiente de Ejecuci¢n Java (versi¢n 1.4 o superior)
235 if "%GLILANG%" == "es" echo antes de correr la %PROGNAME%.
236
237 if "%GLILANG%" == "fr" echo Une version ad‚quate de Java n'a pas pu ˆtre localis‚e. Vous devez
238 if "%GLILANG%" == "fr" echo installer un Java Runtime Environment (version 1.4 ou sup‚rieur)
239 if "%GLILANG%" == "fr" echo avant de d‚marrer %PROGNAME%.
240
241 if "%GLILANG%" == "ru" echo ¥ 〠«®áì ®¯à¥€¥«šâì ¬¥áâ®­ å®Š€¥­š¥ ᮮ⢥âáâ¢ãî饩 ¢¥àášš Java.
242 if "%GLILANG%" == "ru" echo ‚ë €®«Š­ë ãáâ ­®¢šâì Java Runtime Environment (¢¥àášî 1.4 š«š ¢ëè¥) ¯¥à¥€ ¢¢®€®¬
243 if "%GLILANG%" == "ru" echo %PROGNAME%.
244 goto exit
245
246
247:: Check the version of Java is new enough (1.4.0 or higher) to run the GLI
248:checkJV
249"%JAVAPATH%\java" -classpath . CheckJavaVersion
250 if ERRORLEVEL 2 goto checkGEMS
251 :: Otherwise, errorlevel was an error value
252 if "%GLILANG%" == "es" La versión del Ambiente de Ejecución Java (JRE por sus siglas en
253 if "%GLILANG%" == "es" inglés) que usted tiene instalada es demasiado vieja para ejecutar
254 if "%GLILANG%" == "es" la Interfaz de la %PROGNAME%. Por favor instale
255 if "%GLILANG%" == "es" una nueva versión del Ambiente de Ejecución Java (versión 1.4 o
256 if "%GLILANG%" == "es" posterior) y ejecute nuevamente este guión.
257
258 if "%GLILANG%" == "fr" La version de Java Runtime Environment que vous avez installée est
259 if "%GLILANG%" == "fr" trop vielle pour faire fonctionner %PROGNAME%.
260 if "%GLILANG%" == "fr" Veuillez installer une nouvelle version du JRE (version 1.4 ou plus
261 if "%GLILANG%" == "fr" récente) et redémarrez le script.
262
263 if "%GLILANG%" == "ru" ÷ÅÒÓÉÑ Java Runtime Environment, ËÏÔÏÒÕÀ ÷Ù ÕÓÔÁÎÏ×ÉÌÉ, ÏÞÅÎØ ÓÔÁÒÁ,
264 if "%GLILANG%" == "ru" ÞÔÏÂÙ ÕÐÒÁ×ÌÑÔØ ÂÉÂÌÉÏÔÅÞÎÙÍ %PROGNAME%. ðÏÖÁÌÕÊÓÔÁ,
265 if "%GLILANG%" == "ru" ÕÓÔÁÎÏ×ÉÔÅ ÎÏ×ÕÀ ×ÅÒÓÉÀ JRE (×ÅÒÓÉÀ 1.4 ÉÌÉ ÂÏÌÅÅ ÎÏ×ÕÀ) É
266 if "%GLILANG%" == "ru" ÐÅÒÅÕÓÔÁÎÏ×ÉÔÅ ÜÔÏÔ ÓËÒÉÐÔ
267
268 if "%GLILANG%" == "en" The version of the Java Runtime Environment you have installed is too
269 if "%GLILANG%" == "en" old to run the %PROGNAME%. Please install a new
270 if "%GLILANG%" == "en" version of the JRE (version 1.4 or newer) and rerun this script.
271 goto exit
272
273
274:checkGEMS
275:: ---- Check that the GEMS has been compiled ----
276if exist "classes/org/greenstone/gatherer/Gatherer.class" goto runGEMS
277if exist "GLI.jar" goto runGEMS
278 echo.
279 if "%GLILANG%" == "en" echo You need to compile the %PROGNAME% (using makegli.bat)
280 if "%GLILANG%" == "en" echo before running this script.
281
282 if "%GLILANG%" == "es" echo Usted necesita compilar la %PROGNAME%
283 if "%GLILANG%" == "es" echo (por medio de makegli.bat) antes de ejecutar este gui¢n.
284
285 if "%GLILANG%" == "fr" echo Vous devez compiler le %PROGNAME% (en utilisant makegli.bat)
286 if "%GLILANG%" == "fr" echo avant d'ex‚cuter ce script.
287
288 if "%GLILANG%" == "ru" echo ‚ë €®«Š­ë ª®¬¯š«šà®¢ âì %PROGNAME% (šá¯®«ì§ãï makegli.bat)
289 if "%GLILANG%" == "ru" echo ¯¥à¥€ ¢¢®€®¬ í⮣® áªàš¯â 
290 goto exit
291
292
293:runGEMS
294:: ---- Finally, run the GEMS ----
295echo.
296if "%GLILANG%" == "en" echo Running the %PROGNAME%...
297if "%GLILANG%" == "es" echo Ejecutando la %PROGNAME%...
298if "%GLILANG%" == "fr" echo Ex‚cution de %PROGNAME%
299if "%GLILANG%" == "ru" echo ’¥ªãéš© Ðåäàêòèðîâàòü íàáîðû ìåòàäàííûõ...
300
301if "%GLILANG%" == "en" echo Running the %PROGNAME%...
302if "%GLILANG%" == "es" echo Ejecutando la %PROGNAME%...
303if "%GLILANG%" == "fr" echo Ex‚cution de %PROGNAME%
304if "%GLILANG%" == "ru" echo ’¥ªãéš© %PROGNAME%...
305
306:: -Xms32M To set minimum memory
307:: -Xmx32M To set maximum memory
308:: -verbose:gc To set garbage collection messages
309:: -Xincgc For incremental garbage collection
310:: -Xprof Function call profiling
311:: -Xloggc:<file> Write garbage collection log
312
313
314:: Run GS3 if version = 3
315if "%_VERSION%" == "3" "%JAVAPATH%\java" -cp classes/;GLI.jar;lib/apache.jar org.greenstone.gatherer.gems.GEMS -gsdl3 %GSDL3HOME% %1 %2 %3 %4 %5 %6 %7 %8 %9
316if "%_VERSION%" == "3" goto finRun
317
318 :: Else run GS2 since version is 2:
319 "%JAVAPATH%\java" -cp classes/;GLI.jar;lib/apache.jar org.greenstone.gatherer.gems.GEMS -gsdl %GSDLHOME% %1 %2 %3 %4 %5 %6 %7 %8 %9
320
321:finRun
322 if "%GLILANG%" == "en" echo Done!
323 if "%GLILANG%" == "es" echo ­Hecho!
324 if "%GLILANG%" == "fr" echo Termin‚!
325 if "%GLILANG%" == "ru" echo ‚믮«­¥­®!
326 goto done
327
328
329:exit
330echo.
331pause
332
333:done
334:: ---- Clean up ----
335set JAVAPATH=
Note: See TracBrowser for help on using the repository browser.