Merge branch 'issue/315' of https://github.com/asteven/cdist
This commit is contained in:
commit
6e81bbc54b
1 changed files with 8 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# 2012 Nico Schottelius (nico-cdist at schottelius.org)
|
||||
# 2014 Steven Armstrong (steven-cdist at armstrong.cc)
|
||||
#
|
||||
# This file is part of cdist.
|
||||
#
|
||||
|
@ -74,8 +75,13 @@ case "$state_should" in
|
|||
fi
|
||||
|
||||
cat << eof
|
||||
tmp=\$(mktemp)
|
||||
grep -v $greparg '$regex' '$file' > \$tmp && cat "\$tmp" > '$file' && rm -f "\$tmp"
|
||||
tmpfile=\$(mktemp ${file}.cdist.XXXXXXXXXX)
|
||||
# preserve ownership and permissions of existing file
|
||||
if [ -f "$file" ]; then
|
||||
cp -p "$file" "\$tmpfile"
|
||||
fi
|
||||
grep -v $greparg '$regex' '$file' > \$tmpfile || true
|
||||
mv -f "\$tmpfile" "$file"
|
||||
eof
|
||||
;;
|
||||
*)
|
||||
|
|
Loading…
Reference in a new issue