mirror of
https://github.com/Kicksecure/security-misc.git
synced 2024-12-23 01:03:35 +07:00
Make apt-get-update able to be terminated securely
This commit is contained in:
parent
af43472d0c
commit
d7475e252a
@ -3,6 +3,13 @@
|
|||||||
## Copyright (C) 2012 - 2024 ENCRYPTED SUPPORT LP <adrelanos@whonix.org>
|
## Copyright (C) 2012 - 2024 ENCRYPTED SUPPORT LP <adrelanos@whonix.org>
|
||||||
## See the file COPYING for copying conditions.
|
## 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
|
||||||
|
}
|
||||||
|
|
||||||
sigterm_trap() {
|
sigterm_trap() {
|
||||||
if [ "$lastpid" = "" ]; then
|
if [ "$lastpid" = "" ]; then
|
||||||
exit 143
|
exit 143
|
||||||
@ -21,6 +28,8 @@ trap "sigterm_trap" SIGTERM SIGINT
|
|||||||
[ -n "$timeout_after" ] || timeout_after="600"
|
[ -n "$timeout_after" ] || timeout_after="600"
|
||||||
[ -n "$kill_after" ] || kill_after="10"
|
[ -n "$kill_after" ] || kill_after="10"
|
||||||
|
|
||||||
|
write_pid_file
|
||||||
|
|
||||||
timeout \
|
timeout \
|
||||||
--kill-after="$kill_after" \
|
--kill-after="$kill_after" \
|
||||||
"$timeout_after" \
|
"$timeout_after" \
|
||||||
|
Loading…
Reference in New Issue
Block a user