|
9 | 9 | # If RUSTUP_UPDATE_ROOT is unset or empty, default it.
|
10 | 10 | RUSTUP_UPDATE_ROOT="${RUSTUP_UPDATE_ROOT:-https://static.rust-lang.org/rustup}"
|
11 | 11 |
|
| 12 | +ARCH= |
| 13 | + |
12 | 14 | #XXX: If you change anything here, please make the same changes in setup_mode.rs
|
13 | 15 | usage() {
|
14 | 16 | cat 1>&2 <<EOF
|
@@ -46,17 +48,17 @@ main() {
|
46 | 48 | need_cmd rmdir
|
47 | 49 |
|
48 | 50 | get_architecture || return 1
|
49 |
| - local _arch="$RETVAL" |
50 |
| - assert_nz "$_arch" "arch" |
| 51 | + ARCH="$RETVAL" |
| 52 | + assert_nz "$ARCH" "arch" |
51 | 53 |
|
52 | 54 | local _ext=""
|
53 |
| - case "$_arch" in |
| 55 | + case "$ARCH" in |
54 | 56 | *windows*)
|
55 | 57 | _ext=".exe"
|
56 | 58 | ;;
|
57 | 59 | esac
|
58 | 60 |
|
59 |
| - local _url="${RUSTUP_UPDATE_ROOT}/dist/${_arch}/rustup-init${_ext}" |
| 61 | + local _url="${RUSTUP_UPDATE_ROOT}/dist/${ARCH}/rustup-init${_ext}" |
60 | 62 |
|
61 | 63 | local _dir
|
62 | 64 | _dir="$(mktemp -d 2>/dev/null || ensure mktemp -d -t rustup)"
|
@@ -413,15 +415,21 @@ check_help_for() {
|
413 | 415 | _ok="y"
|
414 | 416 | shift
|
415 | 417 |
|
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" |
| 418 | + case "$ARCH" in |
| 419 | + |
| 420 | + # If we're running on OS-X, older than 10.13, then we always |
| 421 | + # fail to find these options to force fallback |
| 422 | + *darwin*) |
| 423 | + if check_cmd sw_vers; then |
| 424 | + if [ "$(sw_vers -productVersion | cut -d. -f2)" -lt 13 ]; then |
| 425 | + # Older than 10.13 |
| 426 | + echo "Warning: Detected OS X platform older than 10.13" |
| 427 | + _ok="n" |
| 428 | + fi |
423 | 429 | fi
|
424 |
| - fi |
| 430 | + ;; |
| 431 | + |
| 432 | + esac |
425 | 433 |
|
426 | 434 | for _arg in "$@"; do
|
427 | 435 | if ! "$_cmd" --help | grep -q -- "$_arg"; then
|
|
0 commit comments