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 Package: security-misc
Architecture: all Architecture: all
Depends: ${misc:Depends} Depends: expect, ${misc:Depends}
Replaces: tcp-timestamps-disable Replaces: tcp-timestamps-disable
Description: enhances misc security settings Description: enhances misc security settings
The following settings are changed: The following settings are changed:

View File

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