source: gli/trunk/gli.bat@ 19336

Last change on this file since 19336 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
RevLine 
[5824]1@echo off
[17942]2color 0A
3pushd "%CD%"
4CD /D "%~dp0"
[6749]5set GLILANG=en
[5824]6
[6749]7
[5824]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
[6749]12 if "%GLILANG%" == "en" echo This script must be run from the directory in which it resides.
[6753]13 if "%GLILANG%" == "es" echo Este gui¢n deber  ejecutarse desde el directorio en el que reside.
[6749]14 if "%GLILANG%" == "fr" echo Ce script doit ˆtre ex‚cut‚ …
[6754]15 partir du r‚pertoire dans lequel il se trouve.
[5824]16 if "%GLILANG%" == "ru" echo â®â áªàš¯â €®«Š¥­ ¡ëâì ¢§ïâ š§ €šà¥ªâ®àšš, ¢ ª®â®à®© ®­ à á¯®«®Š¥­
17 goto exit
18
[15608]19:start
[5824]20if "%OS%" == "Windows_NT" goto progName
[15608]21 :: Invoke a new command processor to ensure there's enough environment space
[5824]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
[15608]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
[6669]39
[6667]40:findGSDL
[19336]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
[6749]47 )
[19336]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
[6753]55 )
[19336]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‚ …
[6754]62 le redistribuer
[19336]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
[7041]69 echo â® - ᢮¡®€­® à á¯à®áâ࠭塞®¥ ¯à®£à ¬¬­®¥ ®¡¥á¯¥ç¥­š¥ š ‚ë ¬®Š¥â¥ à á¯à®áâà ­ïâì ¥£®
[6667]70 )
[15608]71
[5824]72echo.
[15608]73:: ---- Determine path to Greenstone home for GS2 and GS3 ----
[5824]74set GSDLPATH=
[15608]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
[5824]84 set GSDLPATH=..
[15608]85 goto getVer
[17061]86
[15608]87:getVer
[15628]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
[15608]91if "%_VERSION%" == "2" set GSDL3SRCHOME=
[5824]92if "%_VERSION%" == "2" set GSDL3HOME=
93goto testGSDL
[15608]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
[15628]110set _VERSION=2
111set GSDLPATH=%GSDLHOME%
112::free up the GS3 environment variables since we are running GS2 and don't need them
[15608]113set GSDL3SRCHOME=
114set GSDL3HOME=
115goto testGSDL
[5824]116
[15608]117
[17061]118:testGSDL
[15608]119set CHECK=1
120call chkinst.bat "%GSDLPATH%" %_VERSION% %GLILANG% %CHECK% > nul
121if "%CHECK%" == "1" goto exit
[6749]122 :: otherwise installation worked well
[6753]123 goto prepGSDL
[15608]124
125
126:prepGSDL
[6754]127:: Greenstone 3 case
[15608]128if "%_VERSION%" == "3" goto prepGS3
[18407]129
[5824]130if not "%_VERSION%" == "2" echo "Greenstone version unknown"
[15608]131if not "%_VERSION%" == "2" goto exit
132
[5824]133:: Otherwise, we are dealing with Greenstone 2
[17911]134:: Setup Greenstone 2, unless it has already been done
[15608]135if not "%GSDLHOME%" == "" goto doneGSDL
[5824]136 call "%GSDLPATH%\setup.bat" SetEnv
[15608]137 goto doneGSDL
138
139
[18415]140:prepGS3
[15608]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
[17911]154 del %TMP%\setgli.bat
[15608]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
[17061]175:setupGS2
[15608]176set CHECK=1
177call chkinst.bat "%GSDL2PATH%" 2 %GLILANG% %CHECK% > nul
178if "%CHECK%" == "1" goto exit
[17911]179 :: otherwise installation worked well
[15608]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
[5824]185
186
187:doneGSDL
188:: GSDLPATH is no longer needed, since GSDLHOME should now be set
189set GSDLPATH=
[19336]190
191
192:: Now need to find Perl. If found, PERLPATH will be set
[5824]193call findperl.bat
[19336]194if "%PERLPATH%" == "" goto exit
195
196:: Need to find Java. If found, JAVA_EXECUTABLE will be set
[5824]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
[6749]204if exist "GLI.jar" goto runGLI
205 echo.
206 if "%GLILANG%" == "en" echo You need to compile the Greenstone Librarian Interface (using makegli.bat)
[6753]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
[10787]210 if "%GLILANG%" == "es" echo (por medio de makegli.bat) antes de ejecutar este gui¢n.
[6749]211
[6754]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
[5824]215 if "%GLILANG%" == "ru" echo ‚ë €®«Š­ë ª®¬¯š«šà®¢ âì ¡š¡«š®â¥ç­ë© š­â¥à䥩á Greenstone (šá¯®«ì§ãï makegli.bat)
216 if "%GLILANG%" == "ru" echo ¯¥à¥€ ¢¢®€®¬ í⮣® áªàš¯â 
217 goto exit
218
[17671]219
[17332]220:runGLI
221
222if not "%_VERSION%" == "" (
223 echo Greenstone Major Version:
224 echo %_VERSION%
[7680]225 echo.
[17332]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.
[17671]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
[15629]255
256:: ---- Finally, run the GLI ----
257if "%GLILANG%" == "en" echo Running the %PROGNAME%...
[16548]258if "%GLILANG%" == "es" echo Ejecutando la %PROGNAME%...
[5824]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
[12695]267:: -Xloggc:<file> Write garbage collection log
[15608]268
[17501]269
[15608]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)
[12689]278 if exist "%GSDLHOME%\server.exe" goto localLib
[17501]279
[18408]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
[17474]282 if ERRORLEVEL 2 (
[15608]283 goto webLib
[12689]284 )
[5824]285 goto finRun
[17501]286
[18408]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
[17474]289 if ERRORLEVEL 2 (
[15608]290 goto localLib
[12689]291 )
[15608]292 goto finRun
293
[6749]294
[6753]295:finRun
[6749]296 if "%GLILANG%" == "en" echo Done!
[6754]297 if "%GLILANG%" == "es" echo ­Hecho!
[5927]298 if "%GLILANG%" == "fr" echo Termin‚!
[5824]299 if "%GLILANG%" == "ru" echo ‚믮«­¥­®!
[15608]300 goto done
[5824]301
302
303:exit
[17942]304echo.
305pause
[5824]306color 07
[5927]307popd
[5824]308
309:done
[17501]310:: ---- Clean up ----
[17942]311set PERLPATH=
312set JAVA_EXECUTABLE=
313color 07
314popd
Note: See TracBrowser for help on using the repository browser.