Comment 11 for bug 376425

Revision history for this message
David Kavanagh (david-kavanagh) wrote : Re: [Bug 376425] Re: generated eucarc contains bashisms

I would like a solution that works for bash on darwin (OS X).

if [ $(uname) == "Darwin" ]; then
 EUCA_KEY_DIR=$(dirname $(stat -f ${BASH_SOURCE}))
else
 EUCA_KEY_DIR=$(dirname $(readlink -f ${BASH_SOURCE}))
fi

On Sun, Dec 18, 2011 at 6:49 PM, Garrett Holmstrom <
<email address hidden>> wrote:

> Lovely. $_ changes based on the environment. At least
> ${BASH_SOURCE:-$0} will make it work for bash and zsh. It doesn't fix
> it for dash or ksh, but it is still an improvement over what we have
> now.
>
> It looks like that's what the Nova people are doing, too:
> https://bugs.launchpad.net/nova/+bug/787351
>
> --
> You received this bug notification because you are a member of
> Eucalyptus Maintainers, which is subscribed to Eucalyptus.
> https://bugs.launchpad.net/bugs/376425
>
> Title:
> generated eucarc contains bashisms
>
> Status in Eucalyptus:
> Confirmed
> Status in Eucalyptus 2.0 series:
> Confirmed
>
> Bug description:
> The first line in the generated eucarc (when downloading x509
> certificate) is:
> EUCA_KEY_DIR=$(dirname $(readlink -f ${BASH_SOURCE}))
> Which doesn’t work in zsh at all.
> I suggest replacing it by something like this:
> EUCA_KEY_DIR="$(cd "${0%/*}" && pwd -P)"
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/eucalyptus/+bug/376425/+subscriptions
>

--

*_________________________*

*David Kavanagh - *Software Engineer

*Eucalyptus Systems*

www.eucalyptus.com

*_________________________*