Skip to content

Commit

Permalink
Auto merge of rust-lang#4168 - lzutao:fix-script, r=flip1995
Browse files Browse the repository at this point in the history
Do not install rustup-toolchain if it is in PATH

I find it quiet annoying because I manually build `rustup-toolchain-install-master`
and install it in `PATH` other than in `~/.cargo/bin`. So everytime I run the script,
it always reinstall `rustup-toolchain-install-master` for me.

changelog: none
  • Loading branch information
bors committed Jun 3, 2019
2 parents 28a39e9 + 3fb497c commit 20da8f4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions setup-toolchain.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
#!/bin/bash
# Set up the appropriate rustc toolchain

cd $(dirname $0)
cd "$(dirname "$0")"

if ! command -v rustup-toolchain-install-master > /dev/null; then
cargo install rustup-toolchain-install-master --debug
fi

cargo install rustup-toolchain-install-master --debug || echo "rustup-toolchain-install-master already installed"
RUSTC_HASH=$(git ls-remote https://github.com/rust-lang/rust.git master | awk '{print $1}')
rustup-toolchain-install-master -f -n master $RUSTC_HASH
rustup-toolchain-install-master -f -n master "$RUSTC_HASH"
rustup override set master

0 comments on commit 20da8f4

Please sign in to comment.