no late delete
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
		
					parent
					
						
							
								6d5686229f
							
						
					
				
			
			
				commit
				
					
						71b41df733
					
				
			
		
					 1 changed files with 2 additions and 10 deletions
				
			
		| 
						 | 
					@ -49,10 +49,9 @@ file_type="$(cat "$__object/explorer/type")"
 | 
				
			||||||
case "$state_should" in
 | 
					case "$state_should" in
 | 
				
			||||||
    present)
 | 
					    present)
 | 
				
			||||||
        if [ "$file_type" = "directory" ]; then
 | 
					        if [ "$file_type" = "directory" ]; then
 | 
				
			||||||
            # our destination is currently a directory, move it out of the way
 | 
					            # our destination is currently a directory, delete it
 | 
				
			||||||
            cat << DONE
 | 
					            cat << DONE
 | 
				
			||||||
destination_old="\$(mktemp "${destination}.cdist.XXXXXXXXXX")"
 | 
					rm -rf "$destination"
 | 
				
			||||||
mv "$destination" "\$destination_old"
 | 
					 | 
				
			||||||
DONE
 | 
					DONE
 | 
				
			||||||
        fi
 | 
					        fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -60,13 +59,6 @@ DONE
 | 
				
			||||||
        cat << DONE
 | 
					        cat << DONE
 | 
				
			||||||
ln ${lnopt} -f "$source" "$destination"
 | 
					ln ${lnopt} -f "$source" "$destination"
 | 
				
			||||||
DONE
 | 
					DONE
 | 
				
			||||||
 | 
					 | 
				
			||||||
        if [ "$file_type" = "directory" ]; then
 | 
					 | 
				
			||||||
            # delete the legacy directory
 | 
					 | 
				
			||||||
            cat << DONE
 | 
					 | 
				
			||||||
rm -rf "\$destination_old"
 | 
					 | 
				
			||||||
DONE
 | 
					 | 
				
			||||||
        fi
 | 
					 | 
				
			||||||
    ;;
 | 
					    ;;
 | 
				
			||||||
    absent)
 | 
					    absent)
 | 
				
			||||||
        # only delete if it is a sym/hard link
 | 
					        # only delete if it is a sym/hard link
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue