2016-12-25 01:29:31 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2019-10-31 11:19:44 -04:00
|
|
|
## Copyright (C) 2012 - 2019 ENCRYPTED SUPPORT LP <adrelanos@riseup.net>
|
2016-12-25 01:29:31 +00:00
|
|
|
## See the file COPYING for copying conditions.
|
|
|
|
|
|
|
|
sigterm_trap() {
|
|
|
|
if [ "$lastpid" = "" ]; then
|
|
|
|
exit 143
|
|
|
|
fi
|
2016-12-25 02:33:44 +00:00
|
|
|
ps -p "$lastpid" >/dev/null 2>&1
|
2016-12-25 01:29:31 +00:00
|
|
|
if [ ! "$?" = "0" ]; then
|
|
|
|
## Already terminated.
|
|
|
|
exit 143
|
|
|
|
fi
|
2019-04-05 14:06:00 -04:00
|
|
|
kill -s sigterm "$lastpid"
|
2016-12-25 01:29:31 +00:00
|
|
|
exit 143
|
|
|
|
}
|
|
|
|
|
2016-12-25 02:33:44 +00:00
|
|
|
trap "sigterm_trap" SIGTERM SIGINT
|
2016-12-25 01:29:31 +00:00
|
|
|
|
2017-02-08 14:26:26 +00:00
|
|
|
timeout_after="240"
|
2016-12-25 01:29:31 +00:00
|
|
|
kill_after="10"
|
|
|
|
|
|
|
|
timeout \
|
|
|
|
--kill-after="$kill_after" \
|
|
|
|
"$timeout_after" \
|
2016-12-25 01:36:04 +00:00
|
|
|
/usr/lib/security-misc/apt-get-wrapper update &
|
2016-12-25 01:29:31 +00:00
|
|
|
|
|
|
|
lastpid="$!"
|
|
|
|
wait "$lastpid"
|
|
|
|
|
|
|
|
exit "$?"
|