From f7f687995bdee86417c5e1f4a2ef398d7dcfdcb2 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 2 Feb 2011 14:55:28 +0100 Subject: [PATCH] cleanups + new __cdist_exit_err Signed-off-by: Nico Schottelius --- bin/cdist-build-bin | 2 +- bin/cdist-cconfig-tree | 6 +++--- bin/cdist-config | 17 +++++++++++++++-- bin/cdist-deploy-to | 2 +- bin/cdist-preprocess | 3 +++ 5 files changed, 23 insertions(+), 7 deletions(-) diff --git a/bin/cdist-build-bin b/bin/cdist-build-bin index 20fb4ac6..95159a5c 100755 --- a/bin/cdist-build-bin +++ b/bin/cdist-build-bin @@ -38,4 +38,4 @@ ls -1 > "${__cdist_tmp_file}" mkdir -p "${__cdist_cache_bin}" while read type; do ln -s "${__cdist_tree_wrapper}" "${__cdist_cache_bin}/${__cdist_bin_prefix}${type}" -done +done < "${__cdist_tmp_file}" diff --git a/bin/cdist-cconfig-tree b/bin/cdist-cconfig-tree index 123c1346..d44d8232 100755 --- a/bin/cdist-cconfig-tree +++ b/bin/cdist-cconfig-tree @@ -22,13 +22,13 @@ # And save it into the cache tree # -#[ $# -eq 1 ] || __cdist_usage "cconf" - . cdist-config +[ "${__cdist_target_host}" ] || __cdist_usage "Need \$__cdist_target_host setup" + set -au -cdist_tree_wrapper="$(which cdist_tree_wrapper)" +__cdist_tree_wrapper="$(which cdist_tree_wrapper)" # used to build the tree and other stuff __cdist_bindir="${__cdist_tmp_dir}/bin" diff --git a/bin/cdist-config b/bin/cdist-config index 13054aab..60f06f08 100755 --- a/bin/cdist-config +++ b/bin/cdist-config @@ -29,6 +29,7 @@ : ${__cdist_cache_dir:=$__cdist_config/cache} : ${__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 @@ -50,6 +51,13 @@ __cdist_abs_mydir="$(cd "$__cdist_mydir" && pwd -P)" __cdist_myname=${0##*/}; __cdist_abs_myname="$__cdist_abs_mydir/$__cdist_myname" + +################################################################################ +# Other constants + +# Used for generating binaries in cdist-build-bin +__cdist_bin_prefix="__" + ################################################################################ # Function list # @@ -60,10 +68,15 @@ __cdist_debug_echo() fi } +__cdist_exit_err() +{ + echo "$@" + exit 1 +} + __cdist_usage() { - echo "$__cdist_myname: $@" - exit 1 + __cdist_exit_err "$__cdist_myname: $@" } diff --git a/bin/cdist-deploy-to b/bin/cdist-deploy-to index c1a8c835..072c6925 100755 --- a/bin/cdist-deploy-to +++ b/bin/cdist-deploy-to @@ -28,7 +28,7 @@ set -e # Internal variables, usable by -export __cdist_intern_target_host="$1" +export __cdist_target_host="$1" export __cdist_intern_deploy_host="$(cdist_explore_hostname)" . cdist-build "$__cdist_intern_target_host" diff --git a/bin/cdist-preprocess b/bin/cdist-preprocess index 53ed7d04..71dc839c 100755 --- a/bin/cdist-preprocess +++ b/bin/cdist-preprocess @@ -32,3 +32,6 @@ cdist-build-explorer | ssh "$1" > "${CDIST_TMP}" # And a filter function like grep '^__cdist_explore.*=".*"$' # is probably not effective! . "${CDIST_TMP}" + + +