updates-proxy-setup: use temporary file for config snippet

Don't use ${CONF_PATH}.qubes, because it may override some existing
file, and is racy approach (even if not against user, but another script
instance).

QubesOS/qubes-issues#1282
This commit is contained in:
Marek Marczykowski-Górecki 2015-11-10 16:39:22 +01:00
parent 85793fa31f
commit f9c7394c2f
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -50,7 +50,8 @@ update_conf() {
fi
# Prepare config block
cat > ${CONF_PATH}.qubes <<EOF
local tmpfile=`mktemp`
cat > ${tmpfile} <<EOF
# This part of configuration, until QUBES END, is automatically generated by
# $0. All changes here will be overriden.
# If you want to override any option set here, set it again to desired value,
@ -62,8 +63,9 @@ EOF
sed -i -e "/^$BEGIN_MARKER$/,/^$END_MARKER$/{
/^$END_MARKER$/b
/^$BEGIN_MARKER$/!d
r ${CONF_PATH}.qubes
r ${tmpfile}
}" ${CONF_PATH}
rm -f ${tmpfile}
}
### helper functions end