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
This commit is contained in:
Ian Wienand 2021-06-24 10:09:00 +10:00
parent 75ee18b01b
commit ba5bcce036

View File

@ -21,6 +21,11 @@ fi
set -eu set -eu
set -o pipefail 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 # Download a URL to a local cache
# e.g. cache-url http://.../foo ~/.cache/image-create/foo # e.g. cache-url http://.../foo ~/.cache/image-create/foo
@ -86,7 +91,7 @@ else
success="Downloaded and cached $url for the first time" success="Downloaded and cached $url for the first time"
fi 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 if [ "$rcode" == "200" -o "${url:0:7}" == "file://" ] ; then
# In cases where servers ignore the Modified time, # In cases where servers ignore the Modified time,
# curl cancels the download, outputs a 200 and leaves # curl cancels the download, outputs a 200 and leaves