components/tomcat/patches/env.patch
author Petr Sumbera <petr.sumbera@oracle.com>
Wed, 02 Nov 2016 06:19:13 -0700
branchs11u3-sru
changeset 7317 bd14d5a59818
parent 4134 b1148b9ffd9b
permissions -rw-r--r--
25033828 Upgrade Apache Tomcat to version 6.0.47 25027840 problem in UTILITY/TOMCAT

Patch origin: in-house
Patch status: Solaris-specific; not suitable for upstream

Support for setenv.sh in $CATALINA_BASE/conf.
Set default Java version (can be overwritten e.g. via setenv.sh).

--- bin/catalina.sh
+++ bin/catalina.sh
@@ -101,6 +101,7 @@
 OS400*) os400=true;;
 Darwin*) darwin=true;;
 HP-UX*) hpux=true;;
+SunOS*) solaris=true;;
 esac
 
 # resolve links - $0 may be a softlink
@@ -129,7 +130,13 @@
 # but allow them to be specified in setenv.sh, in rare case when it is needed.
 CLASSPATH=
 
-if [ -r "$CATALINA_BASE/bin/setenv.sh" ]; then
+# On Solaris we install Tomcat into two different locations
+# (CATALINA_HOME, CATALINA_BASE). CATALINA_HOME can be on read only
+# location and CATALINA_BASE doesn't contain bin directory. Therefore we
+# will look for setenv.sh file in CATALINA_BASE/conf directory first.
+if [ -r "$CATALINA_BASE/conf/setenv.sh" ]; then
+  . "$CATALINA_BASE/conf/setenv.sh"
+elif [ -r "$CATALINA_BASE/bin/setenv.sh" ]; then
   . "$CATALINA_BASE/bin/setenv.sh"
 elif [ -r "$CATALINA_HOME/bin/setenv.sh" ]; then
   . "$CATALINA_HOME/bin/setenv.sh"
@@ -156,6 +163,11 @@
   export QIBM_MULTI_THREADED=Y
 fi
 
+# For Solaris
+if $solaris; then
+  [ -z "$JAVA_HOME" ] && JAVA_HOME=/usr/jdk/instances/jdk1.8.0
+fi
+
 # Get standard Java environment variables
 if $os400; then
   # -r will Only work on the os400 if the files are:
--- bin/tool-wrapper.sh
+++ bin/tool-wrapper.sh
@@ -33,8 +33,10 @@
 
 # OS specific support.  $var _must_ be set to either true or false.
 cygwin=false
+solaris=false
 case "`uname`" in
 CYGWIN*) cygwin=true;;
+SunOS*) solaris=true;;
 esac
 
 # resolve links - $0 may be a softlink
@@ -58,8 +60,16 @@
 # but allow them to be specified in setenv.sh, in rare case when it is needed.
 CLASSPATH=
 
-if [ -r "$CATALINA_HOME"/bin/setenv.sh ]; then
-  . "$CATALINA_HOME"/bin/setenv.sh
+# On Solaris we install Tomcat into two different locations
+# (CATALINA_HOME, CATALINA_BASE). CATALINA_HOME can be on read only
+# location and CATALINA_BASE doesn't contain bin directory. Therefore we
+# will look for setenv.sh file in CATALINA_BASE/conf directory first.
+if [ -r "$CATALINA_BASE/conf/setenv.sh" ]; then
+  . "$CATALINA_BASE/conf/setenv.sh"
+elif [ -r "$CATALINA_BASE/bin/setenv.sh" ]; then
+  . "$CATALINA_BASE/bin/setenv.sh"
+elif [ -r "$CATALINA_HOME/bin/setenv.sh" ]; then
+  . "$CATALINA_HOME/bin/setenv.sh"
 fi
 
 # For Cygwin, ensure paths are in UNIX format before anything is touched
@@ -69,6 +79,11 @@
   [ -n "$CLASSPATH" ] && CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
 fi
 
+# For Solaris
+if $solaris; then
+  [ -z "$JAVA_HOME" ] && JAVA_HOME=/usr/jdk/instances/jdk1.8.0
+fi
+
 # Get standard Java environment variables
 if [ -r "$CATALINA_HOME"/bin/setclasspath.sh ]; then
   BASEDIR="$CATALINA_HOME"