|
|
|
@ -77,7 +77,6 @@ __cdist_object_dir="$(__cdist_object_dir "$__cdist_object_self")" |
|
|
|
|
mkdir -p "${__cdist_object_dir}" |
|
|
|
|
__cdist_object_source_add "${__cdist_object_dir}" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Record parameter |
|
|
|
|
__cdist_parameter_dir="$(__cdist_object_parameter_dir "$__cdist_object_self")" |
|
|
|
|
mkdir -p "${__cdist_parameter_dir}" |
|
|
|
@ -152,19 +151,43 @@ exit 1 |
|
|
|
|
# Save original destination |
|
|
|
|
__cdist_out_object_dir="$__cdist_out_object_dir_orig" |
|
|
|
|
|
|
|
|
|
__cdist_object_destination_dir="$(__cdist_object_dir "$__cdist_object_self")" |
|
|
|
|
__cdist_new_object_dir="$(__cdist_object_dir "$__cdist_object_self")" |
|
|
|
|
|
|
|
|
|
# |
|
|
|
|
# If the object already exists and is exactly the same, merge it. Otherwise fail. |
|
|
|
|
# |
|
|
|
|
if [ -e "${__cdist_new_object_dir}" ]; then |
|
|
|
|
source="$(__cdist_object_source "${__cdist_new_object_dir}")" |
|
|
|
|
__cdist_exit_err "${__cdist_object} already exists (source: $source)" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Allow diff to fail |
|
|
|
|
set +e |
|
|
|
|
diff -ru "${__cdist_object_dir}" "${__cdist_new_object_dir}" \ |
|
|
|
|
> "$__cdist_tmp_file"; ret=$? |
|
|
|
|
set -e |
|
|
|
|
|
|
|
|
|
if [ "$ret" != 0 ]; then |
|
|
|
|
# Go to standard error |
|
|
|
|
exec >&2 |
|
|
|
|
echo "${__cdist_object_self} already exists differently." |
|
|
|
|
echo "Recorded source(s):" |
|
|
|
|
__cdist_object_source "${__cdist_new_object_dir}" |
|
|
|
|
echo "Differences:" |
|
|
|
|
cat "$__cdist_tmp_file" |
|
|
|
|
__cdist_exit_err "Aborting due to object conflict." |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
# Add ourselves, if we're compatible |
|
|
|
|
__cdist_object_source_add "${__cdist_new_object_dir}" |
|
|
|
|
else |
|
|
|
|
# |
|
|
|
|
# Move object into tree: |
|
|
|
|
# Create full path minus .cdist and move .cdist |
|
|
|
|
# |
|
|
|
|
__cdist_new_object_base_dir="$(__cdist_object_base_dir "$__cdist_object_self")" |
|
|
|
|
mkdir -p "$__cdist_new_object_base_dir" |
|
|
|
|
mv "$__cdist_object_dir" "$__cdist_new_object_base_dir" |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exit 0 |
|
|
|
|
|
|
|
|
|
# -------------------------------------------------------------------------------- |
|
|
|
|
|
|
|
|
|