From 1c7cedef102ed4416c76a5e87d43b1f7f8954c39 Mon Sep 17 00:00:00 2001 From: rjung Date: Mon, 20 Jun 2011 09:26:36 +0000 Subject: [PATCH] Make Unix shell scripts for individual commands consistent. git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1137558 13f79535-47bb-0310-9956-ffa450edef68 --- bin/configtest.sh | 8 ++------ bin/digest.sh | 26 ++++++++++++++++++++------ bin/shutdown.sh | 26 ++++++++++++++++++++------ bin/startup.sh | 3 --- bin/version.sh | 28 +++++++++++++++++++++------- 5 files changed, 63 insertions(+), 28 deletions(-) diff --git a/bin/configtest.sh b/bin/configtest.sh index 597d9154a..97adde401 100755 --- a/bin/configtest.sh +++ b/bin/configtest.sh @@ -16,18 +16,15 @@ # limitations under the License. # ----------------------------------------------------------------------------- -# configtest for the CATALINA Server +# Configuration Test Script for the CATALINA Server # -# $Id: configtest.sh $ +# $Id$ # ----------------------------------------------------------------------------- # Better OS/400 detection: see Bugzilla 31132 os400=false -darwin=false case "`uname`" in -CYGWIN*) cygwin=true;; OS400*) os400=true;; -Darwin*) darwin=true;; esac # resolve links - $0 may be a softlink @@ -63,4 +60,3 @@ else fi exec "$PRGDIR"/"$EXECUTABLE" configtest "$@" - diff --git a/bin/digest.sh b/bin/digest.sh index 2bffe2aed..73972656e 100755 --- a/bin/digest.sh +++ b/bin/digest.sh @@ -21,6 +21,12 @@ # $Id$ # ----------------------------------------------------------------------------- +# Better OS/400 detection: see Bugzilla 31132 +os400=false +case "`uname`" in +OS400*) os400=true;; +esac + # resolve links - $0 may be a softlink PRG="$0" @@ -38,11 +44,19 @@ PRGDIR=`dirname "$PRG"` EXECUTABLE=tool-wrapper.sh # Check that target executable exists -if [ ! -x "$PRGDIR"/"$EXECUTABLE" ]; then - echo "Cannot find $PRGDIR/$EXECUTABLE" - echo "The file is absent or does not have execute permission" - echo "This file is needed to run this program" - exit 1 -fi +if $os400; then + # -x will Only work on the os400 if the files are: + # 1. owned by the user + # 2. owned by the PRIMARY group of the user + # this will not work if the user belongs in secondary groups + eval +else + if [ ! -x "$PRGDIR"/"$EXECUTABLE" ]; then + echo "Cannot find $PRGDIR/$EXECUTABLE" + echo "The file is absent or does not have execute permission" + echo "This file is needed to run this program" + exit 1 + fi +fi exec "$PRGDIR"/"$EXECUTABLE" -server org.apache.catalina.realm.RealmBase "$@" diff --git a/bin/shutdown.sh b/bin/shutdown.sh index 0aa93ef35..6117c57df 100755 --- a/bin/shutdown.sh +++ b/bin/shutdown.sh @@ -21,6 +21,12 @@ # $Id$ # ----------------------------------------------------------------------------- +# Better OS/400 detection: see Bugzilla 31132 +os400=false +case "`uname`" in +OS400*) os400=true;; +esac + # resolve links - $0 may be a softlink PRG="$0" @@ -38,11 +44,19 @@ PRGDIR=`dirname "$PRG"` EXECUTABLE=catalina.sh # Check that target executable exists -if [ ! -x "$PRGDIR"/"$EXECUTABLE" ]; then - echo "Cannot find $PRGDIR/$EXECUTABLE" - echo "The file is absent or does not have execute permission" - echo "This file is needed to run this program" - exit 1 -fi +if $os400; then + # -x will Only work on the os400 if the files are: + # 1. owned by the user + # 2. owned by the PRIMARY group of the user + # this will not work if the user belongs in secondary groups + eval +else + if [ ! -x "$PRGDIR"/"$EXECUTABLE" ]; then + echo "Cannot find $PRGDIR/$EXECUTABLE" + echo "The file is absent or does not have execute permission" + echo "This file is needed to run this program" + exit 1 + fi +fi exec "$PRGDIR"/"$EXECUTABLE" stop "$@" diff --git a/bin/startup.sh b/bin/startup.sh index 1e2e76fb2..0cdcbf64b 100755 --- a/bin/startup.sh +++ b/bin/startup.sh @@ -23,11 +23,8 @@ # Better OS/400 detection: see Bugzilla 31132 os400=false -darwin=false case "`uname`" in -CYGWIN*) cygwin=true;; OS400*) os400=true;; -Darwin*) darwin=true;; esac # resolve links - $0 may be a softlink diff --git a/bin/version.sh b/bin/version.sh index 07ee7f30a..c11b4d7a5 100755 --- a/bin/version.sh +++ b/bin/version.sh @@ -21,6 +21,12 @@ # $Id$ # ----------------------------------------------------------------------------- +# Better OS/400 detection: see Bugzilla 31132 +os400=false +case "`uname`" in +OS400*) os400=true;; +esac + # resolve links - $0 may be a softlink PRG="$0" @@ -33,16 +39,24 @@ while [ -h "$PRG" ] ; do PRG=`dirname "$PRG"`/"$link" fi done - + PRGDIR=`dirname "$PRG"` EXECUTABLE=catalina.sh # Check that target executable exists -if [ ! -x "$PRGDIR"/"$EXECUTABLE" ]; then - echo "Cannot find $PRGDIR/$EXECUTABLE" - echo "The file is absent or does not have execute permission" - echo "This file is needed to run this program" - exit 1 -fi +if $os400; then + # -x will Only work on the os400 if the files are: + # 1. owned by the user + # 2. owned by the PRIMARY group of the user + # this will not work if the user belongs in secondary groups + eval +else + if [ ! -x "$PRGDIR"/"$EXECUTABLE" ]; then + echo "Cannot find $PRGDIR/$EXECUTABLE" + echo "The file is absent or does not have execute permission" + echo "This file is needed to run this program" + exit 1 + fi +fi exec "$PRGDIR"/"$EXECUTABLE" version "$@" -- 2.11.0