From: Lukas Schauer Date: Tue, 28 Apr 2020 18:58:46 +0000 (+0200) Subject: temporarily store raw curl version output to fix check (fixes #717) X-Git-Tag: v0.7.0~47 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4fd4d4d3c27e26d0ea2783ea4715550b6d52c0f4;p=thirdparty%2Fdehydrated.git temporarily store raw curl version output to fix check (fixes #717) --- diff --git a/dehydrated b/dehydrated index 0e40833..b75a2e3 100755 --- a/dehydrated +++ b/dehydrated @@ -47,13 +47,15 @@ check_dependencies() { command -v diff > /dev/null 2>&1 || _exiterr "This script requires diff." # curl returns with an error code in some ancient versions so we have to catch that + # storing raw version output temporarily to catch curl error instead of head/awk exit codes set +e - CURL_VERSION="$(curl -V 2>&1 | head -n1 | awk '{print $2}')" + raw_curl_version="$(curl -V 2>&1)" retcode="$?" set -e if [[ ! "${retcode}" = "0" ]] && [[ ! "${retcode}" = "2" ]]; then _exiterr "This script requires curl." fi + CURL_VERSION="$(head -n1 <<< "${raw_curl_version}" | awk '{print $2}')" } store_configvars() {