Define CATALINA_BASE fallback earlier,
authorrjung <rjung@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 21 Jun 2011 05:30:55 +0000 (05:30 +0000)
committerrjung <rjung@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 21 Jun 2011 05:30:55 +0000 (05:30 +0000)
so one can use CATALINA_BASE and CATALINA_HOME
variables in setenv without knowing, whether
the two have been split (i.e. CATALINA_BASE is
set) or not.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1137862 13f79535-47bb-0310-9956-ffa450edef68

bin/catalina.bat
bin/catalina.sh

index dbcfff8..9fa8088 100755 (executable)
@@ -109,12 +109,18 @@ cd ..
 set "CATALINA_HOME=%cd%"
 cd "%CURRENT_DIR%"
 :gotHome
+
 if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome
 echo The CATALINA_HOME environment variable is not defined correctly
 echo This environment variable is needed to run this program
 goto end
 :okHome
 
+rem Copy CATALINA_BASE from CATALINA_HOME if not defined
+if not "%CATALINA_BASE%" == "" goto gotBase
+set "CATALINA_BASE=%CATALINA_HOME%"
+:gotBase
+
 rem Ensure that any user defined CLASSPATH variables are not used on startup,
 rem but allow them to be specified in setenv.bat, in rare case when it is needed.
 set CLASSPATH=
@@ -145,10 +151,6 @@ set "CLASSPATH=%CLASSPATH%;"
 :emptyClasspath
 set "CLASSPATH=%CLASSPATH%%CATALINA_HOME%\bin\bootstrap.jar"
 
-if not "%CATALINA_BASE%" == "" goto gotBase
-set "CATALINA_BASE=%CATALINA_HOME%"
-:gotBase
-
 if not "%CATALINA_TMPDIR%" == "" goto gotTmpdir
 set "CATALINA_TMPDIR=%CATALINA_BASE%\temp"
 :gotTmpdir
index 9d069b0..f3a3801 100755 (executable)
@@ -115,6 +115,9 @@ PRGDIR=`dirname "$PRG"`
 # Only set CATALINA_HOME if not already set
 [ -z "$CATALINA_HOME" ] && CATALINA_HOME=`cd "$PRGDIR/.." >/dev/null; pwd`
 
+# Copy CATALINA_BASE from CATALINA_HOME if not already set
+[ -z "$CATALINA_BASE" ] && CATALINA_BASE="$CATALINA_HOME"
+
 # Ensure that any user defined CLASSPATH variables are not used on startup,
 # but allow them to be specified in setenv.sh, in rare case when it is needed.
 CLASSPATH=
@@ -172,10 +175,6 @@ if [ ! -z "$CLASSPATH" ] ; then
 fi
 CLASSPATH="$CLASSPATH""$CATALINA_HOME"/bin/bootstrap.jar
 
-if [ -z "$CATALINA_BASE" ] ; then
-  CATALINA_BASE="$CATALINA_HOME"
-fi
-
 if [ -z "$CATALINA_OUT" ] ; then
   CATALINA_OUT="$CATALINA_BASE"/logs/catalina.out
 fi