fix quoting, remove redundant code

Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
Steven Armstrong 2013-09-18 10:44:52 +02:00
parent 12ef3ca4d2
commit 5918de368d
1 changed files with 13 additions and 7 deletions

View File

@ -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