cleanups + new __cdist_exit_err

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
Nico Schottelius 2011-02-02 14:55:28 +01:00
parent 97a14fe933
commit f7f687995b
5 changed files with 23 additions and 7 deletions

View File

@ -38,4 +38,4 @@ ls -1 > "${__cdist_tmp_file}"
mkdir -p "${__cdist_cache_bin}" mkdir -p "${__cdist_cache_bin}"
while read type; do while read type; do
ln -s "${__cdist_tree_wrapper}" "${__cdist_cache_bin}/${__cdist_bin_prefix}${type}" ln -s "${__cdist_tree_wrapper}" "${__cdist_cache_bin}/${__cdist_bin_prefix}${type}"
done done < "${__cdist_tmp_file}"

View File

@ -22,13 +22,13 @@
# And save it into the cache tree # And save it into the cache tree
# #
#[ $# -eq 1 ] || __cdist_usage "cconf"
. cdist-config . cdist-config
[ "${__cdist_target_host}" ] || __cdist_usage "Need \$__cdist_target_host setup"
set -au set -au
cdist_tree_wrapper="$(which cdist_tree_wrapper)" __cdist_tree_wrapper="$(which cdist_tree_wrapper)"
# used to build the tree and other stuff # used to build the tree and other stuff
__cdist_bindir="${__cdist_tmp_dir}/bin" __cdist_bindir="${__cdist_tmp_dir}/bin"

View File

@ -29,6 +29,7 @@
: ${__cdist_cache_dir:=$__cdist_config/cache} : ${__cdist_cache_dir:=$__cdist_config/cache}
: ${__cdist_cache_hosts:=$__cdist_cache_dir/hosts} : ${__cdist_cache_hosts:=$__cdist_cache_dir/hosts}
: ${__cdist_cache_bin:=$__cdist_cache_dir/bin}
# obsolete?: lib not needed, hosts replaced by manifests, modules by types # obsolete?: lib not needed, hosts replaced by manifests, modules by types
@ -50,6 +51,13 @@ __cdist_abs_mydir="$(cd "$__cdist_mydir" && pwd -P)"
__cdist_myname=${0##*/}; __cdist_myname=${0##*/};
__cdist_abs_myname="$__cdist_abs_mydir/$__cdist_myname" __cdist_abs_myname="$__cdist_abs_mydir/$__cdist_myname"
################################################################################
# Other constants
# Used for generating binaries in cdist-build-bin
__cdist_bin_prefix="__"
################################################################################ ################################################################################
# Function list # Function list
# #
@ -60,10 +68,15 @@ __cdist_debug_echo()
fi fi
} }
__cdist_exit_err()
{
echo "$@"
exit 1
}
__cdist_usage() __cdist_usage()
{ {
echo "$__cdist_myname: $@" __cdist_exit_err "$__cdist_myname: $@"
exit 1
} }

View File

@ -28,7 +28,7 @@
set -e set -e
# Internal variables, usable by # Internal variables, usable by
export __cdist_intern_target_host="$1" export __cdist_target_host="$1"
export __cdist_intern_deploy_host="$(cdist_explore_hostname)" export __cdist_intern_deploy_host="$(cdist_explore_hostname)"
. cdist-build "$__cdist_intern_target_host" . cdist-build "$__cdist_intern_target_host"

View File

@ -32,3 +32,6 @@ cdist-build-explorer | ssh "$1" > "${CDIST_TMP}"
# And a filter function like grep '^__cdist_explore.*=".*"$' # And a filter function like grep '^__cdist_explore.*=".*"$'
# is probably not effective! # is probably not effective!
. "${CDIST_TMP}" . "${CDIST_TMP}"