use TMP, sponge, refactoring

This commit is contained in:
Patrick Schleizer 2024-11-25 15:44:00 -05:00
parent 62a551cfe3
commit d32cb8c95b
No known key found for this signature in database
GPG Key ID: CB8D50BB77BB3C48

View File

@ -4,10 +4,10 @@
## See the file COPYING for copying conditions.
write_pid_file() {
safe-rm -rf /tmp/security-misc-apt-get-update-pid;
install -m644 /dev/null /tmp/security-misc-apt-get-update-pid \
|| exit 1
echo "$$" > /tmp/security-misc-apt-get-update-pid
[[ -z "${TMP:-}" ]] && error "TMP is unset"
safe-rm -rf "$TMP/security-misc-apt-get-update-pid";
install -m644 /dev/null "$TMP/security-misc-apt-get-update-pid" || exit 1
echo "$$" | sponge -- "$TMP/security-misc-apt-get-update-pid"
}
sigterm_trap() {