From ba5bcce0360f58e8f1b20e8bef8ea5bc957d4eb5 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Thu, 24 Jun 2021 10:09:00 +1000 Subject: [PATCH] cache-url : turn down verbose curl curl's "-v" is a bit too verbose for "-x", especially when what you're downloading bounces through a few redirects as is common. Turn this down and put it behind "-xx" or greater. Change-Id: I6d91166bb237f2a1818cae7532e794ef0f01288b --- diskimage_builder/elements/cache-url/bin/cache-url | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/diskimage_builder/elements/cache-url/bin/cache-url b/diskimage_builder/elements/cache-url/bin/cache-url index dee05d6e..3fa4abae 100755 --- a/diskimage_builder/elements/cache-url/bin/cache-url +++ b/diskimage_builder/elements/cache-url/bin/cache-url @@ -21,6 +21,11 @@ fi set -eu set -o pipefail +CURL_DASH_V='' +if [ ${DIB_DEBUG_TRACE:-0} -gt 1 ]; then + CURL_DASH_V='-v' +fi + # Download a URL to a local cache # e.g. cache-url http://.../foo ~/.cache/image-create/foo @@ -86,7 +91,7 @@ else success="Downloaded and cached $url for the first time" fi -rcode=$(curl -v -L -o $tmp -w '%{http_code}' --connect-timeout 10 "${curl_opts[@]}" $url $time_cond) +rcode=$(curl ${CURL_DASH_V} -L -o $tmp -w '%{http_code}' --connect-timeout 10 "${curl_opts[@]}" $url $time_cond) if [ "$rcode" == "200" -o "${url:0:7}" == "file://" ] ; then # In cases where servers ignore the Modified time, # curl cancels the download, outputs a 200 and leaves