mirror of
https://github.com/Kicksecure/security-misc.git
synced 2025-03-13 09:06:33 -04:00

https://forums.kicksecure.com/t/systemcheck-reports-warning-debian-package-update-check-result-apt-get-reports-that-packages-can-be-updated-but-system-is-already-fully-upgraded/785
49 lines
979 B
Bash
Executable File
49 lines
979 B
Bash
Executable File
#!/bin/bash
|
|
|
|
## Copyright (C) 2012 - 2024 ENCRYPTED SUPPORT LP <adrelanos@whonix.org>
|
|
## See the file COPYING for copying conditions.
|
|
|
|
set -o errexit
|
|
set -o nounset
|
|
set -o errtrace
|
|
set -o pipefail
|
|
|
|
export LANG=C
|
|
|
|
write_pid_file() {
|
|
[[ -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"
|
|
echo "$$" | sponge -- "$TMP/security-misc-apt-get-update-pid"
|
|
}
|
|
|
|
sigterm_trap() {
|
|
if [ "$lastpid" = "" ]; then
|
|
exit 143
|
|
fi
|
|
ps -p "$lastpid" >/dev/null 2>&1
|
|
if [ ! "$?" = "0" ]; then
|
|
## Already terminated.
|
|
exit 143
|
|
fi
|
|
kill -s sigterm "$lastpid"
|
|
exit 143
|
|
}
|
|
|
|
trap "sigterm_trap" SIGTERM SIGINT
|
|
|
|
[[ -v timeout_after ]] || timeout_after="600"
|
|
[[ -v kill_after ]] || kill_after="10"
|
|
|
|
write_pid_file
|
|
|
|
timeout \
|
|
--kill-after="$kill_after" \
|
|
"$timeout_after" \
|
|
apt-get update --error-on=any "$@" &
|
|
|
|
lastpid="$!"
|
|
wait "$lastpid"
|
|
|
|
exit "$?"
|