mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Merge pull request #3209 from madduck/generalise-hacking-dir-path-discovery
Generalise hacking dir path discovery
This commit is contained in:
commit
5ac1e7d0ca
1 changed files with 10 additions and 6 deletions
|
@ -1,13 +1,17 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# usage: source ./hacking/env-setup [-q]
|
# usage: source env-setup [-q]
|
||||||
|
# source hacking/env-setup [-q]
|
||||||
|
# . ./env-setup [-q]
|
||||||
|
# . ./hacking/env-setup [q]
|
||||||
# modifies environment for running Ansible from checkout
|
# modifies environment for running Ansible from checkout
|
||||||
|
|
||||||
# When run using source as directed, $0 gets set to bash, so we must use $BASH_SOURCE
|
# When run using source as directed, $0 gets set to bash, so we must use $BASH_SOURCE
|
||||||
if [ -n "$BASH_SOURCE" ] ; then
|
case "$0" in
|
||||||
HACKING_DIR=`dirname $BASH_SOURCE`
|
(bash)
|
||||||
else
|
HACKING_DIR=${BASH_SOURCE%/*};;
|
||||||
HACKING_DIR="$PWD/hacking"
|
(*)
|
||||||
fi
|
HACKING_DIR=${0%/*};;
|
||||||
|
esac
|
||||||
# The below is an alternative to readlink -fn which doesn't exist on OS X
|
# The below is an alternative to readlink -fn which doesn't exist on OS X
|
||||||
# Source: http://stackoverflow.com/a/1678636
|
# Source: http://stackoverflow.com/a/1678636
|
||||||
FULL_PATH=`python -c "import os; print(os.path.realpath('$HACKING_DIR'))"`
|
FULL_PATH=`python -c "import os; print(os.path.realpath('$HACKING_DIR'))"`
|
||||||
|
|
Loading…
Reference in a new issue