home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
- # -----------------------------------------------------------------------------
- # Wrapper script for command line tools
- #
- # Environment Variable Prequisites
- #
- # CATALINA_HOME May point at your Catalina "build" directory.
- #
- # TOOL_OPTS (Optional) Java runtime options used when the "start",
- # "stop", or "run" command is executed.
- #
- # JAVA_HOME Must point at your Java Development Kit installation.
- #
- # JAVA_OPTS (Optional) Java runtime options used when the "start",
- # "stop", or "run" command is executed.
- #
- # $Id: tool-wrapper.sh,v 1.4 2004/03/01 16:00:53 remm Exp $
- # -----------------------------------------------------------------------------
-
- # OS specific support. $var _must_ be set to either true or false.
- cygwin=false
- case "`uname`" in
- CYGWIN*) cygwin=true;;
- esac
-
- # resolve links - $0 may be a softlink
- PRG="$0"
-
- while [ -h "$PRG" ]; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '.*/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`/"$link"
- fi
- done
-
- # Get standard environment variables
- PRGDIR=`dirname "$PRG"`
- CATALINA_HOME=`cd "$PRGDIR/.." ; pwd`
- if [ -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
- if $cygwin; then
- [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
- [ -n "$CATALINA_HOME" ] && CATALINA_HOME=`cygpath --unix "$CATALINA_HOME"`
- [ -n "$CLASSPATH" ] && CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
- fi
-
- # Get standard Java environment variables
- if [ -r "$CATALINA_HOME"/bin/setclasspath.sh ]; then
- BASEDIR="$CATALINA_HOME"
- . "$CATALINA_HOME"/bin/setclasspath.sh
- else
- echo "Cannot find $CATALINA_HOME/bin/setclasspath.sh"
- echo "This file is needed to run this program"
- exit 1
- fi
-
- # Add on extra jar files to CLASSPATH
- CLASSPATH="$CLASSPATH":"$CATALINA_HOME"/bin/bootstrap.jar:"$BASEDIR"/common/lib/jmx.jar
-
- # For Cygwin, switch paths to Windows format before running java
- if $cygwin; then
- JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
- CATALINA_HOME=`cygpath --path --windows "$CATALINA_HOME"`
- CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
- fi
-
- # ----- Execute The Requested Command -----------------------------------------
-
- exec "$_RUNJAVA" $JAVA_OPTS $TOOL_OPTS \
- -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \
- -Dcatalina.home="$CATALINA_HOME" \
- org.apache.catalina.startup.Tool "$@"
-