Sarah S created KNOX-1833:
-----------------------------
Summary: Knox gateway Couldn't come up when ran on koprn
Key: KNOX-1833
URL: https://issues.apache.org/jira/browse/KNOX-1833
Project: Apache Knox
Issue Type: Bug
Environment: Knox
Korn Shell
Reporter: Sarah S
{{APP_BIN_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"}}
When the script is running in KornShell, ${BASH_SOURCE[0]} is always empty and
this is because ${BASH_SOURCE[0]} is valid only for bash shell. Thus, the path
is not constructed correctly. Later on when we have any other installation
scripts running, it is unable to find gateway.sh since the Bash Source is not
inclusive of KornShell path to the gateway.sh.
However we did find a work around for it. A simple script has to be added into
the gateway.sh script. It basically checks for two kinds of shells: either Bash
or Korn and then adds the path according to whatever the type is. Here's what
the code snippet looks like:
{code:java}
if [ $SHELL == '/bin/bash' ] || [ $SHELL == '/bin/sh' ] then
THIS_SCRIPT=${BASH_SOURCE[0]} echo $THIS_SCRIPT elif [ $SHELL == '/bin/ksh' ]
then THIS_SCRIPT=${.sh.file} echo $THIS_SCRIPT else echo NO MATCH. fi
APP_BIN_DIR="$( cd "$( dirname ${THIS_SCRIPT} )" && pwd )"
{code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)