From d7cd53a2574706ba68eb2d9b0e9bfbb9e0cea400 Mon Sep 17 00:00:00 2001 From: Matthias Wirth Date: Tue, 15 Sep 2020 20:33:52 +0200 Subject: [PATCH] minor apt update/install stuff --- setup.sh | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/setup.sh b/setup.sh index ec42077..ae13cbd 100755 --- a/setup.sh +++ b/setup.sh @@ -172,7 +172,8 @@ fi # Check that the prerequisite packages needed to build and install mlat-client are installed. - required_packages="git curl build-essential python3-dev socat ntp python3-venv libncurses5-dev netcat uuid-runtime" + required_packages="git curl build-essential python3-dev socat ntp python3-venv \ + libncurses5-dev netcat uuid-runtime zlib1g-dev zlib1g" progress=4 APT_UPDATED="false" @@ -180,19 +181,15 @@ fi for package in $required_packages do if [ $(dpkg-query -W -f='${STATUS}' $package 2>/dev/null | grep -c "ok installed") -eq 0 ]; then - if [[ "$APT_UPDATED" == "false" ]]; then - apt-get update >> $LOGFILE 2>&1 && APT_UPDATED="true" - if [[ "$APT_UPDATED" == "false" ]]; then - apt-get update >> $LOGFILE 2>&1 && APT_UPDATED="true" - fi - fi + + [[ "$APT_UPDATED" == "false" ]] && apt update >> $LOGFILE 2>&1 && APT_UPDATED="true" + [[ "$APT_UPDATED" == "false" ]] && apt update >> $LOGFILE 2>&1 && APT_UPDATED="true" + [[ "$APT_UPDATED" == "false" ]] && apt update >> $LOGFILE 2>&1 && APT_UPDATED="true" + echo Installing $package >> $LOGFILE 2>&1 - # retry twice - if ! apt-get install --no-install-recommends --no-install-suggests -y $package >> $LOGFILE 2>&1; then - apt-get update >> $LOGFILE 2>&1 && APT_UPDATED="true" - apt-get update >> $LOGFILE 2>&1 && APT_UPDATED="true" - apt-get install --no-install-recommends --no-install-suggests -y $package >> $LOGFILE 2>&1 - apt-get install --no-install-recommends --no-install-suggests -y $package >> $LOGFILE 2>&1 + if ! apt install --no-install-recommends --no-install-suggests -y $package >> $LOGFILE 2>&1; then + # retry + apt install --no-install-recommends --no-install-suggests -y $package >> $LOGFILE 2>&1 fi fi progress=$((progress+2))