source: gli/trunk/gli.bat@ 19338

Last change on this file since 19338 was 19336, checked in by ak19, 15 years ago

client-gli.bat and gli.bat both go through the findjava part of the script, so moved this into a separate scriptfile that can be called by both.

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 10.6 KB
Line 
1@echo off
2color 0A
3pushd "%CD%"
4CD /D "%~dp0"
5set GLILANG=en
6
7
8:: -------- Run the Greenstone Librarian Interface --------
9
10:: This script must be run from within the directory in which it lives
11if exist gli.bat goto start
12 if "%GLILANG%" == "en" echo This script must be run from the directory in which it resides.
13 if "%GLILANG%" == "es" echo Este gui¢n deber  ejecutarse desde el directorio en el que reside.
14 if "%GLILANG%" == "fr" echo Ce script doit ˆtre ex‚cut‚ …
15 partir du r‚pertoire dans lequel il se trouve.
16 if "%GLILANG%" == "ru" echo â®â áªàš¯â €®«Š¥­ ¡ëâì ¢§ïâ š§ €šà¥ªâ®àšš, ¢ ª®â®à®© ®­ à á¯®«®Š¥­
17 goto exit
18
19:start
20if "%OS%" == "Windows_NT" goto progName
21 :: Invoke a new command processor to ensure there's enough environment space
22 if "%1" == "Second" goto progName
23 command /E:2048 /C %0 Second %1 %2 %3 %4 %5 %6 %7 %8 %9
24 goto done
25
26
27:progName
28if not "%PROGNAME%" == "" goto findGSDL
29 :: otherwise PROGNAME was not set, so default to the Greenstone Librarian Interface (GLI) program
30 if "%GLILANG%" == "es" set PROGNAME=Biblioteca Digital Greenstone
31 if "%GLILANG%" == "fr" set PROGNAME=Bibliothécaire Greenstone
32 if "%GLILANG%" == "ru" set PROGNAME=ÉÎÔÅÒÆÅÊÓ Greenstone
33 :: if the PROGNAME is still not set, then set the language to English
34 if "%PROGNAME%" == "" set PROGNAME=Greenstone Librarian Interface
35
36
37if "%PROGABBR%" == "" set PROGABBR=GLI
38if "%PROGNAME_EN%" == "" set PROGNAME_EN=Greenstone Librarian Interface
39
40:findGSDL
41echo.
42if "%GLILANG%" == "en" (
43 echo %PROGNAME% ^(%PROGABBR%^)
44 echo Copyright ^(C^) 2008, New Zealand Digital Library Project, University Of Waikato
45 echo %PROGABBR% comes with ABSOLUTELY NO WARRANTY; for details see LICENSE.txt
46 echo This is free software, and you are welcome to redistribute it
47 )
48
49if "%GLILANG%" == "es" (
50 echo Interfaz de la %PROGNAME% ^(%PROGNAME_EN% - %PROGABBR%^)
51 echo Copyright ^(C^) 2008, New Zealand Digital Library Project, University Of Waikato
52 echo La Interfaz de la %PROGNAME% NO INCLUYE ABSOLUTAMENTE NINGUNA GARANTÖA.
53 echo Para mayor informaci¢n vea los t‚rminos de la licencia en LICENSE.txt
54 echo Este es un software abierto, por lo que lo invitamos a que lo distribuya de forma gratuita
55 )
56
57if "%GLILANG%" == "fr" (
58 echo Interface du %PROGNAME% ^(%PROGNAME_EN% - %PROGABBR%^)
59 echo Copyright ^(C^) 2008, New Zealand Digital Library Project, University Of Waikato
60 echo %PROGABBR% est fourni sans AUCUNE GARANTIE; pour des d‚tails, voir LICENSE.txt
61 echo Ceci est un logiciel libre, et vous ˆtes invit‚ …
62 le redistribuer
63 )
64
65if "%GLILANG%" == "ru" (
66 echo š¡«š®â¥ç­ë© š­â¥à䥩á %PROGNAME% ^(%PROGNAME_EN% - %PROGABBR%^)
67 echo Copyright ^(C^) 2008, New Zealand Digital Library Project, University Of Waikato
68 echo ˆƒ ­¥ € ¥â €‘Ž‹ž’Ž ˆŠ€Šˆ• ƒ€€’ˆ‰; €¥â «š á¬. ¢ ⥪á⥠LICENSE.TXT
69 echo â® - ᢮¡®€­® à á¯à®áâ࠭塞®¥ ¯à®£à ¬¬­®¥ ®¡¥á¯¥ç¥­š¥ š ‚ë ¬®Š¥â¥ à á¯à®áâà ­ïâì ¥£®
70 )
71
72echo.
73:: ---- Determine path to Greenstone home for GS2 and GS3 ----
74set GSDLPATH=
75:: Some users may set the above line manually, or it may be set as an argument
76
77set _VERSION=
78if not "%GSDLPATH%" == "" goto getVer
79 :: Otherwise gsdlpath is not yet set
80 :: Check the env vars first
81 if not "%GSDL3SRCHOME%" == "" goto ver3
82 if not "%GSDLHOME%" == "" goto ver2
83 :: If not set, the default location for the GLI is a subdirectory of Greenstone
84 set GSDLPATH=..
85 goto getVer
86
87:getVer
88call gsdlver.bat %GSDLPATH% %_VERSION% > nul
89if "%_VERSION%" == "1" goto exit
90::if we are running GS2, free up any pre-set GS3 environment variables since we won't need them
91if "%_VERSION%" == "2" set GSDL3SRCHOME=
92if "%_VERSION%" == "2" set GSDL3HOME=
93goto testGSDL
94
95
96:ver3
97set _VERSION=3
98set GSDLPATH=%GSDL3SRCHOME%
99:: if GS2 is now also set, then both GS3 and GS2 are set:
100:: warn the user that we have defaulted to GS3
101if not "%GSDLHOME%" == "" echo Both Greenstone 2 and Greenstone 3 environments are set.
102if not "%GSDLHOME%" == "" echo It is assumed you want to run Greenstone 3.
103if not "%GSDLHOME%" == "" echo If you want to run Greenstone 2, please unset the
104if not "%GSDLHOME%" == "" echo environment variable GSDL3SRCHOME before running GLI.
105if not "%GSDLHOME%" == "" echo.
106goto testGSDL
107
108
109:ver2
110set _VERSION=2
111set GSDLPATH=%GSDLHOME%
112::free up the GS3 environment variables since we are running GS2 and don't need them
113set GSDL3SRCHOME=
114set GSDL3HOME=
115goto testGSDL
116
117
118:testGSDL
119set CHECK=1
120call chkinst.bat "%GSDLPATH%" %_VERSION% %GLILANG% %CHECK% > nul
121if "%CHECK%" == "1" goto exit
122 :: otherwise installation worked well
123 goto prepGSDL
124
125
126:prepGSDL
127:: Greenstone 3 case
128if "%_VERSION%" == "3" goto prepGS3
129
130if not "%_VERSION%" == "2" echo "Greenstone version unknown"
131if not "%_VERSION%" == "2" goto exit
132
133:: Otherwise, we are dealing with Greenstone 2
134:: Setup Greenstone 2, unless it has already been done
135if not "%GSDLHOME%" == "" goto doneGSDL
136 call "%GSDLPATH%\setup.bat" SetEnv
137 goto doneGSDL
138
139
140:prepGS3
141set GSDL2PATH=
142:: Some users may set the above line manually
143
144if "%GSDL3SRCHOME%" == "" goto setup3
145 if "%GSDL3HOME%" == "" goto setup3
146 ::otherwise
147 goto gs2build
148
149
150:setup3
151:: Setup Greenstone 3, unless it has already been done
152 cd | winutil\setvar.exe GLIDIR > %TMP%\setgli.bat
153 call %TMP%\setgli.bat
154 del %TMP%\setgli.bat
155 cd "%GSDLPATH%"
156 call gs3-setup.bat SetEnv
157 cd %GLIDIR%
158 goto gs2build
159
160
161:gs2build
162 :: If Greenstone version 3 is running, we want to set gsdl2path
163 :: Determine GSDLHOME for GS3
164 if not "%GSDL2PATH%" == "" goto setupGS2
165 :: GSDL2PATH is not yet set.
166 :: And if GSDLHOME is not set either, then assume
167 :: that the gs2build subdir of GS3 exists
168 if "%GSDLHOME%" == "" set GSDL2PATH=%GSDL3SRCHOME%\gs2build
169 if "%GSDLHOME%" == "" goto setupGS2
170 :: Otherwise GSDLHOME is set, so set GSDL2PATH to GSDLHOME
171 echo GSDLHOME environment variable is set to %GSDLHOME%.
172 echo Will use this to find build scripts.
173 set GSDL2PATH=%GSDLHOME%
174
175:setupGS2
176set CHECK=1
177call chkinst.bat "%GSDL2PATH%" 2 %GLILANG% %CHECK% > nul
178if "%CHECK%" == "1" goto exit
179 :: otherwise installation worked well
180 :: Setup Greenstone, unless it has already been done
181 if "%GSDLHOME%" == "" call "%GSDL2PATH%\setup.bat" SetEnv
182 :: Either way, we can now dispose of GSDL2PATH
183 set GSDL2PATH=
184 goto doneGSDL
185
186
187:doneGSDL
188:: GSDLPATH is no longer needed, since GSDLHOME should now be set
189set GSDLPATH=
190
191
192:: Now need to find Perl. If found, PERLPATH will be set
193call findperl.bat
194if "%PERLPATH%" == "" goto exit
195
196:: Need to find Java. If found, JAVA_EXECUTABLE will be set
197call findjava.bat
198if "%JAVA_EXECUTABLE%" == "" goto exit
199
200
201:checkGLI
202:: ---- Check that the GLI has been compiled ----
203if exist "classes/org/greenstone/gatherer/Gatherer.class" goto runGLI
204if exist "GLI.jar" goto runGLI
205 echo.
206 if "%GLILANG%" == "en" echo You need to compile the Greenstone Librarian Interface (using makegli.bat)
207 if "%GLILANG%" == "en" echo before running this script.
208
209 if "%GLILANG%" == "es" echo Usted necesita compilar la Interfaz de la Biblioteca Digital Greenstone
210 if "%GLILANG%" == "es" echo (por medio de makegli.bat) antes de ejecutar este gui¢n.
211
212 if "%GLILANG%" == "fr" echo Vous devez compiler le Greenstone Interface (en utilisant makegli.bat)
213 if "%GLILANG%" == "fr" echo avant d'ex‚cuter ce script.
214
215 if "%GLILANG%" == "ru" echo ‚ë €®«Š­ë ª®¬¯š«šà®¢ âì ¡š¡«š®â¥ç­ë© š­â¥à䥩á Greenstone (šá¯®«ì§ãï makegli.bat)
216 if "%GLILANG%" == "ru" echo ¯¥à¥€ ¢¢®€®¬ í⮣® áªàš¯â 
217 goto exit
218
219
220:runGLI
221
222if not "%_VERSION%" == "" (
223 echo Greenstone Major Version:
224 echo %_VERSION%
225 echo.
226)
227
228if not "%GSDL3SRCHOME%" == "" (
229 echo GSDL3SRCHOME:
230 echo %GSDL3SRCHOME%
231 echo.
232)
233
234if not "%GSDL3HOME%" == "" (
235 echo GSDL3HOME:
236 echo %GSDL3HOME%
237 echo.
238)
239
240if not "%GSDLHOME%" == "" (
241 echo GSDLHOME:
242 echo %GSDLHOME%
243 echo.
244)
245
246:: ---- Explain how to bypass Imagemagick and Ghostscript bundled with Greenstone if needed ----
247echo.
248if exist "%GSDLHOME%\bin\windows\ghostscript\bin\*.*" echo GhostScript bundled with Greenstone will be used, if you wish to use the version installed on your system (if any) please go to %GSDLHOME%\bin\windows and rename the folder called ghostscript to something else.
249echo.
250echo.
251if exist "%GSDLHOME%\bin\windows\imagemagick\*.*" echo ImageMagick bundled with Greenstone will be used, if you wish to use the version installed on your system (if any) please go to %GSDLHOME%\bin\windows and rename the folder called imagemagick to something else.
252echo.
253echo.
254
255
256:: ---- Finally, run the GLI ----
257if "%GLILANG%" == "en" echo Running the %PROGNAME%...
258if "%GLILANG%" == "es" echo Ejecutando la %PROGNAME%...
259if "%GLILANG%" == "fr" echo Ex‚cution de %PROGNAME%
260if "%GLILANG%" == "ru" echo ’¥ªãéš© ¡š¡«š %PROGNAME%...
261
262:: -Xms32M To set minimum memory
263:: -Xmx32M To set maximum memory
264:: -verbose:gc To set garbage collection messages
265:: -Xincgc For incremental garbage collection
266:: -Xprof Function call profiling
267:: -Xloggc:<file> Write garbage collection log
268
269
270:: Run GS3 if version = 3
271if "%_VERSION%" == "3" "%JAVA_EXECUTABLE%" -cp classes/;GLI.jar;lib/apache.jar;lib/qfslib.jar org.greenstone.gatherer.GathererProg -gsdl %GSDLHOME% -gsdlos %GSDLOS% -gsdl3 %GSDL3HOME% -gsdl3src %GSDL3SRCHOME% -perl %PERLPATH% %1 %2 %3 %4 %5 %6 %7 %8 %9
272if "%_VERSION%" == "3" goto finRun
273
274:: Run GS2 since version is 2:
275:: if FLI is running, we don't want the local Greenstone library server running
276if "%PROGABBR%" == "FLI" goto webLib
277 :: Else we're running GLI, so we want the local Greenstone library server (if server.exe exists, otherwise it will be webLib)
278 if exist "%GSDLHOME%\server.exe" goto localLib
279
280:webLib
281 "%JAVA_EXECUTABLE%" -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
282 if ERRORLEVEL 2 (
283 goto webLib
284 )
285 goto finRun
286
287:localLib
288 "%JAVA_EXECUTABLE%" -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
289 if ERRORLEVEL 2 (
290 goto localLib
291 )
292 goto finRun
293
294
295:finRun
296 if "%GLILANG%" == "en" echo Done!
297 if "%GLILANG%" == "es" echo ­Hecho!
298 if "%GLILANG%" == "fr" echo Termin‚!
299 if "%GLILANG%" == "ru" echo ‚믮«­¥­®!
300 goto done
301
302
303:exit
304echo.
305pause
306color 07
307popd
308
309:done
310:: ---- Clean up ----
311set PERLPATH=
312set JAVA_EXECUTABLE=
313color 07
314popd
Note: See TracBrowser for help on using the repository browser.