mirror of
https://github.com/Kicksecure/security-misc.git
synced 2025-02-27 00:41:12 -05:00
33 lines
634 B
Bash
Executable File
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 "$?"
|