diff --git a/rustup-init.sh b/rustup-init.sh index b28e546e1b..6adeb83d07 100755 --- a/rustup-init.sh +++ b/rustup-init.sh @@ -9,8 +9,6 @@ set -u # If RUSTUP_UPDATE_ROOT is unset or empty, default it. RUSTUP_UPDATE_ROOT="${RUSTUP_UPDATE_ROOT:-https://static.rust-lang.org/rustup}" -ARCH= - #XXX: If you change anything here, please make the same changes in setup_mode.rs usage() { cat 1>&2 <&2 @@ -381,14 +379,14 @@ downloader() { if [ "$1" = --check ]; then need_cmd "$_dld" elif [ "$_dld" = curl ]; then - if ! check_help_for curl --proto --tlsv1.2; then + if ! check_help_for "$3" curl --proto --tlsv1.2; then echo "Warning: Not forcing TLS v1.2, this is potentially less secure" curl --silent --show-error --fail --location "$1" --output "$2" else curl --proto '=https' --tlsv1.2 --silent --show-error --fail --location "$1" --output "$2" fi elif [ "$_dld" = wget ]; then - if ! check_help_for wget --https-only --secure-protocol; then + if ! check_help_for "$3" wget --https-only --secure-protocol; then echo "Warning: Not forcing TLS v1.2, this is potentially less secure" wget "$1" -O "$2" else @@ -400,14 +398,17 @@ downloader() { } check_help_for() { + local _arch local _cmd local _arg local _ok + _arch="$1" + shift _cmd="$1" _ok="y" shift - case "$ARCH" in + case "$_arch" in # If we're running on OS-X, older than 10.13, then we always # fail to find these options to force fallback