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

View file

@ -63,16 +63,22 @@ case "$state_should" in
set_attributes=1 set_attributes=1
if [ "$type" = "directory" ]; then if [ "$type" = "directory" ]; then
# our destination is currently a directory, move it out of the way, # our destination is currently a directory, move it out of the way,
# then delete it after moving our upload into place
cat << DONE cat << DONE
destination_old="\$(mktemp "${destination}.cdist.XXXXXXXXXX")" destination_old="\$(mktemp "${destination}.cdist.XXXXXXXXXX")"
mv "$destination" "$destination_old" mv "$destination" "\$destination_old"
mv "$destination_upload" "$destination" DONE
rm -rf "$destination_old" 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 DONE
else
# move our upload into place
echo "mv \"$destination_upload\" \"$destination\""
fi fi
fi fi