preserve ownership and permissions of existing file

Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
Steven Armstrong 2013-09-27 22:05:02 +02:00
parent 97a8793fdd
commit c769d0b681

View file

@ -42,6 +42,8 @@ remove_entry() {
suffix="#/cdist:$__object_name"
cat << DONE
tmpfile=\$(mktemp ${config}.cdist.XXXXXXXXXX)
# preserve ownership and permissions of existing file
cp -p "$config" "\$tmpfile"
awk -v prefix="$prefix" -v suffix="$suffix" '
{
if (index(\$0,prefix)) {