exchange new and object dir (good idea, steven)
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
		
					parent
					
						
							
								44ecd1f056
							
						
					
				
			
			
				commit
				
					
						1e66bc4380
					
				
			
		
					 1 changed files with 9 additions and 9 deletions
				
			
		| 
						 | 
					@ -71,11 +71,11 @@ __cdist_out_object_dir_orig="$__cdist_out_object_dir"
 | 
				
			||||||
# Store to tmp now
 | 
					# Store to tmp now
 | 
				
			||||||
__cdist_out_object_dir="$__cdist_tmp_dir"
 | 
					__cdist_out_object_dir="$__cdist_tmp_dir"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
__cdist_object_dir="$(__cdist_object_dir "$__cdist_object_self")"
 | 
					__cdist_new_object_dir="$(__cdist_object_dir "$__cdist_object_self")"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Record source
 | 
					# Record source
 | 
				
			||||||
mkdir -p "${__cdist_object_dir}"
 | 
					mkdir -p "${__cdist_new_object_dir}"
 | 
				
			||||||
__cdist_object_source_add "${__cdist_object_dir}"
 | 
					__cdist_object_source_add "${__cdist_new_object_dir}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Record parameter
 | 
					# Record parameter
 | 
				
			||||||
__cdist_parameter_dir="$(__cdist_object_parameter_dir "$__cdist_object_self")"
 | 
					__cdist_parameter_dir="$(__cdist_object_parameter_dir "$__cdist_object_self")"
 | 
				
			||||||
| 
						 | 
					@ -147,15 +147,15 @@ done
 | 
				
			||||||
# Restore 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_object_dir="$(__cdist_object_dir "$__cdist_object_self")"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# If the object already exists and is exactly the same, merge it. Otherwise fail.
 | 
					# If the object already exists and is exactly the same, merge it. Otherwise fail.
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
if [ -e "${__cdist_new_object_dir}" ]; then
 | 
					if [ -e "${__cdist_object_dir}" ]; then
 | 
				
			||||||
   # Allow diff to fail
 | 
					   # Allow diff to fail
 | 
				
			||||||
   set +e
 | 
					   set +e
 | 
				
			||||||
   diff -ru "${__cdist_object_dir}" "${__cdist_new_object_dir}" \
 | 
					   diff -ru "${__cdist_new_object_dir}" "${__cdist_object_dir}" \
 | 
				
			||||||
      > "$__cdist_tmp_file"; ret=$?
 | 
					      > "$__cdist_tmp_file"; ret=$?
 | 
				
			||||||
   set -e
 | 
					   set -e
 | 
				
			||||||
   
 | 
					   
 | 
				
			||||||
| 
						 | 
					@ -164,14 +164,14 @@ if [ -e "${__cdist_new_object_dir}" ]; then
 | 
				
			||||||
      exec >&2
 | 
					      exec >&2
 | 
				
			||||||
      echo "${__cdist_object_self} already exists differently."
 | 
					      echo "${__cdist_object_self} already exists differently."
 | 
				
			||||||
      echo "Recorded source(s):"
 | 
					      echo "Recorded source(s):"
 | 
				
			||||||
      __cdist_object_source "${__cdist_new_object_dir}"
 | 
					      __cdist_object_source "${__cdist_object_dir}"
 | 
				
			||||||
      echo "Differences:"
 | 
					      echo "Differences:"
 | 
				
			||||||
      cat "$__cdist_tmp_file"
 | 
					      cat "$__cdist_tmp_file"
 | 
				
			||||||
      __cdist_exit_err "Aborting due to object conflict."
 | 
					      __cdist_exit_err "Aborting due to object conflict."
 | 
				
			||||||
   fi
 | 
					   fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   # Add ourselves, if we're compatible
 | 
					   # Add ourselves, if we're compatible
 | 
				
			||||||
   __cdist_object_source_add "${__cdist_new_object_dir}"
 | 
					   __cdist_object_source_add "${__cdist_object_dir}"
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
   #
 | 
					   #
 | 
				
			||||||
   # Move object into tree:
 | 
					   # Move object into tree:
 | 
				
			||||||
| 
						 | 
					@ -179,5 +179,5 @@ else
 | 
				
			||||||
   #
 | 
					   #
 | 
				
			||||||
   __cdist_new_object_base_dir="$(__cdist_object_base_dir "$__cdist_object_self")"
 | 
					   __cdist_new_object_base_dir="$(__cdist_object_base_dir "$__cdist_object_self")"
 | 
				
			||||||
   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_new_object_dir"  "$__cdist_new_object_base_dir"
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue