Skip to content

Commit 20da8f4

Browse files
committed
Auto merge of #4168 - lzutao:fix-script, r=flip1995
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
2 parents 28a39e9 + 3fb497c commit 20da8f4

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

setup-toolchain.sh

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
#!/bin/bash
22
# Set up the appropriate rustc toolchain
33

4-
cd $(dirname $0)
4+
cd "$(dirname "$0")"
5+
6+
if ! command -v rustup-toolchain-install-master > /dev/null; then
7+
cargo install rustup-toolchain-install-master --debug
8+
fi
59

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

0 commit comments

Comments
 (0)