preserve ownership and permissions of existing files
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
parent
58f19df386
commit
8a7639c191
1 changed files with 4 additions and 2 deletions
|
@ -1,6 +1,6 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# 2012 Steven Armstrong (steven-cdist at armstrong.cc)
|
||||
# 2012-2013 Steven Armstrong (steven-cdist at armstrong.cc)
|
||||
#
|
||||
# This file is part of cdist.
|
||||
#
|
||||
|
@ -48,6 +48,8 @@ remove_entry() {
|
|||
suffix="#/cdist:$__object_name"
|
||||
cat << DONE
|
||||
tmpfile=\$(mktemp)
|
||||
# preserve ownership and permissions by copying existing file over tmpfile
|
||||
cp -p "$file" "\$tmpfile"
|
||||
awk -v prefix="$prefix" -v suffix="$suffix" '
|
||||
{
|
||||
if (index(\$0,prefix)) {
|
||||
|
|
Loading…
Reference in a new issue