forked from ungleich-public/cdist
Merge pull request #205 from asteven/issue/205
__ssh_authorized_keys resets owner and permissions of the ~/.ssh/authorized_keys file when removing an existing/updated entry
This commit is contained in:
commit
393d335f40
1 changed files with 5 additions and 3 deletions
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/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.
|
# This file is part of cdist.
|
||||||
#
|
#
|
||||||
|
@ -47,7 +47,9 @@ remove_entry() {
|
||||||
prefix="#cdist:$__object_name"
|
prefix="#cdist:$__object_name"
|
||||||
suffix="#/cdist:$__object_name"
|
suffix="#/cdist:$__object_name"
|
||||||
cat << DONE
|
cat << DONE
|
||||||
tmpfile=\$(mktemp)
|
tmpfile=\$(mktemp ${file}.cdist.XXXXXXXXXX)
|
||||||
|
# preserve ownership and permissions by copying existing file over tmpfile
|
||||||
|
cp -p "$file" "\$tmpfile"
|
||||||
awk -v prefix="$prefix" -v suffix="$suffix" '
|
awk -v prefix="$prefix" -v suffix="$suffix" '
|
||||||
{
|
{
|
||||||
if (index(\$0,prefix)) {
|
if (index(\$0,prefix)) {
|
||||||
|
|
Loading…
Reference in a new issue