summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLyndon Brown <jnqnfe@gmail.com>2020-03-24 19:35:20 +0000
committerLyndon Brown <jnqnfe@gmail.com>2020-03-27 21:05:52 +0000
commit3c4d07ff1802d6834fbe36583438b98e1ad420ee (patch)
treee888b21333155c96cf9eb9be2c9bb0366b390ba1
parent8775c8075c657b820ae35f068f7253cbe7b10d74 (diff)
downloadvyos-live-build-3c4d07ff1802d6834fbe36583438b98e1ad420ee.tar.gz
vyos-live-build-3c4d07ff1802d6834fbe36583438b98e1ad420ee.zip
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
-rwxr-xr-xfunctions/defaults.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/functions/defaults.sh b/functions/defaults.sh
index 2b7a1e27b..daeb7ca78 100755
--- a/functions/defaults.sh
+++ b/functions/defaults.sh
@@ -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