From b95eb84a983fced6357042f4819d2c26047c8581 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 2 Feb 2011 18:41:01 +0100 Subject: [PATCH] Cleanups, begin generic manifest execution Signed-off-by: Nico Schottelius --- bin/cdist-build-bin | 1 + bin/cdist-build-host-cconfig | 56 ++++++------------------------------ bin/cdist-config | 1 - bin/cdist-preprocess | 3 +- bin/cdist_tree_wrapper | 2 -- 5 files changed, 12 insertions(+), 51 deletions(-) diff --git a/bin/cdist-build-bin b/bin/cdist-build-bin index 95159a5c..d101e284 100755 --- a/bin/cdist-build-bin +++ b/bin/cdist-build-bin @@ -24,6 +24,7 @@ set -aeu +# FIXME: load this from the cdist-core library __cdist_tree_wrapper="$(which cdist_tree_wrapper)" if [ ! -d ${__cdist_type_dir} ]; then diff --git a/bin/cdist-build-host-cconfig b/bin/cdist-build-host-cconfig index 084e9fd1..9c07efc6 100755 --- a/bin/cdist-build-host-cconfig +++ b/bin/cdist-build-host-cconfig @@ -25,62 +25,24 @@ . cdist-config [ "${__cdist_target_host}" ] || __cdist_usage "Need \$__cdist_target_host setup" +[ "${__cdist_output_dir}" ] || __cdist_usage "Need \$__cdist_output_dir setup" set -au -__cdist_tree_wrapper="$(which cdist_tree_wrapper)" +# FIXME: Save output in cache -- or make flexible? +__cdist_output_dir="$(__cdist_cache_host)" -# used to build the tree and other stuff -__cdist_bindir="${__cdist_tmp_dir}/bin" - -# FIXME: create cache/bin dir only once / do that in its -# own function - -# Save output in cache -__cdist_output="${__cdist_cache_hosts}/${__cdist_target_host}" - -cdist_type_prefix="__" - -################################################################################ -# Begin execution - -cdist_tree_wrapper_name=${cdist_tree_wrapper##*/} -cdist_tree_wrapper_absdir=$(cd ${cdist_tree_wrapper%/*} && pwd -P) -cdist_tree_wrapper_abs="$cdist_tree_wrapper_absdir/$cdist_tree_wrapper_name" - - -rm -rf "${__cdist_tmp_dir}" - -# contains cdist-tree binaries -mkdir -p "${cdist_bindir}" -#ln -s "${cdist_tree_wrapper_abs}" "${bindir}" - -# Create our binaries, will are called from the manifest - temporary -( - set -e - cd "${__cdist_type_dir}" - # FIXME: replace with redirect to file + read - for bin in *; do - ln -s "${cdist_tree_wrapper_abs}" "${cdist_type_prefix}${bin}" - cd "${cdist_bindir}" - done -) - -# Cdist_tree_wrapper does not need any other tool, so remove them from the path. -# but the manifest may need so - FIXME: think about it. -#unset PATH - -# prepend our path +# prepend our path, so all cdist tools come before other tools PATH="${__cdist_cache_bin}:$PATH" -# create output dir -mkdir -p "${cdist_confdir}" - -# force -x, so the user is aware the file is executed +# Force -x, so the user is aware the file is executed if [ ! -x "${__cdist_manifest_init}" ]; then __cdist_exit_err "${__cdist_manifest_init} needs to be executable." fi +# create output dir +mkdir -p "$(__cdist_cache_host)" + "${__cdist_manifest_init}" -echo "Finished tree generation, have a look at ${cdist_confdir}." +echo "Finished tree generation, have a look at ${__cdist_output_dir}." diff --git a/bin/cdist-config b/bin/cdist-config index c69bb0c4..5f33a0d0 100755 --- a/bin/cdist-config +++ b/bin/cdist-config @@ -33,7 +33,6 @@ # obsolete?: lib not needed, hosts replaced by manifests, modules by types -: ${__cdist_hosts:=$__cdist_config/hosts} : ${__cdist_modules:=$__cdist_config/modules} : ${__cdist_coredir:=$__cdist_config/core} diff --git a/bin/cdist-preprocess b/bin/cdist-preprocess index 71dc839c..bb47972f 100755 --- a/bin/cdist-preprocess +++ b/bin/cdist-preprocess @@ -34,4 +34,5 @@ cdist-build-explorer | ssh "$1" > "${CDIST_TMP}" . "${CDIST_TMP}" - +# Create cconfig for the host +# cdist-manifest ... diff --git a/bin/cdist_tree_wrapper b/bin/cdist_tree_wrapper index 6be8806e..254de003 100755 --- a/bin/cdist_tree_wrapper +++ b/bin/cdist_tree_wrapper @@ -61,6 +61,4 @@ while [ $# -gt 0 ]; do echo "${value}" > "${__cdist_ddir}/${opt_file}" - - done