Skip to content

Commit c054ae2

Browse files
committed
Merge branch 'fix-rustup' of https://github.com/richo/rust
2 parents 8943653 + ee3dffa commit c054ae2

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

src/etc/rustup.sh

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ VAL_OPTIONS=""
288288
flag uninstall "only uninstall from the installation prefix"
289289
valopt prefix "" "set installation prefix"
290290
valopt date "" "use the YYYY-MM-DD nightly instead of the current nightly"
291+
valopt channel "nightly" "use the selected release channel [nightly]"
291292
flag save "save the downloaded nightlies to ~/.rustup"
292293

293294
if [ $HELP -eq 1 ]
@@ -307,7 +308,7 @@ CFG_CPUTYPE=$(uname -m)
307308

308309
if [ $CFG_OSTYPE = Darwin -a $CFG_CPUTYPE = i386 ]
309310
then
310-
# Darwin's `uname -s` lies and always returns i386. We have to use sysctl
311+
# Darwin's `uname -m` lies and always returns i386. We have to use sysctl
311312
# instead.
312313
if sysctl hw.optional.x86_64 | grep -q ': 1'
313314
then
@@ -449,18 +450,25 @@ then
449450
fi
450451

451452
RUST_URL="https://static.rust-lang.org/dist"
452-
RUST_PACKAGE_NAME=rust-nightly
453+
case "$CFG_CHANNEL" in
454+
nightly)
455+
# add a date suffix if we want a particular nighly.
456+
if [ -n "${CFG_DATE}" ];
457+
then
458+
RUST_URL="${RUST_URL}/${CFG_DATE}"
459+
fi
460+
461+
RUST_PACKAGE_NAME=rust-nightly
462+
;;
463+
*)
464+
err "Currently nightly is the only supported release channel"
465+
esac
466+
453467
RUST_PACKAGE_NAME_AND_TRIPLE="${RUST_PACKAGE_NAME}-${HOST_TRIPLE}"
454468
RUST_TARBALL_NAME="${RUST_PACKAGE_NAME_AND_TRIPLE}.tar.gz"
455469
RUST_LOCAL_INSTALL_DIR="${CFG_TMP_DIR}/${RUST_PACKAGE_NAME_AND_TRIPLE}"
456470
RUST_LOCAL_INSTALL_SCRIPT="${RUST_LOCAL_INSTALL_DIR}/install.sh"
457471

458-
# add a date suffix if we want a particular nighly.
459-
if [ -n "${CFG_DATE}" ];
460-
then
461-
RUST_URL="${RUST_URL}/${CFG_DATE}"
462-
fi
463-
464472
download_hash() {
465473
msg "Downloading ${remote_sha256}"
466474
remote_sha256=`"${CFG_CURL}" -f "${remote_sha256}"`

0 commit comments

Comments
 (0)