From 9cb28353e7e04ceec3255cebd277975e9bb9ed86 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 23 Mar 2021 12:23:39 +0100 Subject: [PATCH] Add a helper function to run apt-get This simplifies the script and allows to log the commands in the build log. --- build/tools/before_install.sh | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/build/tools/before_install.sh b/build/tools/before_install.sh index 52c9befce9..4dcea0450c 100755 --- a/build/tools/before_install.sh +++ b/build/tools/before_install.sh @@ -9,8 +9,13 @@ SUDO=sudo case $(uname -s) in Linux) if [ -f /etc/apt/sources.list ]; then - # Disable some (but not all) output. - apt_quiet='-q -o=Dpkg::Use-Pty=0' + run_apt() { + echo "Running apt-get $@" + + # Disable some (but not all) output. + $SUDO apt-get -q -o=Dpkg::Use-Pty=0 "$@" + + } if [ "$wxUSE_ASAN" = 1 ]; then codename=$(lsb_release --codename --short) @@ -21,7 +26,7 @@ case $(uname -s) in # Import the debug symbol archive signing key from the Ubuntu server. # Note that this command works only on Ubuntu 18.04 LTS and newer. - $SUDO apt-get $apt_quiet install -y ubuntu-dbgsym-keyring + run_apt install -y ubuntu-dbgsym-keyring # The key in the package above is currently (2021-03-22) out of # date, so get the latest key manually (this is completely @@ -32,7 +37,7 @@ case $(uname -s) in pkg_install='libfontconfig1-dbgsym libglib2.0-0-dbgsym libgtk-3-0-dbgsym libatk-bridge2.0-0-dbgsym' fi - $SUDO apt-get $apt_quiet update + run_apt update case "$wxCONFIGURE_FLAGS" in *--with-directfb*) libtoolkit_dev='libdirectfb-dev' ;; @@ -71,7 +76,7 @@ case $(uname -s) in fi done - $SUDO apt-get $apt_quiet install -y $pkg_install + run_apt install -y $pkg_install fi ;;