@@ -386,6 +386,8 @@ ignore() {
386
386
downloader () {
387
387
local _dld
388
388
local _ciphersuites
389
+ local _err
390
+ local _status
389
391
if check_cmd curl; then
390
392
_dld=curl
391
393
elif check_cmd wget; then
@@ -400,30 +402,50 @@ downloader() {
400
402
get_ciphersuites_for_curl
401
403
_ciphersuites=" $RETVAL "
402
404
if [ -n " $_ciphersuites " ]; then
403
- curl --proto ' =https' --tlsv1.2 --ciphers " $_ciphersuites " --silent --show-error --fail --location " $1 " --output " $2 "
405
+ _err=$( curl --proto ' =https' --tlsv1.2 --ciphers " $_ciphersuites " --silent --show-error --fail --location " $1 " --output " $2 " 2>&1 )
406
+ _status=$?
404
407
else
405
408
echo " Warning: Not enforcing strong cipher suites for TLS, this is potentially less secure"
406
409
if ! check_help_for " $3 " curl --proto --tlsv1.2; then
407
410
echo " Warning: Not enforcing TLS v1.2, this is potentially less secure"
408
- curl --silent --show-error --fail --location " $1 " --output " $2 "
411
+ _err=$( curl --silent --show-error --fail --location " $1 " --output " $2 " 2>&1 )
412
+ _status=$?
409
413
else
410
- curl --proto ' =https' --tlsv1.2 --silent --show-error --fail --location " $1 " --output " $2 "
414
+ _err=$( curl --proto ' =https' --tlsv1.2 --silent --show-error --fail --location " $1 " --output " $2 " 2>&1 )
415
+ _status=$?
411
416
fi
412
417
fi
418
+ if [ -n " $_err " ]; then
419
+ echo " $_err " >&2
420
+ if echo " $_err " | grep -q 404$; then
421
+ err " unsupported platform $3 "
422
+ fi
423
+ fi
424
+ return $_status
413
425
elif [ " $_dld " = wget ]; then
414
426
get_ciphersuites_for_wget
415
427
_ciphersuites=" $RETVAL "
416
428
if [ -n " $_ciphersuites " ]; then
417
- wget --https-only --secure-protocol=TLSv1_2 --ciphers " $_ciphersuites " " $1 " -O " $2 "
429
+ _err=$( wget --https-only --secure-protocol=TLSv1_2 --ciphers " $_ciphersuites " " $1 " -O " $2 " 2>&1 )
430
+ _status=$?
418
431
else
419
432
echo " Warning: Not enforcing strong cipher suites for TLS, this is potentially less secure"
420
433
if ! check_help_for " $3 " wget --https-only --secure-protocol; then
421
434
echo " Warning: Not enforcing TLS v1.2, this is potentially less secure"
422
- wget " $1 " -O " $2 "
435
+ _err=$( wget " $1 " -O " $2 " 2>&1 )
436
+ _status=$?
423
437
else
424
- wget --https-only --secure-protocol=TLSv1_2 " $1 " -O " $2 "
438
+ _err=$( wget --https-only --secure-protocol=TLSv1_2 " $1 " -O " $2 " 2>&1 )
439
+ _status=$?
440
+ fi
441
+ fi
442
+ if [ -n " $_err " ]; then
443
+ echo " $_err " >&2
444
+ if echo " $_err " | grep -q ' ERROR 404: Not Found\.$' ; then
445
+ err " unsupported platform $3 "
425
446
fi
426
447
fi
448
+ return $_status
427
449
else
428
450
err " Unknown downloader" # should not reach here
429
451
fi
0 commit comments