root/greenstone3/trunk/gs3-setup.bat @ 20824

Revision 20824, 4.5 KB (checked in by oranfry, 10 years ago)

use star dot star instead of nul because nul doesn't work with quotes (on xp at least)

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
1@echo off
2
3set java_min_version=1.5.0_00
4
5if exist gs3-setup.bat goto start
6  echo This script must be run from within the Greenstone 3 home directory
7  goto exit
8
9:start
10:: ---- Set some relevant environment variables ----
11
12:: this is the default
13:: greenstone3 (%GSDL3SRCHOME%)
14:: +-- web (%GSDL3HOME%)
15:: +-- packages
16::      +-- tomcat (%TOMCAT_HOME%)
17::      +-- ant (%ANT_HOME%)
18
19:: set GSDLSRCHOME to the current directory
20cd | winutil\setvar.exe GSDL3SRCHOME > %TMP%\setgsdl3.bat
21call %TMP%\setgsdl3.bat
22del %TMP%\setgsdl3.bat
23
24:: set GSDLHOME to the 'web' subdirectory
25set GSDL3HOME=%GSDL3SRCHOME%\web
26
27:: change if using external tomcat or ant
28set TOMCAT_HOME=%GSDL3SRCHOME%\packages\tomcat
29if exist "%GSDL3SRCHOME%\packages\ant\*.*" set ANT_HOME=%GSDL3SRCHOME%\packages\ant
30
31:: other important environment variables
32set GSDLOS=windows
33
34:: ---- Set the CLASSPATH and PATH environment variables ----
35if "%GS_CP_SET%" == "yes" goto skipSetCp
36set CLASSPATH=%GSDL3HOME%\WEB-INF\classes;%GSDL3SRCHOME%\resources\java;%GSDL3SRCHOME%\cp.jar;%CLASSPATH%;
37set PATH=%PATH%;%GSDL3SRCHOME%\bin;%GSDL3SRCHOME%\bin\script;%GSDL3SRCHOME%\lib\jni;%ANT_HOME%\bin
38
39:: Override Imagemagick and Ghostscript paths to the bundled applications shipped with greenstone if they exists otherwise use default environment variables.
40if exist "%GSDL3SRCHOME%\gs2build\bin\windows\ghostscript\bin\gsdll32.dll" set GS_DLL=%GSDL3SRCHOME%\gs2build\bin\windows\ghostscript\bin\gsdll32.dll
41if exist "%GSDL3SRCHOME%\gs2build\bin\windows\ghostscript\lib\*.*" set GS_LIB=%GSDL3SRCHOME%\gs2build\bin\windows\ghostscript\lib
42if exist "%GSDL3SRCHOME%\gs2build\bin\windows\ghostscript\bin\*.*" set PATH=%GSDL3SRCHOME%\gs2build\bin\windows\ghostscript\bin;%PATH%
43if exist "%GSDL3SRCHOME%\gs2build\bin\windows\imagemagick\*.*" set PATH=%GSDL3SRCHOME%\gs2build\bin\windows\imagemagick;%PATH%
44
45:: a little dynamic set cp stuff
46if exist %TMP%\setcp.bat del %TMP%\setcp.bat
47for %%j in ("%TOMCAT_HOME%"\common\endorsed\*.jar) do echo set CLASSPATH=%%CLASSPATH%%;%%j>> %TMP%\setcp.bat
48for %%j in ("%TOMCAT_HOME%"\lib\*.jar) do echo set CLASSPATH=%%CLASSPATH%%;%%j>> %TMP%\setcp.bat
49if exist %TMP%\setcp.bat call %TMP%\setcp.bat
50if exist %TMP%\setcp.bat del %TMP%\setcp.bat
51
52set GS_CP_SET=yes
53:skipSetCp
54
55:: ---- Search for java ----
56set JAVA_MIN_VERSION=1.5.0_00
57set HINT=%CD%\packages\jre
58::if search4j is present, use it
59set FOUNDJAVAHOME=
60set RUNJAVA=
61if exist bin\search4j.exe (
62  for /F "tokens=*" %%r in ('bin\search4j.exe -d -p "%HINT%" -m %JAVA_MIN_VERSION%') do set FOUNDJAVAHOME=%%r
63  for /F "tokens=*" %%r in ('bin\search4j.exe -r -p "%HINT%" -m %JAVA_MIN_VERSION%') do set FOUNDJREHOME=%%r
64)
65
66if not "%FOUNDJAVAHOME%"=="" (
67  set JAVA_HOME=%FOUNDJAVAHOME%
68  set PATH=%FOUNDJAVAHOME%\bin;%PATH%
69  set RUNJAVA=%FOUNDJAVAHOME%\bin\java.exe
70  goto summaryThenEnd
71)
72
73if not "%FOUNDJREHOME%"=="" (
74  set JRE_HOME=%FOUNDJREHOME%
75  set PATH=%FOUNDJREHOME%\bin;%PATH%
76  set RUNJAVA=%FOUNDJREHOME%\bin\java.exe
77  goto summaryThenEnd
78)
79
80if exist "%HINT%\bin\java.exe" (
81  set JAVA_HOME=%HINT%
82  set PATH=%JAVA_HOME%\bin;%PATH%
83  set RUNJAVA=%JAVA_HOME%\bin\java.exe
84  goto summaryThenEnd
85)
86
87if exist "%JAVA_HOME%\bin\java.exe" (
88  set PATH=%JAVA_HOME%\bin;%PATH%
89  set RUNJAVA=%JAVA_HOME%\bin\java.exe
90  echo Using java at %JAVA_HOME%
91  echo WARNING: Greenstone has not checked the version number of this java installation
92  echo          The source distribution of Greenstone3 requires java 1.5 or greater
93  echo          SVN users may still use java 1.4
94  goto summaryThenEnd
95)
96
97if exist "%JRE_HOME%\bin\java.exe" (
98  set PATH=%JRE_HOME%\bin;%PATH%
99  set RUNJAVA=%JRE_HOME%\bin\java.exe
100  echo Using java at %JRE_HOME%
101  echo WARNING: Greenstone has not checked the version number of this java installation
102  echo          The source distribution of Greenstone3 requires java 1.5 or greater
103  echo          SVN users may still use java 1.4
104  goto summaryThenEnd
105)
106
107echo ERROR: Failed to locate java
108echo        Please set JAVA_HOME or JRE_HOME to point to an appropriate java
109goto end
110
111:summaryThenEnd
112
113echo GSDL3SRCHOME : %GSDL3SRCHOME%
114echo GSDL3HOME    : %GSDL3HOME%
115echo JAVA         : %RUNJAVA%
116if "%ANT_HOME%" == "" (
117   echo.
118   echo ANT_HOME is not yet set.
119   echo Please make sure you have Ant version 1.7.1 or higher installed
120   echo Then set ANT_HOME to the ant installation folder
121   echo and add the path to its bin folder to the PATH
122) else (
123   echo ANT_HOME     : %ANT_HOME%
124)
125echo.
126:end
Note: See TracBrowser for help on using the browser.