|
|
@ -109,8 +109,6 @@ set -u |
|
|
|
# Check newly created object |
|
|
|
# Check newly created object |
|
|
|
# |
|
|
|
# |
|
|
|
|
|
|
|
|
|
|
|
set -x |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# |
|
|
|
# |
|
|
|
# Ensure required parameters are given |
|
|
|
# Ensure required parameters are given |
|
|
|
# |
|
|
|
# |
|
|
@ -143,12 +141,10 @@ for parameter in $(ls -1); do |
|
|
|
[ "$is_valid" ] || "Unknown parameter $parameter" |
|
|
|
[ "$is_valid" ] || "Unknown parameter $parameter" |
|
|
|
done |
|
|
|
done |
|
|
|
|
|
|
|
|
|
|
|
exit 1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
################################################################################ |
|
|
|
################################################################################ |
|
|
|
# Merge object |
|
|
|
# Merge object |
|
|
|
# |
|
|
|
# |
|
|
|
# Save original destination |
|
|
|
# Restore original destination |
|
|
|
__cdist_out_object_dir="$__cdist_out_object_dir_orig" |
|
|
|
__cdist_out_object_dir="$__cdist_out_object_dir_orig" |
|
|
|
|
|
|
|
|
|
|
|
__cdist_new_object_dir="$(__cdist_object_dir "$__cdist_object_self")" |
|
|
|
__cdist_new_object_dir="$(__cdist_object_dir "$__cdist_object_self")" |
|
|
@ -185,58 +181,3 @@ else |
|
|
|
mkdir -p "$__cdist_new_object_base_dir" |
|
|
|
mkdir -p "$__cdist_new_object_base_dir" |
|
|
|
mv "$__cdist_object_dir" "$__cdist_new_object_base_dir" |
|
|
|
mv "$__cdist_object_dir" "$__cdist_new_object_base_dir" |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exit 0 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# -------------------------------------------------------------------------------- |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Verify no conflicting objects have been created |
|
|
|
|
|
|
|
while read __cdist_new_object; do |
|
|
|
|
|
|
|
__cdist_object_found=$(grep "^$__cdist_new_object\$" "$__cdist_objects_list" || true) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ "$__cdist_object_found" ]; then |
|
|
|
|
|
|
|
__cdist_object_source="$(cat "$(__cdist_object_dir "$__cdist_new_object")/${__cdist_name_object_source}")" |
|
|
|
|
|
|
|
__cdist_exit_err "${__cdist_manifest}: ${__cdist_new_object} already exists (source: $__cdist_object_source)" |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
done < "$__cdist_new_objects_list" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Safe harbour: We can merge all objects into main tree |
|
|
|
|
|
|
|
# Merge = mkdir + mv parameters and source information |
|
|
|
|
|
|
|
while read __cdist_new_object; do |
|
|
|
|
|
|
|
[ "$__cdist_new_objects_created" = "n" ] && __cdist_new_objects_created="y" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# where to save the newly created object |
|
|
|
|
|
|
|
__cdist_object_dir="$__cdist_out_object_dir/$__cdist_new_object" |
|
|
|
|
|
|
|
mkdir -p "$__cdist_object_dir" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Move parts of the object (CANNOT MOVE COMPLETLEY, HIERACHY!) |
|
|
|
|
|
|
|
__cdist_new_object_dir="$__cdist_new_objects_dir/$__cdist_new_object" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Source |
|
|
|
|
|
|
|
mv "${__cdist_new_object_dir}/${__cdist_name_object_source}" \ |
|
|
|
|
|
|
|
"$__cdist_object_dir" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Explorer, Parameter, Require |
|
|
|
|
|
|
|
for __cdist_object_file in \ |
|
|
|
|
|
|
|
${__cdist_name_explorer} \ |
|
|
|
|
|
|
|
${__cdist_name_parameter} \ |
|
|
|
|
|
|
|
${__cdist_name_require} \ |
|
|
|
|
|
|
|
; do |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ -e "${__cdist_new_object_dir}/${__cdist_object_file}" ]; then |
|
|
|
|
|
|
|
mv "${__cdist_new_object_dir}/${__cdist_object_file}" \ |
|
|
|
|
|
|
|
"$__cdist_object_dir" |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
done |
|
|
|
|
|
|
|
done < "$__cdist_new_objects_list" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Remove listing and objects, otherwise the next type will reuse it... |
|
|
|
|
|
|
|
rm -rf "$__cdist_new_objects_dir" "$__cdist_new_objects_list" |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
# Be nice, warn user if manifests exists, but is not executable |
|
|
|
|
|
|
|
if [ -f "${__cdist_manifest}" ]; then |
|
|
|
|
|
|
|
echo "Warning ${__cdist_manifest} exists, but is not executable." >&2 |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|