]> git.ipfire.org Git - thirdparty/dehydrated.git/commitdiff
temporarily store raw curl version output to fix check (fixes #717)
authorLukas Schauer <lukas@schauer.so>
Tue, 28 Apr 2020 18:58:46 +0000 (20:58 +0200)
committerLukas Schauer <lukas@schauer.so>
Tue, 28 Apr 2020 18:58:46 +0000 (20:58 +0200)
dehydrated

index 0e40833dfaed0306667cce4f1d7f2ae76b1889fa..b75a2e3b8a984b8f75a3c67949792880f0021857 100755 (executable)
@@ -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() {