Changeset 15071


Ignore:
Timestamp:
2008-03-07T15:06:04+13:00 (14 years ago)
Author:
oranfry
Message:

checking in two very simplified gs3 scripts and a grain of salt

File:
1 edited

Legend:

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

    r15051 r15071  
    11@echo off
    22
    3 ::get user defined environment variable
    4 set JRE_HOME=
    5 set JAVA_HOME=
    6 set CLASSPATH=
     3if exist machine.bat call machine.bat
    74
    85if exist gs3-setup.bat goto start
     
    129:start
    1310:: ---- Set the GSDL3HOME variable to the current directory ----
    14 cd | winutil\setvar.exe GSDL3SRCHOME > setgsdl3.bat
    15 call setgsdl3.bat
    16 del setgsdl3.bat
    17 echo GSDL3SRCHOME: %GSDL3SRCHOME%
     11cd | winutil\setvar.exe GSDL3SRCHOME > %SystemRoot%\Temp\setgsdl3.bat
     12call %SystemRoot%\Temp\setgsdl3.bat
     13del %SystemRoot%\Temp\setgsdl3.bat
    1814set GSDL3HOME=%GSDL3SRCHOME%\web
    19 echo GSDL3HOME: %GSDL3HOME%
    2015
    2116:: change if using external tomcat
     
    2722
    2823:: ---- Set the CLASSPATH environment variable ----
     24if "%GS_CP_SET%" == "yes" goto skipSetCp
    2925set CLASSPATH=.;%GSDL3HOME%\WEB-INF\classes;%GSDL3SRCHOME%\resources\java;%CLASSPATH%
    30 if exist setcp.bat del setcp.bat
    31 for %%j in ("%GSDL3SRCHOME%"\*.jar) do echo set CLASSPATH=%%CLASSPATH%%;%%j>> setcp.bat
    32 for %%j in ("%GSDL3HOME%"\WEB-INF\lib\*.jar) do echo set CLASSPATH=%%CLASSPATH%%;%%j>> setcp.bat
    33 for %%j in ("%GSDL3SRCHOME%"\lib\jni\*.jar) do echo set CLASSPATH=%%CLASSPATH%%;%%j>> setcp.bat
    34 for %%j in ("%TOMCAT_HOME%"\common\endorsed\*.jar) do echo set CLASSPATH=%%CLASSPATH%%;%%j>> setcp.bat
    35 for %%j in ("%GSDL3SRCHOME%"\build\*.jar) do echo set CLASSPATH=%%CLASSPATH%%;%%j>> setcp.bat
     26if exist %SystemRoot%\Temp\setcp.bat del %SystemRoot%\Temp\setcp.bat
     27for %%j in ("%GSDL3SRCHOME%"\*.jar) do echo set CLASSPATH=%%CLASSPATH%%;%%j>> %SystemRoot%\Temp\setcp.bat
     28for %%j in ("%GSDL3HOME%"\WEB-INF\lib\*.jar) do echo set CLASSPATH=%%CLASSPATH%%;%%j>> %SystemRoot%\Temp\setcp.bat
     29for %%j in ("%GSDL3SRCHOME%"\lib\jni\*.jar) do echo set CLASSPATH=%%CLASSPATH%%;%%j>> %SystemRoot%\Temp\setcp.bat
     30for %%j in ("%TOMCAT_HOME%"\common\endorsed\*.jar) do echo set CLASSPATH=%%CLASSPATH%%;%%j>> %SystemRoot%\Temp\setcp.bat
     31for %%j in ("%GSDL3SRCHOME%"\build\*.jar) do echo set CLASSPATH=%%CLASSPATH%%;%%j>> %SystemRoot%\Temp\setcp.bat
     32call %SystemRoot%\Temp\setcp.bat
     33del %SystemRoot%\Temp\setcp.bat
     34:skipSetCp
    3635
    37 call setcp.bat
    38 del setcp.bat
     36winutil\launcher.exe -find | winutil\setvar.exe _JRE_HOME > %SystemRoot%\Temp\set_jre_home.bat
     37call %SystemRoot%\Temp\set_jre_home.bat
     38del %SystemRoot%\Temp\set_jre_home.bat
    3939
    40 goto findJREHOME
     40echo %_JRE_HOME%\bin\java.exe | winutil\setvar.exe RUNJAVA > %SystemRoot%\Temp\setrunjava.bat
     41call %SystemRoot%\Temp\setrunjava.bat
     42del %SystemRoot%\Temp\setrunjava.bat
    4143
    42 :: ---- Check JRE_HOME ----
    43 :findJREHOME
    44 if not "%JRE_HOME%" == "" goto testJREHOME
    45    goto findJREHOME2     
     44if "%JRE_HOME%" == "" set JRE_HOME=%_JRE_HOME%
    4645
    47 ::---- try JREHOME ----
    48 :findJREHOME2
    49 if "%JREHOME%" == "" goto findJAVAHOME 
    50    set JRE_HOME=%JREHOME%
    51    testJREHOME
    52 
    53 ::test JRE_HOME is set correctly
    54 :testJREHOME
    55 if exist "%JRE_HOME%\bin\java.exe" goto gotJREHOME
    56    echo JRE_HOME: "%JRE_HOME%" 
    57    echo Couldn't find "%JRE_HOME%\bin\java.exe"
    58    echo The JRE_HOME environment variable is not defined correctly
    59    echo This environment variable is needed to run this program
    60    goto pauseANdExit   
    61 
    62 
    63 ::set the RUNJAVA and exit
    64 :gotJREHOME
    65  set RUNJAVA=%JRE_HOME%\bin\java.exe
    66  set PATH=%JRE_HOME%\bin;%PATH%
    67  echo JRE_HOME: "%JRE_HOME%"
    68  echo Your environment has successfully been set up to run Greenstone3
    69  goto exit
    70 
    71 
    72 :: ---- check JAVA_HOME ----
    73 :findJAVAHOME
    74 if not "%JAVA_HOME%" == "" goto testJAVAHOME
    75    goto findJAVAHOME2
    76 
    77  
    78 ::---- check JAVAHOME ----
    79 :findJAVAHOME2
    80 if "%JAVAHOME%" == "" goto noJAVAHOME 
    81    set JAVA_HOME=%JAVAHOME%
    82    testJAVAHOME
    83 
    84 
    85 :: test JAVA_HOME is set Correctly
    86 :testJAVAHOME
    87 if not exist "%JAVA_HOME%\bin\java.exe" goto wrongJAVAHOME
    88 if not exist "%JAVA_HOME%\bin\javac.exe" goto wrongJAVAHOME2
    89 goto gotJAVAHOME
    90 
    91 
    92 :wrongJAVAHOME
    93 echo JAVA_HOME: "%JAVA_HOME%"
    94 echo Couldn't find "%JAVA_HOME%\bin\java.exe"
    95 echo The JAVA_HOME environment variable is not defined correctly
    96 echo This environment variable is needed to run this program
    97 goto pauseANdExit 
    98 
    99 :wrongJAVAHOME2
    100 echo JAVA_HOME: "%JAVA_HOME%"
    101 echo Couldn't find "%JAVA_HOME%\bin\javac.exe"
    102 echo The JAVA_HOME environment variable is not defined correctly
    103 echo This environment variable is needed to run this program
    104 echo NB: JAVA_HOME should point to a JDK not a JRE
    105 goto pauseANdExit
    106 
    107 ::set the RUNJAVA and exit
    108 :gotJAVAHOME
    109  set RUNJAVA=%JAVA_HOME%\bin\java.exe
    110  set PATH=%JAVA_HOME%\bin;%PATH%
    111  echo JAVA_HOME: "%JAVA_HOME%"
    112  echo Your environment has successfully been set up to run Greenstone3
    113  goto exit
    114 
    115 ::try find java on the search path
    116 :noJAVAHOME
    117 :: Check if Java is on the search path
    118  echo %PATH%| winutil\which.exe java.exe | winutil\setvar.exe JAVAPATH > setjava.bat
    119  call setjava.bat
    120  del setjava.bat
    121 
    122 if exist "%JAVAPATH%\bin\java.exe" goto gotJava
    123  :: Still haven't found anything, so try looking in the registry (gulp!)
    124   type nul > jdk.reg
    125   regedit /E jdk.reg "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit"
    126   type jdk.reg > jdk.txt
    127   del jdk.reg
    128   type nul > jre.reg
    129   regedit /E jre.reg "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment"
    130   type jre.reg > jre.txt
    131   del jre.reg
    132 
    133   winutil\findjava.exe jdk.txt jre.txt | winutil\setvar.exe JAVAPATH > setjava.bat
    134   del jdk.txt
    135   del jre.txt
    136   call setjava.bat
    137   del setjava.bat
    138 
    139   :: If nothing was found in the registry, we're stuck
    140   if "%JAVAPATH%" == "" goto noJava
    141     goto gotJava
    142 
    143 :gotJava
    144   set JRE_HOME=%JAVAPATH%
    145   goto testJREHOME
    146 
    147 
    148 :noJava
    149     echo Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
    150     echo At least one of these environment variable is needed to run Greenstone3 
    151     echo You must install a Java Run Environment (version 1.4 or greater)
    152     echo and set the JRE_HOME environment variable before running the
    153     echo Greenstone 3 Digital Library Software.
    154     pause
    155     goto exit
    156 
    157 :pauseAndExit
    158  pause
    159  goto exit
    160  
    161 :exit
    162 
    163 
    164 
     46echo GSDL3SRCHOME : %GSDL3SRCHOME%
     47echo GSDL3HOME    : %GSDL3HOME%
     48echo JVM          : %RUNJAVA%
Note: See TracChangeset for help on using the changeset viewer.