forked from ungleich-public/cdist
fix quoting, remove redundant code
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
parent
12ef3ca4d2
commit
5918de368d
1 changed files with 13 additions and 7 deletions
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue