From 5653b7732ae47b7e8e38e2c363aff4ef724c0484 Mon Sep 17 00:00:00 2001 From: Patrick Schleizer Date: Sun, 26 Feb 2017 23:57:17 +0000 Subject: [PATCH] fix, show progress during apt-get-wrapper fix, propagate signals to apt-get child process --- debian/control | 2 +- usr/lib/security-misc/apt-get-wrapper | 25 +++++++++---------------- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/debian/control b/debian/control index aa8ec04..0eb5544 100644 --- a/debian/control +++ b/debian/control @@ -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: diff --git a/usr/lib/security-misc/apt-get-wrapper b/usr/lib/security-misc/apt-get-wrapper index f1374e1..fe1f2ef 100755 --- a/usr/lib/security-misc/apt-get-wrapper +++ b/usr/lib/security-misc/apt-get-wrapper @@ -1,7 +1,7 @@ #!/bin/bash ## This file is part of Whonix. -## Copyright (C) 2012 - 2014 Patrick Schleizer +## Copyright (C) 2012 - 2017 Patrick Schleizer ## 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}"