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:
parent
85793fa31f
commit
f9c7394c2f
@ -50,7 +50,8 @@ update_conf() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Prepare config block
|
# 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
|
# This part of configuration, until QUBES END, is automatically generated by
|
||||||
# $0. All changes here will be overriden.
|
# $0. All changes here will be overriden.
|
||||||
# If you want to override any option set here, set it again to desired value,
|
# 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$/{
|
sed -i -e "/^$BEGIN_MARKER$/,/^$END_MARKER$/{
|
||||||
/^$END_MARKER$/b
|
/^$END_MARKER$/b
|
||||||
/^$BEGIN_MARKER$/!d
|
/^$BEGIN_MARKER$/!d
|
||||||
r ${CONF_PATH}.qubes
|
r ${tmpfile}
|
||||||
}" ${CONF_PATH}
|
}" ${CONF_PATH}
|
||||||
|
rm -f ${tmpfile}
|
||||||
}
|
}
|
||||||
|
|
||||||
### helper functions end
|
### helper functions end
|
||||||
|
Loading…
Reference in New Issue
Block a user