source: trunk/gli/gli.bat@ 6667

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

Decrease copyright string by four characters, and moved the copyright method after the second command call.

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