Changeset 22069

Show
Ignore:
Timestamp:
10.05.2010 17:58:31 (9 years ago)
Author:
ak19
Message:

1. Fixed bug that Dr Nichols found where RUNJAVA wasn't been passed on to gs3-server.bat. Needed to redo the set operation on RUNJAVA in combination with the endlocal command, otherwise it didn't seem to work (for other variables this was not necessary). 2. Moved set enabledelayedexpansion to the top of the file so that any other uses of filepaths in variables could be referred to with the recent changeover to exclamation marks instead of percent signs (for dealing with whitespaces in filepaths).

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/gs3-setup.bat

    r22024 r22069  
    11@echo off 
     2 
     3setlocal enabledelayedexpansion 
    24 
    35set java_min_version=1.5.0_00 
     
    1113 
    1214:: this is the default 
    13 :: greenstone3 (%GSDL3SRCHOME%) 
    14 :: +-- web (%GSDL3HOME%) 
     15:: greenstone3 (!GSDL3SRCHOME!) 
     16:: +-- web (!GSDL3HOME!) 
    1517:: +-- packages 
    16 ::      +-- tomcat (%TOMCAT_HOME%) 
    17 ::      +-- ant (%ANT_HOME%) 
     18::      +-- tomcat (!TOMCAT_HOME!) 
     19::      +-- ant (!ANT_HOME!) 
    1820 
    1921:: set GSDLSRCHOME to the current directory 
    20 cd | winutil\setvar.exe GSDL3SRCHOME > %TMP%\setgsdl3.bat 
    21 call %TMP%\setgsdl3.bat 
    22 del %TMP%\setgsdl3.bat 
     22cd | winutil\setvar.exe GSDL3SRCHOME > !TMP!\setgsdl3.bat 
     23call !TMP!\setgsdl3.bat 
     24del !TMP!\setgsdl3.bat 
    2325 
    2426:: set GSDLHOME to the 'web' subdirectory 
    25 set GSDL3HOME=%GSDL3SRCHOME%\web 
     27set GSDL3HOME=!GSDL3SRCHOME!\web 
    2628 
    2729:: change if using external tomcat or ant 
    28 set TOMCAT_HOME=%GSDL3SRCHOME%\packages\tomcat 
    29 if exist "%GSDL3SRCHOME%\packages\ant\*.*" set ANT_HOME=%GSDL3SRCHOME%\packages\ant 
     30set TOMCAT_HOME=!GSDL3SRCHOME!\packages\tomcat 
     31if exist "!GSDL3SRCHOME!\packages\ant\*.*" set ANT_HOME=!GSDL3SRCHOME!\packages\ant 
    3032 
    3133:: other important environment variables 
     
    3335 
    3436:: ---- Set the CLASSPATH and PATH environment variables ---- 
    35 if "%GS_CP_SET%" == "yes" goto skipSetCp 
    36 set CLASSPATH=%GSDL3HOME%\WEB-INF\classes;%GSDL3SRCHOME%\resources\java;%GSDL3SRCHOME%\cp.jar;%CLASSPATH%; 
    37 set PATH=%PATH%;%GSDL3SRCHOME%\bin;%GSDL3SRCHOME%\bin\script;%GSDL3SRCHOME%\lib\jni;%ANT_HOME%\bin 
     37if "!GS_CP_SET!" == "yes" goto skipSetCp 
     38set CLASSPATH=!GSDL3HOME!\WEB-INF\classes;!GSDL3SRCHOME!\resources\java;!GSDL3SRCHOME!\cp.jar;!CLASSPATH!; 
     39set PATH=!PATH!;!GSDL3SRCHOME!\bin;!GSDL3SRCHOME!\bin\script;!GSDL3SRCHOME!\lib\jni;!ANT_HOME!\bin 
    3840 
    3941:: Override Imagemagick and Ghostscript paths to the bundled applications shipped with greenstone if they exists otherwise use default environment variables. 
    40 if exist "%GSDL3SRCHOME%\gs2build\bin\windows\ghostscript\bin\gsdll32.dll" set GS_DLL=%GSDL3SRCHOME%\gs2build\bin\windows\ghostscript\bin\gsdll32.dll 
    41 if exist "%GSDL3SRCHOME%\gs2build\bin\windows\ghostscript\lib\*.*" set GS_LIB=%GSDL3SRCHOME%\gs2build\bin\windows\ghostscript\lib 
    42 if exist "%GSDL3SRCHOME%\gs2build\bin\windows\ghostscript\bin\*.*" set PATH=%GSDL3SRCHOME%\gs2build\bin\windows\ghostscript\bin;%PATH% 
    43 if exist "%GSDL3SRCHOME%\gs2build\bin\windows\imagemagick\*.*" set PATH=%GSDL3SRCHOME%\gs2build\bin\windows\imagemagick;%PATH% 
     42if exist "!GSDL3SRCHOME!\gs2build\bin\windows\ghostscript\bin\gsdll32.dll" set GS_DLL=!GSDL3SRCHOME!\gs2build\bin\windows\ghostscript\bin\gsdll32.dll 
     43if exist "!GSDL3SRCHOME!\gs2build\bin\windows\ghostscript\lib\*.*" set GS_LIB=!GSDL3SRCHOME!\gs2build\bin\windows\ghostscript\lib 
     44if exist "!GSDL3SRCHOME!\gs2build\bin\windows\ghostscript\bin\*.*" set PATH=!GSDL3SRCHOME!\gs2build\bin\windows\ghostscript\bin;!PATH! 
     45if exist "!GSDL3SRCHOME!\gs2build\bin\windows\imagemagick\*.*" set PATH=!GSDL3SRCHOME!\gs2build\bin\windows\imagemagick;!PATH! 
    4446 
    4547:: a little dynamic set cp stuff 
    46 if exist %TMP%\setcp.bat del %TMP%\setcp.bat 
    47 for %%j in ("%TOMCAT_HOME%"\common\endorsed\*.jar) do echo set CLASSPATH=%%CLASSPATH%%;%%j>> %TMP%\setcp.bat 
    48 for %%j in ("%TOMCAT_HOME%"\lib\*.jar) do echo set CLASSPATH=%%CLASSPATH%%;%%j>> %TMP%\setcp.bat 
    49 if exist %TMP%\setcp.bat call %TMP%\setcp.bat 
    50 if exist %TMP%\setcp.bat del %TMP%\setcp.bat 
     48if exist !TMP!\setcp.bat del !TMP!\setcp.bat 
     49for %%j in (!TOMCAT_HOME!\common\endorsed\*.jar) do echo set CLASSPATH=%%CLASSPATH%%;%%j>> !TMP!\setcp.bat 
     50for %%j in (!TOMCAT_HOME!\lib\*.jar) do echo set CLASSPATH=%%CLASSPATH%%;%%j>> !TMP!\setcp.bat 
     51if exist !TMP!\setcp.bat call !TMP!\setcp.bat 
     52if exist !TMP!\setcp.bat del !TMP!\setcp.bat 
    5153 
    5254set GS_CP_SET=yes 
     
    8385:: ---- Search for java ---- 
    8486set JAVA_MIN_VERSION=1.5.0_00 
    85 set HINT=%CD%\packages\jre 
     87set HINT=!CD!\packages\jre 
    8688::if search4j is present, use it 
    8789set FOUNDJAVAHOME= 
    8890set RUNJAVA= 
    8991if 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  for /F "tokens=*" %%r in ('bin\search4j.exe -d -p "!HINT!" -m !JAVA_MIN_VERSION!') do set FOUNDJAVAHOME=%%r 
     93  for /F "tokens=*" %%r in ('bin\search4j.exe -r -p "!HINT!" -m !JAVA_MIN_VERSION!') do set FOUNDJREHOME=%%r 
    9294) 
    93  
    94 setlocal enabledelayedexpansion 
    9595 
    9696if DEFINED FOUNDJAVAHOME  ( 
     
    108108) 
    109109 
    110 if exist "%HINT%\bin\java.exe" ( 
    111   set JAVA_HOME=%HINT% 
    112   set PATH=%JAVA_HOME%\bin;%PATH% 
    113   set RUNJAVA=%JAVA_HOME%\bin\java.exe 
     110if exist "!HINT!\bin\java.exe" ( 
     111  set JAVA_HOME=!HINT! 
     112  set PATH=!JAVA_HOME!\bin;!PATH! 
     113  set RUNJAVA=!JAVA_HOME!\bin\java.exe 
    114114  goto summaryThenEnd 
    115115) 
    116116 
    117 if exist "%JAVA_HOME%\bin\java.exe" ( 
    118   set PATH=%JAVA_HOME%\bin;%PATH% 
    119   set RUNJAVA=%JAVA_HOME%\bin\java.exe 
    120   echo Using java at %JAVA_HOME% 
     117if exist "!JAVA_HOME!\bin\java.exe" ( 
     118  set PATH=!JAVA_HOME!\bin;!PATH! 
     119  set RUNJAVA=!JAVA_HOME!\bin\java.exe 
     120  echo Using java at !JAVA_HOME! 
    121121  echo WARNING: Greenstone has not checked the version number of this java installation 
    122122  echo          The source distribution of Greenstone3 requires java 1.5 or greater 
     
    125125) 
    126126 
    127 if exist "%JRE_HOME%\bin\java.exe" ( 
    128   set PATH=%JRE_HOME%\bin;%PATH% 
    129   set RUNJAVA=%JRE_HOME%\bin\java.exe 
    130   echo Using java at %JRE_HOME% 
     127if exist "!JRE_HOME!\bin\java.exe" ( 
     128  set PATH=!JRE_HOME!\bin;!PATH! 
     129  set RUNJAVA=!JRE_HOME!\bin\java.exe 
     130  echo Using java at !JRE_HOME! 
    131131  echo WARNING: Greenstone has not checked the version number of this java installation 
    132132  echo          The source distribution of Greenstone3 requires java 1.5 or greater 
     
    141141:summaryThenEnd 
    142142 
    143 echo GSDL3SRCHOME : %GSDL3SRCHOME% 
    144 echo GSDL3HOME    : %GSDL3HOME% 
    145 echo JAVA         : %RUNJAVA% 
     143echo GSDL3SRCHOME : !GSDL3SRCHOME! 
     144echo GSDL3HOME    : !GSDL3HOME! 
     145echo JAVA         : !RUNJAVA! 
    146146if "!ANT_HOME!" == "" ( 
    147147   echo. 
     
    155155echo. 
    156156 
    157 endlocal 
     157:: End localisation of variables that started with the set local/set enabledelayedexpansion command 
     158:: Restore global variables that would otherwise be lost at script's end due to their having been initialised in a  
     159:: set local/set enabledelayedexpansion section. See http://ss64.com/nt/endlocal.html 
     160endlocal & set RUNJAVA=%RUNJAVA% 
    158161 
    159162set PATH=%PATH% 
     
    163166set JRE_HOME=%JRE_HOME% 
    164167set ANT_HOME=%ANT_HOME% 
     168set RUNJAVA=%RUNJAVA% 
    165169 
    166170:end