Patrick Schleizer 2d37e3a1af
copyright
2022-05-20 14:46:38 -04:00

33 lines
634 B
Bash
Executable File

#!/bin/bash
## Copyright (C) 2012 - 2022 ENCRYPTED SUPPORT LP <adrelanos@whonix.org>
## See the file COPYING for copying conditions.
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
[ -n "$timeout_after" ] || timeout_after="600"
[ -n "$kill_after" ] || kill_after="10"
timeout \
--kill-after="$kill_after" \
"$timeout_after" \
apt-get update --error-on=any "$@" &
lastpid="$!"
wait "$lastpid"
exit "$?"