source: trunk/gli/gli.bat@ 6262

Last change on this file since 6262 was 6262, checked in by jmt12, 20 years ago

Corrected the launching scripts/batch files to say copyright 2003 - at least for 19 more days

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 6.1 KB
Line 
1@echo off
2
3echo
4echo Greenstone Librarian Interface (GLI)
5echo Copyright (C) 2003 Greenstone Digital Libraries, University Of Waikato
6echo GLI comes with ABSOLUTELY NO WARRANTY; for details see LICENSE.txt
7echo This is free software, and you are welcome to redistribute it
8echo
9
10
11:: -------- Run the Greenstone Librarian Interface --------
12
13:: This script must be run from within the directory in which it lives
14if exist gli.bat goto start
15 echo This script must be run from the directory in which it resides.
16 goto exit
17
18:start
19if "%OS%" == "Windows_NT" goto findGSDL
20 :: Invoke a new command processor to ensure there's enough environment space
21 if "%1" == "Second" goto findGSDL
22 command /E:2048 /C %0 Second %1 %2 %3 %4 %5 %6 %7 %8 %9
23 goto done
24
25
26:findGSDL
27:: ---- Determine GSDLHOME ----
28set GSDLPATH=
29
30:: Some users may set the above line manually
31if not "%GSDLPATH%" == "" goto testGSDL
32
33 :: The default location for the GLI is a subdirectory of Greenstone
34 set GSDLPATH=..
35
36 :: If it is set, use the GSDLHOME environment variable
37 if "%GSDLHOME%" == "" goto testGSDL
38 set GSDLPATH=%GSDLHOME%
39
40:testGSDL
41:: Check that the Greenstone installation looks OK
42echo Checking GSDL: %GSDLPATH%
43if exist "%GSDLPATH%\setup.bat" goto prepGSDL
44 echo.
45 echo The Greenstone installation could not be found, or is incomplete.
46 echo Try reinstalling Greenstone then running this script again.
47 goto exit
48
49:prepGSDL
50:: Setup Greenstone, unless it has already been done
51if not "%GSDLHOME%" == "" goto doneGSDL
52 call "%GSDLPATH%\setup.bat" SetEnv > nul
53
54:doneGSDL
55:: GSDLPATH is no longer needed, since GSDLHOME should now be set
56set GSDLPATH=
57
58
59:findPerl
60:: ---- Check Perl exists ----
61set PERLPATH=
62
63:: Some users may set the above line manually
64if not "%PERLPATH%" == "" goto testPerl
65
66 :: Check if Perl is on the search path
67 echo %PATH%| winutil\which.exe perl.exe | winutil\setvar.exe PERLPATH > setperl.bat
68 call setperl.bat
69 del setperl.bat
70 if not "%PERLPATH%" == "" goto testPerl
71
72 :: If not, try GSDLHOME\bin\windows\perl\bin
73 if exist "%GSDLHOME%\bin\windows\perl\bin\perl.exe" goto gsdlPerl
74
75 :: Still haven't found anything, so try looking in the registry (gulp!)
76 type nul > perl.reg
77 regedit /E perl.reg "HKEY_LOCAL_MACHINE\SOFTWARE\Perl"
78 type perl.reg > perl.txt
79 del perl.reg
80
81 winutil\findperl.exe perl.txt | winutil\setvar.exe PERLPATH > setperl.bat
82 del perl.txt
83 call setperl.bat
84 del setperl.bat
85
86 :: If nothing was found in the registry, we're stuck
87 if "%PERLPATH%" == "" goto noPerl
88
89 goto testPerl
90
91:gsdlPerl
92 set PERLPATH=%GSDLHOME%\bin\windows\perl\bin
93
94:testPerl
95:: Check that a Perl executable has been found
96echo Checking Perl: %PERLPATH%
97if exist "%PERLPATH%\perl.exe" goto findJava
98
99:noPerl
100 echo.
101 echo The Greenstone Librarian Interface requires perl in order to operate,
102 echo but perl could not be detected on your system. Please ensure that perl
103 echo is installed and is on your search path, then rerun this script.
104 goto exit
105
106
107:findJava
108:: ---- Check Java exists ----
109set JAVAPATH=
110
111:: Some users may set the above line manually
112if not "%JAVAPATH%" == "" goto testJava
113
114 :: If it is set, use the JAVAHOME environment variable
115 if not "%JAVAHOME%" == "" goto javahome
116
117 :: Check if Java is on the search path
118 echo %PATH%| winutil\which.exe java.exe | winutil\setvar.exe JAVAPATH > setjava.bat
119 call setjava.bat
120 del setjava.bat
121 if not "%JAVAPATH%" == "" goto testJava
122
123 :: Still haven't found anything, so try looking in the registry (gulp!)
124 type nul > jdk.reg
125 regedit /E jdk.reg "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit"
126 type jdk.reg > jdk.txt
127 del jdk.reg
128 type nul > jre.reg
129 regedit /E jre.reg "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment"
130 type jre.reg > jre.txt
131 del jre.reg
132
133 winutil\findjava.exe jdk.txt jre.txt | winutil\setvar.exe JAVAPATH > setjava.bat
134 del jdk.txt
135 del jre.txt
136 call setjava.bat
137 del setjava.bat
138
139 :: If nothing was found in the registry, we're stuck
140 if "%JAVAPATH%" == "" goto noJava
141
142 set JAVAPATH=%JAVAPATH%\bin
143 goto testJava
144
145:javahome
146 set JAVAPATH=%JAVAHOME%\bin
147
148:testJava
149:: Check that a Java executable has been found
150echo Checking Java: %JAVAPATH%
151if exist "%JAVAPATH%\java.exe" goto checkGLI
152
153:noJava
154 echo.
155 echo Failed to locate an appropriate version of Java. You must install a
156 echo Java Runtime Environment (version 1.4 or greater) before running the
157 echo Greenstone Librarian Interface.
158 goto exit
159
160
161:checkGLI
162:: ---- Check that the GLI has been compiled ----
163if exist "classes/org/greenstone/gatherer/Gatherer.class" goto runGLI
164if exist "GLI.jar" goto runGLI
165 echo.
166 echo You need to compile the Greenstone Librarian Interface (using makegli.bat)
167 echo before running this script.
168 goto exit
169
170
171:runGLI
172:: ---- Finally, run the GLI ----
173echo.
174echo Running the Greenstone Librarian Interface...
175
176:: -Xms32M To set minimum memory
177:: -Xmx32M To set maximum memory
178:: -verbose:gc To set garbage collection messages
179:: -Xincgc For incremental garbage collection
180:: -Xprof Function call profiling
181:: -Xloggc:<file> Write garbage collection log
182
183if exist "%GSDLHOME%\server.exe" goto localLib
184 "%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
185
186 echo Done!
187 goto done
188
189:localLib
190 "%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
191
192 echo Done!
193 goto done
194
195:exit
196echo.
197pause
198
199:done
200:: ---- Clean up ----
201set PERLPATH=
202set JAVAPATH=
Note: See TracBrowser for help on using the repository browser.