summaryrefslogtreecommitdiff
path: root/hacking/env-setup
diff options
context:
space:
mode:
authormartin f. krafft <madduck@madduck.net>2013-06-18 14:35:30 +0200
committermartin f. krafft <madduck@madduck.net>2013-06-20 08:18:37 +0200
commitbbbc214ffbe7847d7d4023645122116dc1749c37 (patch)
tree205f7460b75c76749f7d43718e2f9724ca2e6581 /hacking/env-setup
parent9f4988dbfd3878215a9095a0ffa9539a540f3738 (diff)
downloadansible-bbbc214ffbe7847d7d4023645122116dc1749c37.tar.gz
Remove bashisms, replace with POSIX constructs
This replaces double conditional brackets with single ones and gets ris of bashisms, so that the tool should be sourcable from any POSIX shell. Constructs like [ $foo = "$bar"* ] yield filesystem-globbing behaviour according to POSIX. A compliant way is to use case statements. Signed-off-by: martin f. krafft <madduck@madduck.net>
Diffstat (limited to 'hacking/env-setup')
-rwxr-xr-xhacking/env-setup17
1 files changed, 13 insertions, 4 deletions
diff --git a/hacking/env-setup b/hacking/env-setup
index bcebd46250..9bf3c49b31 100755
--- a/hacking/env-setup
+++ b/hacking/env-setup
@@ -20,14 +20,23 @@ PREFIX_PYTHONPATH="$ANSIBLE_HOME/lib"
PREFIX_PATH="$ANSIBLE_HOME/bin"
PREFIX_MANPATH="$ANSIBLE_HOME/docs/man"
-[[ "$PYTHONPATH" != "${PREFIX_PYTHONPATH}"* ]] && export PYTHONPATH=$"PREFIX_PYTHONPATH:$PYTHONPATH"
-[[ "$PATH" != "${PREFIX_PATH}"* ]] && export PATH="$PREFIX_PATH:$PATH"
+case "$PYTHONPATH" in
+ (*${PREFIX_PYTHONPATH}*) :;;
+ (*) export PYTHONPATH=$"$PREFIX_PYTHONPATH${PYTHONPATH:+:$PYTHONPATH}";;
+esac
+case "$MANPATH" in
+ (*${PREFIX_MANPATH}*) :;;
+ (*) export MANPATH=$"$PREFIX_MANPATH${MANPATH:+:$MANPATH}";;
+esac
+case "$PATH" in
+ (*${PREFIX_PATH}*) :;;
+ (*) export PATH=$"$PREFIX_PATH${PATH:+:$PATH}";;
+esac
export ANSIBLE_LIBRARY="$ANSIBLE_HOME/library"
-[[ "$MANPATH" != "${PREFIX_MANPATH}"* ]] && export MANPATH="$PREFIX_MANPATH:$MANPATH"
# Print out values unless -q is set
-if [ $# -eq 0 -o "$1" != "-q" ] ; then
+if [ $# -eq 0 ] || [ "$1" != "-q" ] ; then
echo ""
echo "Setting up Ansible to run out of checkout..."
echo ""