source: trunk/gli/gli.bat@ 5774

Last change on this file since 5774 was 5705, checked in by jmt12, 21 years ago

All executable programs need to have an executable file extension under the old Win98 command.com

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