root/main/trunk/greenstone3/gs3-setup.bat @ 21320

Revision 21320, 5.0 KB (checked in by davidb, 10 years ago)

setup now automatically runs gs2build's setup file if the directory is present

  • 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:: ---- if gs2build is there, run its setup.bat file ----
56
57if exist gs2build\setup.bat (
58  echo.
59  echo Running gs2build\setup.bat
60  cd gs2build
61  call setup.bat
62  cd ..
63)
64
65:: ---- Check for any setup files in ext or local folders ----
66if exist ext (
67    for /D %%e IN ("ext/*") do (
68        cd ext\%%e
69        if EXIST setup.bat call setup.bat
70        cd ..\..
71    )
72)
73
74
75if exist local\gs3-setup.bat (
76  echo.
77  echo Running local\gs3-setup.bat
78  cd local
79  call gs3-setup.bat
80  cd ..
81)
82
83:: ---- Search for java ----
84set JAVA_MIN_VERSION=1.5.0_00
85set HINT=%CD%\packages\jre
86::if search4j is present, use it
87set FOUNDJAVAHOME=
88set RUNJAVA=
89if exist bin\search4j.exe (
90  for /F "tokens=*" %%r in ('bin\search4j.exe -d -p "%HINT%" -m %JAVA_MIN_VERSION%') do set FOUNDJAVAHOME=%%r
91  for /F "tokens=*" %%r in ('bin\search4j.exe -r -p "%HINT%" -m %JAVA_MIN_VERSION%') do set FOUNDJREHOME=%%r
92)
93
94if not "%FOUNDJAVAHOME%"=="" (
95  set JAVA_HOME=%FOUNDJAVAHOME%
96  set PATH=%FOUNDJAVAHOME%\bin;%PATH%
97  set RUNJAVA=%FOUNDJAVAHOME%\bin\java.exe
98  goto summaryThenEnd
99)
100
101if not "%FOUNDJREHOME%"=="" (
102  set JRE_HOME=%FOUNDJREHOME%
103  set PATH=%FOUNDJREHOME%\bin;%PATH%
104  set RUNJAVA=%FOUNDJREHOME%\bin\java.exe
105  goto summaryThenEnd
106)
107
108if exist "%HINT%\bin\java.exe" (
109  set JAVA_HOME=%HINT%
110  set PATH=%JAVA_HOME%\bin;%PATH%
111  set RUNJAVA=%JAVA_HOME%\bin\java.exe
112  goto summaryThenEnd
113)
114
115if exist "%JAVA_HOME%\bin\java.exe" (
116  set PATH=%JAVA_HOME%\bin;%PATH%
117  set RUNJAVA=%JAVA_HOME%\bin\java.exe
118  echo Using java at %JAVA_HOME%
119  echo WARNING: Greenstone has not checked the version number of this java installation
120  echo          The source distribution of Greenstone3 requires java 1.5 or greater
121  echo          SVN users may still use java 1.4
122  goto summaryThenEnd
123)
124
125if exist "%JRE_HOME%\bin\java.exe" (
126  set PATH=%JRE_HOME%\bin;%PATH%
127  set RUNJAVA=%JRE_HOME%\bin\java.exe
128  echo Using java at %JRE_HOME%
129  echo WARNING: Greenstone has not checked the version number of this java installation
130  echo          The source distribution of Greenstone3 requires java 1.5 or greater
131  echo          SVN users may still use java 1.4
132  goto summaryThenEnd
133)
134
135echo ERROR: Failed to locate java
136echo        Please set JAVA_HOME or JRE_HOME to point to an appropriate java
137goto end
138
139:summaryThenEnd
140
141echo GSDL3SRCHOME : %GSDL3SRCHOME%
142echo GSDL3HOME    : %GSDL3HOME%
143echo JAVA         : %RUNJAVA%
144if "%ANT_HOME%" == "" (
145   echo.
146   echo ANT_HOME is not yet set.
147   echo Please make sure you have Ant version 1.7.1 or higher installed
148   echo Then set ANT_HOME to the ant installation folder
149   echo and add the path to its bin folder to the PATH
150) else (
151   echo ANT_HOME     : %ANT_HOME%
152)
153echo.
154:end
Note: See TracBrowser for help on using the browser.