preserve ownership and permissions of existing file
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
		
					parent
					
						
							
								97a8793fdd
							
						
					
				
			
			
				commit
				
					
						c769d0b681
					
				
			
		
					 1 changed files with 2 additions and 0 deletions
				
			
		| 
						 | 
					@ -42,6 +42,8 @@ remove_entry() {
 | 
				
			||||||
   suffix="#/cdist:$__object_name"
 | 
					   suffix="#/cdist:$__object_name"
 | 
				
			||||||
   cat << DONE
 | 
					   cat << DONE
 | 
				
			||||||
tmpfile=\$(mktemp ${config}.cdist.XXXXXXXXXX)
 | 
					tmpfile=\$(mktemp ${config}.cdist.XXXXXXXXXX)
 | 
				
			||||||
 | 
					# preserve ownership and permissions of existing file
 | 
				
			||||||
 | 
					cp -p "$config" "\$tmpfile"
 | 
				
			||||||
awk -v prefix="$prefix" -v suffix="$suffix" '
 | 
					awk -v prefix="$prefix" -v suffix="$suffix" '
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
   if (index(\$0,prefix)) {
 | 
					   if (index(\$0,prefix)) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue