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>
This commit is contained in:
martin f. krafft 2013-06-18 14:35:30 +02:00
parent 9f4988dbfd
commit bbbc214ffb

View file

@ -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 ""