source: trunk/gli/gli.bat@ 6670

Last change on this file since 6670 was 6670, checked in by mdewsnip, 20 years ago

Changed copyright messages to 2004.

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