apt: use its new colour support

apt v2.0.1 introduced support for coloured E:/W:/N: labels. this adds
support to control it based upon our own colour control.

note that with utilities like dpkg we do not do this, but apt only uses
its new colour support automatically when `apt` is used directly, it is
not automatically enabled (per isatty()) for `apt-get`/`aptitude` (the
`apt` developer responsible for adding colour support in response to my
request for it told me that it was deliberately done like this per being
customary to not change behaviour of those tools for compatibility
reasons). colour errors/warnings are useful, so we want to turn it on for
our use of these tools where we can.

Gbp-Dch: Short
This commit is contained in:
Lyndon Brown 2020-03-24 19:35:20 +00:00
parent 8775c8075c
commit 3c4d07ff18
1 changed files with 9 additions and 0 deletions

View File

@ -219,6 +219,15 @@ Set_config_defaults ()
_QUIET="${_QUIET:-false}"
_VERBOSE="${_VERBOSE:-false}"
# Apt v2.0.1 introduced color support, but it needs to be explicitly enabled
if [ "${_COLOR_OUT}" = "true" ] && [ "${_COLOR_ERR}" = "true" ]; then
APT_OPTIONS="${APT_OPTIONS} -o APT::Color=true"
APTITUDE_OPTIONS="${APTITUDE_OPTIONS} -o APT::Color=true"
else
APT_OPTIONS="${APT_OPTIONS} -o APT::Color=false"
APTITUDE_OPTIONS="${APTITUDE_OPTIONS} -o APT::Color=false"
fi
## config/bootstrap
# Setting mirrors