Changeset 31469 for main/trunk/greenstone3/gs3-setup.bat
- Timestamp:
- 2017-03-07T18:19:54+13:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/gs3-setup.bat
r31468 r31469 126 126 :: ---- Search for java ---- 127 127 set JAVA_MIN_VERSION=1.5.0_00 128 set HINT=!CD!\packages\jre 128 set BUNDLED_JRE=!CD!\packages\jre 129 set HINT=!BUNDLED_JRE! 129 130 130 131 ::if search4j is present, use it … … 167 168 :: http://stackoverflow.com/questions/6474738/batch-file-for-f-doesnt-work-if-path-has-spaces 168 169 :: Could use shortfilenames, see http://stackoverflow.com/questions/10227144/convert-long-filename-to-short-filename-8-3-using-cmd-exe 169 for /f "usebackq tokens=2 delims= " %%G IN (`call "%GSDLHOME%\bin\windows\GNUfile\bin\file.exe" "%GSDL3SRCHOME%\lib\jni\gdbmjava.dll"`) do set bitness=%%G 170 for /f "usebackq tokens=2 delims= " %%G IN (`call "%GSDLHOME%\bin\windows\GNUfile\bin\file.exe" "%GSDL3SRCHOME%\bin\search4j.exe"`) do set bitness=%%G 171 172 echo JAVAHOME: %JAVA_HOME% 173 if not "%FOUNDJAVAHOME%" == "" echo FOUNDJAVAHOME !FOUNDJAVAHOME! 174 if not "%FOUNDJREHOME%" == "" echo FOUNDJAVAHOME !FOUNDJREHOME! 170 175 171 176 if "%bitness%" == "PE32+" ( … … 177 182 echo The installed Greenstone is 32 bit 178 183 ) else ( 179 echo WARNING: Greenstone installation is of unknown bitness. "%bitness%" is neither 32 nor 64 bit & goto bundledjre184 echo WARNING: Greenstone installation is of unknown bitness. "%bitness%" is neither 32 nor 64 bit 180 185 set bitness=UNKNOWN 181 186 ) … … 192 197 :: https://ss64.com/nt/errorlevel.html 193 198 if DEFINED FOUNDJAVAHOME ( 199 if "%bitness%" == "UNKNOWN" goto setupjavahome 194 200 echo *** Testing bitness of JAVA_HOME found at !FOUNDJAVAHOME!: 195 201 "!FOUNDJAVAHOME!\bin\java.exe" -d%bitness% -version 2> nul 196 if !ERRORLEVEL! equ 1 echo *** The detected JDK java is an incompatible bit architecture& goto testjre202 if !ERRORLEVEL! equ 1 echo *** The detected JDK java is incompatible with !bitness! bit GS& goto testjre 197 203 if !ERRORLEVEL! equ 0 ( 198 204 echo *** The detected JDK java is a matching %bitness% bit … … 203 209 :testjre 204 210 if DEFINED FOUNDJREHOME ( 211 if "%bitness%" == "UNKNOWN" goto setupjrehome 205 212 echo *** Testing bitness of JRE_HOME found at !FOUNDJREHOME!: 206 213 "!FOUNDJREHOME!\bin\java.exe" -d%bitness% -version 2> nul 207 if !ERRORLEVEL! equ 1 echo *** The detected JRE java is an incompatible bit architecture& gotobundledjre214 if !ERRORLEVEL! equ 1 echo *** The detected JRE java is incompatible with !bitness! bit GS& goto testbundledjre 208 215 if !ERRORLEVEL! equ 0 ( 209 216 rem The JRE_HOME found by search4j may be the bundled JRE, overriding any system JRE_HOME, … … 215 222 216 223 :: 3. Fall back to 32 bit JRE bundled with GS 224 :testbundledjre 225 if exist "!BUNDLED_JRE!\bin\java.exe" ( 226 if "%bitness%" == "UNKNOWN" goto bundledjre 227 228 echo *** Testing bitness of bundled JRE at !BUNDLED_JRE!: 229 "!BUNDLED_JRE!\bin\java.exe" -d%bitness% -version 2> nul 230 if !ERRORLEVEL! equ 1 echo *** The detected JRE java is incompatible with !bitness! bit& goto setupjavahome 231 if !ERRORLEVEL! equ 0 ( 232 echo *** The detected JRE java is a matching %bitness% bit 233 goto bundledjre 234 ) 235 ) 236 217 237 :bundledjre 218 238 :: We bundled a 32 bit JRE, but what if GS was compiled with 64 bit Java? 219 239 :: All but MG/MGPP and GDBM should still work with 64 bit java. 220 if exist "! HINT!\bin\java.exe" (221 echo *** Changing to use Greenstone's bundled 32-bitjre.222 set JRE_HOME=! HINT!223 ::set JAVA_HOME=! HINT!240 if exist "!BUNDLED_JRE!\bin\java.exe" ( 241 echo *** Changing to use Greenstone's bundled jre. 242 set JRE_HOME=!BUNDLED_JRE! 243 ::set JAVA_HOME=!BUNDLED_JRE! 224 244 set PATH=!JRE_HOME!\bin;!PATH! 225 245 set RUNJAVA=!JRE_HOME!\bin\java.exe … … 247 267 goto summaryThenEnd 248 268 ) 269 270 if exist "!BUNDLED_JRE!\bin\java.exe" goto bundledjre 249 271 250 272 :: 5. Last ditch effort: search4j couldn't find any java, but check any Java env vars set anyway … … 280 302 :summaryThenEnd 281 303 :: 6. Check that the bitness of any Java found is appropriate and warn if it is not. 304 if "%bitness%" == "UNKNOWN" goto displayvars 282 305 "!RUNJAVA!" -d%bitness% -version 2> nul 283 306 if !ERRORLEVEL! equ 1 ( … … 291 314 ) 292 315 316 :displayvars 293 317 echo ******************************************************************** 294 318 echo.
Note:
See TracChangeset
for help on using the changeset viewer.