From 57c60a40a8e4a4db29b204434de9b594ebe313e8 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Thu, 24 Feb 2011 09:37:31 +0100 Subject: [PATCH] make cdist-manifest-run change the working dir Signed-off-by: Nico Schottelius --- bin/cdist-manifest-init | 3 ++- bin/cdist-manifest-run | 10 ++++++---- bin/cdist-manifest-run-all | 8 ++------ 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/bin/cdist-manifest-init b/bin/cdist-manifest-init index 2b9ae00b..9e8a346f 100755 --- a/bin/cdist-manifest-init +++ b/bin/cdist-manifest-init @@ -29,4 +29,5 @@ set -e export __cdist_target_host="$1"; shift export __cdist_output_dir="$1"; shift -cdist-manifest-run "$__cdist_target_host" "$__cdist_manifest_init" "$__cdist_output_dir" +cdist-manifest-run "$__cdist_target_host" "$__cdist_local_base_dir" \ + "$__cdist_manifest_init" "$__cdist_output_dir" diff --git a/bin/cdist-manifest-run b/bin/cdist-manifest-run index 48990edb..892b3a2f 100755 --- a/bin/cdist-manifest-run +++ b/bin/cdist-manifest-run @@ -23,12 +23,13 @@ # . cdist-config -[ $# -ge 3 ] || __cdist_usage " [manifest arguments]" +[ $# -ge 4 ] || __cdist_usage " [manifest arguments]" set -u -export __cdist_target_host="$1"; shift -export __cdist_manifest="$1"; shift -export __cdist_output_dir="$1"; shift +__cdist_target_host="$1"; shift +__cdist_work_dir="$1"; shift +__cdist_manifest="$1"; shift +__cdist_output_dir="$1"; shift # Ensure binaries exist and are up-to-date cdist-type-build-emulation || __cdist_exit_err "Failed to build type emulation binaries" @@ -43,4 +44,5 @@ fi mkdir -p "${__cdist_output_dir}" || __cdist_exit_err "Cannot create output dir ${__cdist_output_dir}" +cd "$__cdist_work_dir" || __cdist_exit_err "Cannot change to work dir \"$__cdist_work_dir\"." __cdist_exec_fail_on_error "${__cdist_manifest}" "$@" diff --git a/bin/cdist-manifest-run-all b/bin/cdist-manifest-run-all index 038b0dc9..ad49bbb4 100755 --- a/bin/cdist-manifest-run-all +++ b/bin/cdist-manifest-run-all @@ -65,12 +65,8 @@ while [ "$__cdist_new_objects_created" = "y" ]; do if [ -x "${__cdist_manifest}" ]; then echo "Executing manifest ${__cdist_manifest} ..." - # Safely change directory, convienent for type-writers - ( - cd "$__cdist_cur_object_dir" - cdist-manifest-run "$__cdist_target_host" "$__cdist_manifest" \ - "$__cdist_new_objects_dir" "$__cdist_object_id" - ) + cdist-manifest-run "$__cdist_target_host" "$__cdist_cur_object_dir" \ + "$__cdist_manifest" "$__cdist_new_objects_dir" "$__cdist_object_id" __cdist_object_list "${__cdist_new_objects_dir}" > "$__cdist_new_objects_list"