forked from ungleich-public/cdist
__block: fix escaping in here-doc
This changes the here-document to do not interpret any shell-things. It also single-quotes some more strings that are printed to code-remote. Fixes #838
This commit is contained in:
parent
23e0da521c
commit
3930f69456
1 changed files with 6 additions and 6 deletions
|
@ -46,10 +46,10 @@ fi
|
||||||
|
|
||||||
remove_block() {
|
remove_block() {
|
||||||
cat << DONE
|
cat << DONE
|
||||||
tmpfile=\$(mktemp ${file}.cdist.XXXXXXXXXX)
|
tmpfile=\$(mktemp '${file}.cdist.XXXXXXXXXX')
|
||||||
# preserve ownership and permissions of existing file
|
# preserve ownership and permissions of existing file
|
||||||
if [ -f "$file" ]; then
|
if [ -f '$file' ]; then
|
||||||
cp -p "$file" "\$tmpfile"
|
cp -p '$file' "\$tmpfile"
|
||||||
fi
|
fi
|
||||||
awk -v prefix=^$(quote "$prefix")\$ -v suffix=^$(quote "$suffix")\$ '
|
awk -v prefix=^$(quote "$prefix")\$ -v suffix=^$(quote "$suffix")\$ '
|
||||||
{
|
{
|
||||||
|
@ -63,8 +63,8 @@ awk -v prefix=^$(quote "$prefix")\$ -v suffix=^$(quote "$suffix")\$ '
|
||||||
} else {
|
} else {
|
||||||
print
|
print
|
||||||
}
|
}
|
||||||
}' "$file" > "\$tmpfile"
|
}' '$file' > "\$tmpfile"
|
||||||
mv -f "\$tmpfile" "$file"
|
mv -f "\$tmpfile" '$file'
|
||||||
DONE
|
DONE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ case "$state_should" in
|
||||||
echo add >> "$__messages_out"
|
echo add >> "$__messages_out"
|
||||||
fi
|
fi
|
||||||
cat << DONE
|
cat << DONE
|
||||||
cat >> "$file" << ${__type##*/}_DONE
|
cat >> '$file' << '${__type##*/}_DONE'
|
||||||
$(cat "$block")
|
$(cat "$block")
|
||||||
${__type##*/}_DONE
|
${__type##*/}_DONE
|
||||||
DONE
|
DONE
|
||||||
|
|
Loading…
Reference in a new issue