make cdist-manifest-run change the working dir

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
Nico Schottelius 2011-02-24 09:37:31 +01:00
parent 5a7ffff077
commit 57c60a40a8
3 changed files with 10 additions and 11 deletions

View file

@ -29,4 +29,5 @@ set -e
export __cdist_target_host="$1"; shift export __cdist_target_host="$1"; shift
export __cdist_output_dir="$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"

View file

@ -23,12 +23,13 @@
# #
. cdist-config . cdist-config
[ $# -ge 3 ] || __cdist_usage "<target host> <manifest> <outdir> [manifest arguments]" [ $# -ge 4 ] || __cdist_usage "<target host> <work dir> <manifest> <out dir> [manifest arguments]"
set -u set -u
export __cdist_target_host="$1"; shift __cdist_target_host="$1"; shift
export __cdist_manifest="$1"; shift __cdist_work_dir="$1"; shift
export __cdist_output_dir="$1"; shift __cdist_manifest="$1"; shift
__cdist_output_dir="$1"; shift
# Ensure binaries exist and are up-to-date # Ensure binaries exist and are up-to-date
cdist-type-build-emulation || __cdist_exit_err "Failed to build type emulation binaries" 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}" 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}" "$@" __cdist_exec_fail_on_error "${__cdist_manifest}" "$@"

View file

@ -65,12 +65,8 @@ while [ "$__cdist_new_objects_created" = "y" ]; do
if [ -x "${__cdist_manifest}" ]; then if [ -x "${__cdist_manifest}" ]; then
echo "Executing manifest ${__cdist_manifest} ..." echo "Executing manifest ${__cdist_manifest} ..."
# Safely change directory, convienent for type-writers cdist-manifest-run "$__cdist_target_host" "$__cdist_cur_object_dir" \
( "$__cdist_manifest" "$__cdist_new_objects_dir" "$__cdist_object_id"
cd "$__cdist_cur_object_dir"
cdist-manifest-run "$__cdist_target_host" "$__cdist_manifest" \
"$__cdist_new_objects_dir" "$__cdist_object_id"
)
__cdist_object_list "${__cdist_new_objects_dir}" > "$__cdist_new_objects_list" __cdist_object_list "${__cdist_new_objects_dir}" > "$__cdist_new_objects_list"