shrink cdist env and make it usable for . ./bin/cdist-env (in sh)

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
Nico Schottelius 2011-03-22 08:29:59 +01:00
parent 29edf58809
commit 8a76143e33

View file

@ -21,23 +21,13 @@
# Setup environment for use with cdist - must be standalone!
#
__cdist_pwd="$(pwd -P)"
__cdist_mydir="${0%/*}";
__cdist_abs_mydir="$(cd "$__cdist_mydir" && pwd -P)"
__cdist_myname=${0##*/};
__cdist_abs_myname="$__cdist_abs_mydir/$__cdist_myname"
export PATH="$(cd "${0%/*}" && pwd -P):$PATH"
export MANPATH="$(cd "${0%/*}/../doc/man" && pwd -P):$MANPATH"
shell_binary=${SHELL##*/}
NEWPATH="$__cdist_abs_mydir:$PATH"
cd "$__cdist_abs_mydir/../doc/man"
NEWMANPATH="$(pwd -P):$MANPATH"
# Match csh, tcsh to handle differently
if [ "$(echo $shell_binary | grep 'csh$')" ]; then
echo setenv PATH $NEWPATH \;
echo setenv MANPATH $NEWMANPATH
if [ "$(echo ${SHELL##*/} | grep 'csh$')" ]; then
echo setenv PATH $PATH \;
echo setenv MANPATH $MANPATH
else
echo export PATH=$NEWPATH
echo export MANPATH=$NEWMANPATH
echo export PATH=$PATH
echo export MANPATH=$MANPATH
fi