fix, show progress during apt-get-wrapper

fix, propagate signals to apt-get child process
This commit is contained in:
Patrick Schleizer 2017-02-26 23:57:17 +00:00
parent 49cde21078
commit 5653b7732a
No known key found for this signature in database
GPG Key ID: CB8D50BB77BB3C48
2 changed files with 10 additions and 17 deletions

2
debian/control vendored
View File

@ -13,7 +13,7 @@ Standards-Version: 3.9.8
Package: security-misc
Architecture: all
Depends: ${misc:Depends}
Depends: expect, ${misc:Depends}
Replaces: tcp-timestamps-disable
Description: enhances misc security settings
The following settings are changed:

View File

@ -1,7 +1,7 @@
#!/bin/bash
## This file is part of Whonix.
## Copyright (C) 2012 - 2014 Patrick Schleizer <adrelanos@riseup.net>
## Copyright (C) 2012 - 2017 Patrick Schleizer <adrelanos@riseup.net>
## See the file COPYING for copying conditions.
set -e
@ -15,35 +15,28 @@ cleanup() {
}
temp_dir="$(mktemp --directory)"
logfile="$temp_dir/log"
tee_fifo="$temp_dir/tee_fifo"
trap "cleanup" EXIT
mkfifo "$tee_fifo"
## TODO
exec 2>&1
tee "$logfile" < "$tee_fifo" &
tee_pid="$!"
exec 3>&1
exec 1> >(tee -a "$logfile")
apt-get \
"$@" \
1> "$tee_fifo" \
2> "$tee_fifo" \
&
## TODO
#exec 4>&2
#exec 2> >(tee -a "$logfile")
apt_get_pid="$!"
unbuffer apt-get "$@"
wait "$tee_pid"
wait "$apt_get_pid"
apt_get_exit_code="$?"
if [ ! "$apt_get_exit_code" = "0" ]; then
exit "$apt_get_exit_code"
fi
log="$(cat "$logfile")"
while read -r -d $'\n' line; do
line_lower_case="${line,,}"
first_two="${line_lower_case:0:2}"