Changeset 31472 for main/trunk/greenstone3
- Timestamp:
- 2017-03-08T20:23:06+13:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/gs3-setup.bat
r31471 r31472 2 2 3 3 setlocal enabledelayedexpansion 4 5 set DEBUG=false 4 6 5 7 set java_min_version=1.5.0_00 … … 90 92 91 93 :: ---- if gs2build is there, run its setup.bat file ---- 92 endlocal & set RUNJAVA=%RUNJAVA%& set PATH=%PATH%& set GSDLOS=%GSDLOS%& set GSDLHOME=%GSDLHOME%& set GSDL3HOME=%GSDL3HOME%& set GSDL3SRCHOME=%GSDL3SRCHOME%& set JAVA_HOME=%JAVA_HOME%& set JRE_HOME=%JRE_HOME%& set ANT_HOME=%ANT_HOME%& set CLASSPATH=%CLASSPATH% 94 :: http://stackoverflow.com/questions/69068/long-commands-split-over-multiple-lines-in-windows-vista-batch-bat-file 95 endlocal & set DEBUG=%DEBUG%& set RUNJAVA=%RUNJAVA%& set PATH=%PATH%& set GSDLOS=%GSDLOS%& set GSDLHOME=%GSDLHOME%& set GSDL3HOME=%GSDL3HOME%^ 96 & set GSDL3SRCHOME=%GSDL3SRCHOME%& set JAVA_HOME=%JAVA_HOME%& set JRE_HOME=%JRE_HOME%& set ANT_HOME=%ANT_HOME%& set CLASSPATH=%CLASSPATH% 93 97 94 98 if exist gs2build\setup.bat ( … … 139 143 140 144 echo. 141 echo ********************************************************************145 if "%DEBUG%" == "true" echo ******************************************************************** 142 146 143 147 rem Check if any Java found matches the bitness of the Greenstone installation's binaries … … 165 169 :: gs2build\bin\windows\wvWare.exe; PE32 executable for MS Windows (console) Intel 80386 32-bit 166 170 :: To just get the "PE32" part of that output, set the delimiter char to space and request only the 2nd token: 167 :: Note: Using call before the command to allow 2 sets of double quotes, see 171 :: Note: Using call before the command to allow 2 sets of double quotes, see 168 172 :: http://stackoverflow.com/questions/6474738/batch-file-for-f-doesnt-work-if-path-has-spaces 169 173 :: Could use shortfilenames, see http://stackoverflow.com/questions/10227144/convert-long-filename-to-short-filename-8-3-using-cmd-exe 170 if not exist "!GSDL3SRCHOME!\lib\jni\gdbmjava.dll" set bitness=UNKNOWN& goto testjavahome174 if not exist "!GSDL3SRCHOME!\lib\jni\gdbmjava.dll" set bitness=UNKNOWN& goto setupjavahome 171 175 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 172 176 … … 179 183 echo The installed Greenstone is 32 bit 180 184 ) else ( 181 echo WARNING: Greenstone installation is of unknown bitness. "%bitness%" is neither 32 nor 64 bit 185 echo WARNING: Greenstone installation is of unknown bitness. "%bitness%" is neither 32 nor 64 bit 182 186 set bitness=UNKNOWN 183 187 ) … … 195 199 if DEFINED FOUNDJAVAHOME ( 196 200 if "%bitness%" == "UNKNOWN" goto setupjavahome 197 echo ***Testing bitness of JAVA_HOME found at !FOUNDJAVAHOME!:201 if "%DEBUG%" == "true" echo Testing bitness of JAVA_HOME found at !FOUNDJAVAHOME!: 198 202 "!FOUNDJAVAHOME!\bin\java.exe" -d%bitness% -version 2> nul 199 if !ERRORLEVEL! equ 1 echo *** The detected JDK java is incompatible with !bitness! bit GS& goto testjre203 if !ERRORLEVEL! equ 1 if "%DEBUG%" == "true" echo The detected JDK java is incompatible with !bitness! bit GS& goto testjre 200 204 if !ERRORLEVEL! equ 0 ( 201 echo ***The detected JDK java is a matching %bitness% bit205 if "%DEBUG%" == "true" echo The detected JDK java is a matching %bitness% bit 202 206 goto setupjavahome 203 ) 207 ) 204 208 ) 205 209 … … 207 211 if DEFINED FOUNDJREHOME ( 208 212 if "%bitness%" == "UNKNOWN" goto setupjrehome 209 echo ***Testing bitness of JRE_HOME found at !FOUNDJREHOME!:213 if "%DEBUG%" == "true" echo Testing bitness of JRE_HOME found at !FOUNDJREHOME!: 210 214 "!FOUNDJREHOME!\bin\java.exe" -d%bitness% -version 2> nul 211 if !ERRORLEVEL! equ 1 echo ***The detected JRE java is incompatible with !bitness! bit GS& goto testbundledjre215 if !ERRORLEVEL! equ 1 if "%DEBUG%" == "true" echo The detected JRE java is incompatible with !bitness! bit GS& goto testbundledjre 212 216 if !ERRORLEVEL! equ 0 ( 213 217 rem The JRE_HOME found by search4j may be the bundled JRE, overriding any system JRE_HOME, 214 218 rem because the bundled JRE_HOME was provided as HINT to search4j. 215 echo ***The detected JRE java is a matching %bitness% bit219 if "%DEBUG%" == "true" echo The detected JRE java is a matching %bitness% bit 216 220 goto setupjrehome 217 ) 221 ) 218 222 ) 219 223 … … 222 226 if exist "!BUNDLED_JRE!\bin\java.exe" ( 223 227 if "%bitness%" == "UNKNOWN" goto bundledjre 224 225 echo *** Testing bitness of bundled JRE at !BUNDLED_JRE!: 228 if "%DEBUG%" == "true" echo Testing bitness of bundled JRE at !BUNDLED_JRE!: 226 229 "!BUNDLED_JRE!\bin\java.exe" -d%bitness% -version 2> nul 227 if !ERRORLEVEL! equ 1 echo *** The detected JRE java is incompatible with !bitness! bit& goto setupjavahome230 if !ERRORLEVEL! equ 1 if "%DEBUG%" == "true" echo The bundled JRE java is incompatible with !bitness! bit& goto setupjavahome 228 231 if !ERRORLEVEL! equ 0 ( 229 echo *** The detected JRE java is a matching %bitness% bit 232 if "%DEBUG%" == "true" echo The bundled JRE java is a matching %bitness% bit 233 echo *** Changing to use Greenstone's bundled JRE. 230 234 goto bundledjre 231 235 ) … … 236 240 :: All but MG/MGPP and GDBM should still work with 64 bit java. 237 241 if exist "!BUNDLED_JRE!\bin\java.exe" ( 238 echo *** Changing to use Greenstone's bundled jre.239 242 set JRE_HOME=!BUNDLED_JRE! 240 243 ::set JAVA_HOME=!BUNDLED_JRE! … … 249 252 :setupjavahome 250 253 if DEFINED FOUNDJAVAHOME ( 251 echo ***Using the JAVA_HOME detected at !FOUNDJAVAHOME!254 echo Using the JAVA_HOME detected at !FOUNDJAVAHOME! 252 255 set JAVA_HOME=!FOUNDJAVAHOME! 253 256 set PATH=!FOUNDJAVAHOME!\bin;!PATH! … … 257 260 258 261 :setupjrehome 259 if DEFINED FOUNDJREHOME ( 260 echo *** Using the JRE_HOME detected at !FOUNDJREHOME! 262 if DEFINED FOUNDJREHOME ( 263 if "!FOUNDJREHOME!" == "!BUNDLED_JRE!" ( 264 echo Using the bundled JRE detected at !FOUNDJREHOME! 265 ) else ( 266 echo Using the JRE detected at !FOUNDJREHOME! 267 ) 261 268 set JRE_HOME=!FOUNDJREHOME! 262 269 set PATH=!FOUNDJREHOME!\bin;!PATH! … … 265 272 ) 266 273 267 if exist "!BUNDLED_JRE!\bin\java.exe" goto bundledjre 274 if exist "!BUNDLED_JRE!\bin\java.exe" ( 275 echo Using the bundled JRE detected at !FOUNDJREHOME! 276 goto bundledjre 277 ) 268 278 269 279 :: 5. Last ditch effort: search4j couldn't find any java, but check any Java env vars set anyway 270 echo ***Search4j could not find an appropriate JDK or JRE java.271 echo ***Attempting to use any JAVA_HOME else JRE_HOME in the environment...272 280 echo Search4j could not find an appropriate JDK or JRE java. 281 echo Attempting to use any JAVA_HOME else JRE_HOME in the environment... 282 273 283 if exist "!JAVA_HOME!\bin\java.exe" ( 274 284 set PATH=!JAVA_HOME!\bin;!PATH! … … 305 315 echo *** and the Java found at !RUNJAVA!. 306 316 echo *** Continuing with this Java anyway: 307 echo *** This will only affect MG/MGPP collections for searching, and GDBM database collections 308 echo *** Else set JAVA_HOME or JRE_HOME to point to an appropriate %bitness%-bit Java 309 echo *** Or recompile GS with your system Java:317 echo *** This will only affect MG/MGPP collections for searching, and GDBM database collections. 318 echo *** Else set JAVA_HOME or JRE_HOME to point to an appropriate %bitness%-bit Java, 319 echo *** or recompile GS with your system Java: 310 320 if exist "!JAVA_HOME!" ( echo *** JAVA_HOME at !JAVA_HOME! ) else ( echo *** JRE_HOME at !JRE_HOME! ) 311 321 ) 312 322 313 323 :displayvars 314 echo ********************************************************************324 if "%DEBUG%" == "true" echo ******************************************************************** 315 325 echo. 316 326 … … 332 342 :done 333 343 :: End localisation of variables that started with the set local/set enabledelayedexpansion command 334 :: Restore global variables that would otherwise be lost at script's end due to their having been initialised in a 344 :: Restore global variables that would otherwise be lost at script's end due to their having been initialised in a 335 345 :: set local/set enabledelayedexpansion section. See http://ss64.com/nt/endlocal.html 336 endlocal & set RUNJAVA=%RUNJAVA%& set PATH=%PATH%& set GSDLOS=%GSDLOS%& set GSDLHOME=%GSDLHOME%& set GSDL3HOME=%GSDL3HOME%& set GSDL3SRCHOME=%GSDL3SRCHOME%& set JAVA_HOME=%JAVA_HOME%& set JRE_HOME=%JRE_HOME%& set ANT_HOME=%ANT_HOME%& set CLASSPATH=%CLASSPATH% 346 endlocal & set RUNJAVA=%RUNJAVA%& set PATH=%PATH%& set GSDLOS=%GSDLOS%& set GSDLHOME=%GSDLHOME%& set GSDL3HOME=%GSDL3HOME%& set GSDL3SRCHOME=%GSDL3SRCHOME%^ 347 & set JAVA_HOME=%JAVA_HOME%& set JRE_HOME=%JRE_HOME%& set ANT_HOME=%ANT_HOME%& set CLASSPATH=%CLASSPATH% 337 348 338 349 :end
Note:
See TracChangeset
for help on using the changeset viewer.