@@ -97,7 +97,7 @@ main() {
97
97
fi
98
98
99
99
ensure mkdir -p " $_dir "
100
- ensure downloader " $_url " " $_file "
100
+ ensure downloader " $_url " " $_file " " $_arch "
101
101
ensure chmod u+x " $_file "
102
102
if [ ! -x " $_file " ]; then
103
103
printf ' %s\n' " Cannot execute $_file (likely because of mounting /tmp as noexec)." 1>&2
@@ -387,14 +387,14 @@ downloader() {
387
387
if [ " $1 " = --check ]; then
388
388
need_cmd " $_dld "
389
389
elif [ " $_dld " = curl ]; then
390
- if ! check_help_for curl --proto --tlsv1.2; then
390
+ if ! check_help_for " $3 " curl --proto --tlsv1.2; then
391
391
echo " Warning: Not forcing TLS v1.2, this is potentially less secure"
392
392
curl --silent --show-error --fail --location " $1 " --output " $2 "
393
393
else
394
394
curl --proto ' =https' --tlsv1.2 --silent --show-error --fail --location " $1 " --output " $2 "
395
395
fi
396
396
elif [ " $_dld " = wget ]; then
397
- if ! check_help_for wget --https-only --secure-protocol; then
397
+ if ! check_help_for " $3 " wget --https-only --secure-protocol; then
398
398
echo " Warning: Not forcing TLS v1.2, this is potentially less secure"
399
399
wget " $1 " -O " $2 "
400
400
else
@@ -406,22 +406,31 @@ downloader() {
406
406
}
407
407
408
408
check_help_for () {
409
+ local _arch
409
410
local _cmd
410
411
local _arg
411
412
local _ok
413
+ _arch=" $1 "
414
+ shift
412
415
_cmd=" $1 "
413
416
_ok=" y"
414
417
shift
415
418
416
- # If we're running on OS-X, older than 10.13, then we always
417
- # fail to find these options to force fallback
418
- if check_cmd sw_vers; then
419
- if [ " $( sw_vers -productVersion | cut -d. -f2) " -lt 13 ]; then
420
- # Older than 10.13
421
- echo " Warning: Detected OS X platform older than 10.13"
422
- _ok=" n"
419
+ case " $_arch " in
420
+
421
+ # If we're running on OS-X, older than 10.13, then we always
422
+ # fail to find these options to force fallback
423
+ * darwin* )
424
+ if check_cmd sw_vers; then
425
+ if [ " $( sw_vers -productVersion | cut -d. -f2) " -lt 13 ]; then
426
+ # Older than 10.13
427
+ echo " Warning: Detected OS X platform older than 10.13"
428
+ _ok=" n"
429
+ fi
423
430
fi
424
- fi
431
+ ;;
432
+
433
+ esac
425
434
426
435
for _arg in " $@ " ; do
427
436
if ! " $_cmd " --help | grep -q -- " $_arg " ; then
0 commit comments