From 5918de368d7541c051a83c340143f332f94e7631 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 18 Sep 2013 10:44:52 +0200 Subject: [PATCH] fix quoting, remove redundant code Signed-off-by: Steven Armstrong --- cdist/conf/type/__file/gencode-remote | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/cdist/conf/type/__file/gencode-remote b/cdist/conf/type/__file/gencode-remote index b0f7757f..09f8e018 100755 --- a/cdist/conf/type/__file/gencode-remote +++ b/cdist/conf/type/__file/gencode-remote @@ -63,16 +63,22 @@ case "$state_should" in set_attributes=1 if [ "$type" = "directory" ]; then # our destination is currently a directory, move it out of the way, - # then delete it after moving our upload into place cat << DONE destination_old="\$(mktemp "${destination}.cdist.XXXXXXXXXX")" -mv "$destination" "$destination_old" -mv "$destination_upload" "$destination" -rm -rf "$destination_old" +mv "$destination" "\$destination_old" +DONE + fi + + # move our upload into place + cat << DONE +mv "$destination_upload" "$destination" +DONE + + if [ "$type" = "directory" ]; then + # delete the legacy directory + cat << DONE +rm -rf "\$destination_old" DONE - else - # move our upload into place - echo "mv \"$destination_upload\" \"$destination\"" fi fi