You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@knox.apache.org by "Sarah S (JIRA)" <ji...@apache.org> on 2019/03/22 20:42:00 UTC

[jira] [Updated] (KNOX-1833) Knox gateway Couldn't come up when ran on Korn Shell

     [ https://issues.apache.org/jira/browse/KNOX-1833?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sarah S updated KNOX-1833:
--------------------------
    Component/s: KnoxShell

> Knox gateway Couldn't come up when ran on Korn Shell 
> -----------------------------------------------------
>
>                 Key: KNOX-1833
>                 URL: https://issues.apache.org/jira/browse/KNOX-1833
>             Project: Apache Knox
>          Issue Type: Improvement
>          Components: KnoxShell
>    Affects Versions: 1.2.0, 1.3.0
>         Environment: Knox
> Korn Shell
>            Reporter: Sarah S
>            Priority: Minor
>
> {{APP_BIN_DIR="$( cd "$( dirname "$\{BASH_SOURCE[0]}" )" && pwd )"}}
> When the script is running in Korn shell, $\{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 Korn shell 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)