Skip to content

Commit ee3dffa

Browse files
committed
Add support for channel selection
1 parent fb78ca8 commit ee3dffa

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

src/etc/rustup.sh

Lines changed: 15 additions & 7 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 ]
@@ -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)