1 | @echo off
|
---|
2 | color 0A
|
---|
3 | pushd "%CD%"
|
---|
4 | CD /D "%~dp0"
|
---|
5 | set 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
|
---|
11 | if 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 excut
|
---|
15 | partir du rpertoire dans lequel il se trouve.
|
---|
16 | if "%GLILANG%" == "ru" echo â®â áªàš¯â €®«Š¥ ¡ëâì ¢§ïâ š§ €šà¥ªâ®àšš, ¢ ª®â®à®© ® à ᯮ«®Š¥
|
---|
17 | goto exit
|
---|
18 |
|
---|
19 | :start
|
---|
20 | if "%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
|
---|
28 | if 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 |
|
---|
37 | if "%PROGABBR%" == "" set PROGABBR=GLI
|
---|
38 | if "%PROGNAME_EN%" == "" set PROGNAME_EN=Greenstone Librarian Interface
|
---|
39 |
|
---|
40 | :findGSDL
|
---|
41 | echo.
|
---|
42 | if "%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 |
|
---|
49 | if "%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 trminos 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 |
|
---|
57 | if "%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 dtails, voir LICENSE.txt
|
---|
61 | echo Ceci est un logiciel libre, et vous tes invit
|
---|
62 | le redistribuer
|
---|
63 | )
|
---|
64 |
|
---|
65 | if "%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 |
|
---|
72 | echo.
|
---|
73 | :: ---- Determine path to Greenstone home for GS2 and GS3 ----
|
---|
74 | set GSDLPATH=
|
---|
75 | :: Some users may set the above line manually, or it may be set as an argument
|
---|
76 |
|
---|
77 | set _VERSION=
|
---|
78 | if 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
|
---|
88 | call gsdlver.bat %GSDLPATH% %_VERSION% > nul
|
---|
89 | if "%_VERSION%" == "1" goto exit
|
---|
90 | ::if we are running GS2, free up any pre-set GS3 environment variables since we won't need them
|
---|
91 | if "%_VERSION%" == "2" set GSDL3SRCHOME=
|
---|
92 | if "%_VERSION%" == "2" set GSDL3HOME=
|
---|
93 | goto testGSDL
|
---|
94 |
|
---|
95 |
|
---|
96 | :ver3
|
---|
97 | set _VERSION=3
|
---|
98 | set 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
|
---|
101 | if not "%GSDLHOME%" == "" echo Both Greenstone 2 and Greenstone 3 environments are set.
|
---|
102 | if not "%GSDLHOME%" == "" echo It is assumed you want to run Greenstone 3.
|
---|
103 | if not "%GSDLHOME%" == "" echo If you want to run Greenstone 2, please unset the
|
---|
104 | if not "%GSDLHOME%" == "" echo environment variable GSDL3SRCHOME before running GLI.
|
---|
105 | if not "%GSDLHOME%" == "" echo.
|
---|
106 | goto testGSDL
|
---|
107 |
|
---|
108 |
|
---|
109 | :ver2
|
---|
110 | set _VERSION=2
|
---|
111 | set GSDLPATH=%GSDLHOME%
|
---|
112 | ::free up the GS3 environment variables since we are running GS2 and don't need them
|
---|
113 | set GSDL3SRCHOME=
|
---|
114 | set GSDL3HOME=
|
---|
115 | goto testGSDL
|
---|
116 |
|
---|
117 |
|
---|
118 | :testGSDL
|
---|
119 | set CHECK=1
|
---|
120 | call chkinst.bat "%GSDLPATH%" %_VERSION% %GLILANG% %CHECK% > nul
|
---|
121 | if "%CHECK%" == "1" goto exit
|
---|
122 | :: otherwise installation worked well
|
---|
123 | goto prepGSDL
|
---|
124 |
|
---|
125 |
|
---|
126 | :prepGSDL
|
---|
127 | :: Greenstone 3 case
|
---|
128 | if "%_VERSION%" == "3" goto prepGS3
|
---|
129 |
|
---|
130 | if not "%_VERSION%" == "2" echo "Greenstone version unknown"
|
---|
131 | if not "%_VERSION%" == "2" goto exit
|
---|
132 |
|
---|
133 | :: Otherwise, we are dealing with Greenstone 2
|
---|
134 | :: Setup Greenstone 2, unless it has already been done
|
---|
135 | if not "%GSDLHOME%" == "" goto doneGSDL
|
---|
136 | call "%GSDLPATH%\setup.bat" SetEnv
|
---|
137 | goto doneGSDL
|
---|
138 |
|
---|
139 |
|
---|
140 | :prepGS3
|
---|
141 | set GSDL2PATH=
|
---|
142 | :: Some users may set the above line manually
|
---|
143 |
|
---|
144 | if "%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
|
---|
176 | set CHECK=1
|
---|
177 | call chkinst.bat "%GSDL2PATH%" 2 %GLILANG% %CHECK% > nul
|
---|
178 | if "%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
|
---|
189 | set GSDLPATH=
|
---|
190 |
|
---|
191 |
|
---|
192 | :: Now need to find Perl. If found, PERLPATH will be set
|
---|
193 | call findperl.bat
|
---|
194 | if "%PERLPATH%" == "" goto exit
|
---|
195 |
|
---|
196 | :: Need to find Java. If found, JAVA_EXECUTABLE will be set
|
---|
197 | call findjava.bat
|
---|
198 | if "%JAVA_EXECUTABLE%" == "" goto exit
|
---|
199 |
|
---|
200 |
|
---|
201 | :checkGLI
|
---|
202 | :: ---- Check that the GLI has been compiled ----
|
---|
203 | if exist "classes/org/greenstone/gatherer/Gatherer.class" goto runGLI
|
---|
204 | if 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'excuter ce script.
|
---|
214 |
|
---|
215 | if "%GLILANG%" == "ru" echo ë €®«Šë ª®¬¯š«šà®¢ âì ¡š¡«š®â¥çë© šâ¥à䥩á Greenstone (šá¯®«ì§ãï makegli.bat)
|
---|
216 | if "%GLILANG%" == "ru" echo ¯¥à¥€ ¢¢®€®¬ í⮣® áªàš¯â
|
---|
217 | goto exit
|
---|
218 |
|
---|
219 |
|
---|
220 | :runGLI
|
---|
221 |
|
---|
222 | if not "%_VERSION%" == "" (
|
---|
223 | echo Greenstone Major Version:
|
---|
224 | echo %_VERSION%
|
---|
225 | echo.
|
---|
226 | )
|
---|
227 |
|
---|
228 | if not "%GSDL3SRCHOME%" == "" (
|
---|
229 | echo GSDL3SRCHOME:
|
---|
230 | echo %GSDL3SRCHOME%
|
---|
231 | echo.
|
---|
232 | )
|
---|
233 |
|
---|
234 | if not "%GSDL3HOME%" == "" (
|
---|
235 | echo GSDL3HOME:
|
---|
236 | echo %GSDL3HOME%
|
---|
237 | echo.
|
---|
238 | )
|
---|
239 |
|
---|
240 | if 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 ----
|
---|
247 | echo.
|
---|
248 | if 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.
|
---|
249 | echo.
|
---|
250 | echo.
|
---|
251 | if 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.
|
---|
252 | echo.
|
---|
253 | echo.
|
---|
254 |
|
---|
255 |
|
---|
256 | :: ---- Finally, run the GLI ----
|
---|
257 | if "%GLILANG%" == "en" echo Running the %PROGNAME%...
|
---|
258 | if "%GLILANG%" == "es" echo Ejecutando la %PROGNAME%...
|
---|
259 | if "%GLILANG%" == "fr" echo Excution de %PROGNAME%
|
---|
260 | if "%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
|
---|
271 | if "%_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
|
---|
272 | if "%_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
|
---|
276 | if "%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
|
---|
304 | echo.
|
---|
305 | pause
|
---|
306 | color 07
|
---|
307 | popd
|
---|
308 |
|
---|
309 | :done
|
---|
310 | :: ---- Clean up ----
|
---|
311 | set PERLPATH=
|
---|
312 | set JAVA_EXECUTABLE=
|
---|
313 | color 07
|
---|
314 | popd
|
---|