@@ -97,7 +97,7 @@ main() {
9797 fi
9898
9999 ensure mkdir -p " $_dir "
100- ensure downloader " $_url " " $_file "
100+ ensure downloader " $_url " " $_file " " $_arch "
101101 ensure chmod u+x " $_file "
102102 if [ ! -x " $_file " ]; then
103103 printf ' %s\n' " Cannot execute $_file (likely because of mounting /tmp as noexec)." 1>&2
@@ -387,14 +387,14 @@ downloader() {
387387 if [ " $1 " = --check ]; then
388388 need_cmd " $_dld "
389389 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
391391 echo " Warning: Not forcing TLS v1.2, this is potentially less secure"
392392 curl --silent --show-error --fail --location " $1 " --output " $2 "
393393 else
394394 curl --proto ' =https' --tlsv1.2 --silent --show-error --fail --location " $1 " --output " $2 "
395395 fi
396396 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
398398 echo " Warning: Not forcing TLS v1.2, this is potentially less secure"
399399 wget " $1 " -O " $2 "
400400 else
@@ -406,22 +406,31 @@ downloader() {
406406}
407407
408408check_help_for () {
409+ local _arch
409410 local _cmd
410411 local _arg
411412 local _ok
413+ _arch=" $1 "
414+ shift
412415 _cmd=" $1 "
413416 _ok=" y"
414417 shift
415418
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
423430 fi
424- fi
431+ ;;
432+
433+ esac
425434
426435 for _arg in " $@ " ; do
427436 if ! " $_cmd " --help | grep -q -- " $_arg " ; then
0 commit comments