1 | @echo off
|
---|
2 | set 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
|
---|
8 | if exist gli.bat goto start
|
---|
9 | if "%GLILANG%" == "en" echo This script must be run from the directory in which it resides.
|
---|
10 | if "%GLILANG%" == "fr" echo Ce script doit tre excut
|
---|
11 | partir du rpertoire dans lequel il se trouve.
|
---|
12 | goto exit
|
---|
13 |
|
---|
14 | :start
|
---|
15 | if "%OS%" == "Windows_NT" goto findGSDL
|
---|
16 | :: Invoke a new command processor to ensure there's enough environment space
|
---|
17 | if "%1" == "Second" goto findGSDL
|
---|
18 | command /E:2048 /C %0 Second %1 %2 %3 %4 %5 %6 %7 %8 %9
|
---|
19 | goto done
|
---|
20 |
|
---|
21 | :findGSDL
|
---|
22 | echo.
|
---|
23 | if "%GLILANG%" == "en" echo Greenstone Librarian Interface (GLI)
|
---|
24 | if "%GLILANG%" == "en" echo Copyright (C) 2004, New Zealand Digital Library Project, University Of Waikato
|
---|
25 | if "%GLILANG%" == "en" echo GLI comes with ABSOLUTELY NO WARRANTY; for details see LICENSE.txt
|
---|
26 | if "%GLILANG%" == "en" echo This is free software, and you are welcome to redistribute it
|
---|
27 |
|
---|
28 | if "%GLILANG%" == "fr" echo -- Still coming --
|
---|
29 | echo.
|
---|
30 | :: ---- Determine GSDLHOME ----
|
---|
31 | set GSDLPATH=
|
---|
32 |
|
---|
33 | :: Some users may set the above line manually
|
---|
34 | if not "%GSDLPATH%" == "" goto testGSDL
|
---|
35 |
|
---|
36 | :: The default location for the GLI is a subdirectory of Greenstone
|
---|
37 | set GSDLPATH=..
|
---|
38 |
|
---|
39 | :: If it is set, use the GSDLHOME environment variable
|
---|
40 | if "%GSDLHOME%" == "" goto testGSDL
|
---|
41 | set GSDLPATH=%GSDLHOME%
|
---|
42 |
|
---|
43 | :testGSDL
|
---|
44 | :: Check that the Greenstone installation looks OK
|
---|
45 | if "%GLILANG%" == "en" echo Checking GSDL: %GSDLPATH%
|
---|
46 | if "%GLILANG%" == "fr" echo Vrification de GSDL: %GSDLPATH%
|
---|
47 | if exist "%GSDLPATH%\setup.bat" goto prepGSDL
|
---|
48 | echo.
|
---|
49 | if "%GLILANG%" == "en" echo The Greenstone installation could not be found, or is incomplete.
|
---|
50 | if "%GLILANG%" == "en" echo Try reinstalling Greenstone then running this script again.
|
---|
51 |
|
---|
52 | if "%GLILANG%" == "fr" echo L'installation de Greenstone est introuvable ou incomplte. Essayez
|
---|
53 | if "%GLILANG%" == "fr" echo de rinstaller Greenstone et excutez ce script
|
---|
54 | nouveau.
|
---|
55 | goto exit
|
---|
56 |
|
---|
57 | :prepGSDL
|
---|
58 | :: Setup Greenstone, unless it has already been done
|
---|
59 | if not "%GSDLHOME%" == "" goto doneGSDL
|
---|
60 | call "%GSDLPATH%\setup.bat" SetEnv > nul
|
---|
61 |
|
---|
62 | :doneGSDL
|
---|
63 | :: GSDLPATH is no longer needed, since GSDLHOME should now be set
|
---|
64 | set GSDLPATH=
|
---|
65 |
|
---|
66 |
|
---|
67 | :findPerl
|
---|
68 | :: ---- Check Perl exists ----
|
---|
69 | set PERLPATH=
|
---|
70 |
|
---|
71 | :: Some users may set the above line manually
|
---|
72 | if not "%PERLPATH%" == "" goto testPerl
|
---|
73 |
|
---|
74 | :: Check if Perl is on the search path
|
---|
75 | echo %PATH%| winutil\which.exe perl.exe | winutil\setvar.exe PERLPATH > setperl.bat
|
---|
76 | call setperl.bat
|
---|
77 | del setperl.bat
|
---|
78 | if not "%PERLPATH%" == "" goto testPerl
|
---|
79 |
|
---|
80 | :: If not, try GSDLHOME\bin\windows\perl\bin
|
---|
81 | if exist "%GSDLHOME%\bin\windows\perl\bin\perl.exe" goto gsdlPerl
|
---|
82 |
|
---|
83 | :: Still haven't found anything, so try looking in the registry (gulp!)
|
---|
84 | type nul > perl.reg
|
---|
85 | regedit /E perl.reg "HKEY_LOCAL_MACHINE\SOFTWARE\Perl"
|
---|
86 | type perl.reg > perl.txt
|
---|
87 | del perl.reg
|
---|
88 |
|
---|
89 | winutil\findperl.exe perl.txt | winutil\setvar.exe PERLPATH > setperl.bat
|
---|
90 | del perl.txt
|
---|
91 | call setperl.bat
|
---|
92 | del setperl.bat
|
---|
93 |
|
---|
94 | :: If nothing was found in the registry, we're stuck
|
---|
95 | if "%PERLPATH%" == "" goto noPerl
|
---|
96 |
|
---|
97 | goto testPerl
|
---|
98 |
|
---|
99 | :gsdlPerl
|
---|
100 | set PERLPATH=%GSDLHOME%\bin\windows\perl\bin
|
---|
101 |
|
---|
102 | :testPerl
|
---|
103 | :: Check that a Perl executable has been found
|
---|
104 | if "%GLILANG%" == "en" echo Checking Perl: %PERLPATH%
|
---|
105 | if "%GLILANG%" == "fr" echo Vrification de Perl: %PERLPATH%
|
---|
106 | if exist "%PERLPATH%\perl.exe" goto findJava
|
---|
107 |
|
---|
108 | :noPerl
|
---|
109 | echo.
|
---|
110 | if "%GLILANG%" == "en" echo The Greenstone Librarian Interface requires perl in order to operate,
|
---|
111 | if "%GLILANG%" == "en" echo but perl could not be detected on your system. Please ensure that perl
|
---|
112 | if "%GLILANG%" == "en" echo is installed and is on your search path, then rerun this script.
|
---|
113 |
|
---|
114 | if "%GLILANG%" == "fr" echo Greenstone Librarian Interface ncessite perl pour son fonctionnement,
|
---|
115 | if "%GLILANG%" == "fr" echo mais perl n'a pas pu tre dtect dans votre systme. Veuillez vous
|
---|
116 | if "%GLILANG%" == "fr" echo assurer que perl est install et est spcifi dans votre chemin de
|
---|
117 | if "%GLILANG%" == "fr" echo recherche, puis redmarrez ce script.
|
---|
118 | goto exit
|
---|
119 |
|
---|
120 |
|
---|
121 | :findJava
|
---|
122 | :: ---- Check Java exists ----
|
---|
123 | set JAVAPATH=
|
---|
124 |
|
---|
125 | :: Some users may set the above line manually
|
---|
126 | if not "%JAVAPATH%" == "" goto testJava
|
---|
127 |
|
---|
128 | :: If it is set, use the JAVA_HOME environment variable
|
---|
129 | if not "%JAVA_HOME%" == "" goto javahome
|
---|
130 |
|
---|
131 | :: Check if Java is on the search path
|
---|
132 | echo %PATH%| winutil\which.exe java.exe | winutil\setvar.exe JAVAPATH > setjava.bat
|
---|
133 | call setjava.bat
|
---|
134 | del setjava.bat
|
---|
135 | if not "%JAVAPATH%" == "" goto testJava
|
---|
136 |
|
---|
137 | :: Still haven't found anything, so try looking in the registry (gulp!)
|
---|
138 | type nul > jdk.reg
|
---|
139 | regedit /E jdk.reg "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit"
|
---|
140 | type jdk.reg > jdk.txt
|
---|
141 | del jdk.reg
|
---|
142 | type nul > jre.reg
|
---|
143 | regedit /E jre.reg "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment"
|
---|
144 | type jre.reg > jre.txt
|
---|
145 | del jre.reg
|
---|
146 |
|
---|
147 | winutil\findjava.exe jdk.txt jre.txt | winutil\setvar.exe JAVAPATH > setjava.bat
|
---|
148 | del jdk.txt
|
---|
149 | del jre.txt
|
---|
150 | call setjava.bat
|
---|
151 | del setjava.bat
|
---|
152 |
|
---|
153 | :: If nothing was found in the registry, we're stuck
|
---|
154 | if "%JAVAPATH%" == "" goto noJava
|
---|
155 |
|
---|
156 | set JAVAPATH=%JAVAPATH%\bin
|
---|
157 | goto testJava
|
---|
158 |
|
---|
159 | :javahome
|
---|
160 | set JAVAPATH=%JAVA_HOME%\bin
|
---|
161 |
|
---|
162 | :testJava
|
---|
163 | :: Check that a Java executable has been found
|
---|
164 | if "%GLILANG%" == "en" echo Checking Java: %JAVAPATH%
|
---|
165 | if "%GLILANG%" == "fr" echo Vrification de Java: %JAVAPATH%
|
---|
166 | if exist "%JAVAPATH%\java.exe" goto checkGLI
|
---|
167 |
|
---|
168 | :noJava
|
---|
169 | echo.
|
---|
170 | if "%GLILANG%" == "en" echo Failed to locate an appropriate version of Java. You must install a
|
---|
171 | if "%GLILANG%" == "en" echo Java Runtime Environment (version 1.4 or greater) before running the
|
---|
172 | if "%GLILANG%" == "en" echo Greenstone Librarian Interface.
|
---|
173 |
|
---|
174 | if "%GLILANG%" == "fr" echo Une version adquate de Java n'a pas pu tre localise. Vous devez
|
---|
175 | if "%GLILANG%" == "fr" echo installer un Java Runtime Environment (version 1.4 ou suprieur)
|
---|
176 | if "%GLILANG%" == "fr" echo avant de dmarrer Greenstone Librarian Interface.
|
---|
177 | goto exit
|
---|
178 |
|
---|
179 |
|
---|
180 | :checkGLI
|
---|
181 | :: ---- Check that the GLI has been compiled ----
|
---|
182 | if exist "classes/org/greenstone/gatherer/Gatherer.class" goto runGLI
|
---|
183 | if exist "GLI.jar" goto runGLI
|
---|
184 | echo.
|
---|
185 | if "%GLILANG%" == "en" echo You need to compile the Greenstone Librarian Interface (using makegli.bat)
|
---|
186 | if "%GLILANG%" == "en" echo before running this script.
|
---|
187 |
|
---|
188 | if "%GLILANG%" == "fr" echo Vous devez compiler le Greenstone Interface (en utilisant makegil.bat)
|
---|
189 | if "%GLILANG%" == "fr" echo avant d'excuter ce script.
|
---|
190 | goto exit
|
---|
191 |
|
---|
192 |
|
---|
193 | :runGLI
|
---|
194 | :: ---- Finally, run the GLI ----
|
---|
195 | echo.
|
---|
196 | if "%GLILANG%" == "en" echo Running the Greenstone Librarian Interface...
|
---|
197 | if "%GLILANG%" == "fr" echo Excution de Greenstone Librarian Interface
|
---|
198 |
|
---|
199 | :: -Xms32M To set minimum memory
|
---|
200 | :: -Xmx32M To set maximum memory
|
---|
201 | :: -verbose:gc To set garbage collection messages
|
---|
202 | :: -Xincgc For incremental garbage collection
|
---|
203 | :: -Xprof Function call profiling
|
---|
204 | :: -Xloggc:<file> Write garbage collection log
|
---|
205 |
|
---|
206 | if exist "%GSDLHOME%\server.exe" goto localLib
|
---|
207 | "%JAVAPATH%\java" -cp classes/;GLI.jar;lib/apache.jar;lib/calpa.jar;lib/jp.jar;lib/polloxml.jar;lib/qfslib.jar;lib/skinlf.jar;lib/nanoxml.jar org.greenstone.gatherer.Gatherer -gsdl %GSDLHOME% -perl %PERLPATH% %1 %2 %3 %4 %5 %6 %7 %8 %9
|
---|
208 |
|
---|
209 | if "%GLILANG%" == "en" echo Done!
|
---|
210 | if "%GLILANG%" == "fr" echo Termin!
|
---|
211 | goto done
|
---|
212 |
|
---|
213 | :localLib
|
---|
214 | "%JAVAPATH%\java" -cp classes/;GLI.jar;lib/apache.jar;lib/calpa.jar;lib/jp.jar;lib/polloxml.jar;lib/qfslib.jar;lib/skinlf.jar;lib/nanoxml.jar org.greenstone.gatherer.Gatherer -gsdl %GSDLHOME% -perl %PERLPATH% -library %GSDLHOME%\server.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
|
---|
215 |
|
---|
216 | if "%GLILANG%" == "en" echo Done!
|
---|
217 | if "%GLILANG%" == "fr" echo Termin!
|
---|
218 | goto done
|
---|
219 |
|
---|
220 | :exit
|
---|
221 | echo.
|
---|
222 | pause
|
---|
223 |
|
---|
224 | :done
|
---|
225 | :: ---- Clean up ----
|
---|
226 | set PERLPATH=
|
---|
227 | set JAVAPATH=
|
---|