]> git.lizzy.rs Git - rust.git/commitdiff
build: check if RTIM is not installed
authorLzu Tao <taolzu@gmail.com>
Thu, 28 Nov 2019 11:12:01 +0000 (18:12 +0700)
committerLzu Tao <taolzu@gmail.com>
Thu, 28 Nov 2019 11:12:01 +0000 (18:12 +0700)
setup-toolchain.sh

index 9110d7dbffc0b66f2d118192f9e74edac99af104..2388f94ae66b740fee9f6d68cd1b4342e7b55af9 100755 (executable)
@@ -5,12 +5,11 @@ set -e
 
 cd "$(dirname "$0")"
 
-RTIM_PATH=$(command -v rustup-toolchain-install-master)
+RTIM_PATH=$(command -v rustup-toolchain-install-master) || INSTALLED=false
 CARGO_HOME=${CARGO_HOME:-$HOME/.cargo}
 
-# Check if people also install RTIM in other locations beside
-# ~/.cargo/bin
-if [[ "$RTIM_PATH" == $CARGO_HOME/bin/rustup-toolchain-install-master ]]; then
+# Check if RTIM is not installed or installed in other locations not in ~/.cargo/bin
+if [[ "$INSTALLED" == false || "$RTIM_PATH" == $CARGO_HOME/bin/rustup-toolchain-install-master ]]; then
     cargo +nightly install rustup-toolchain-install-master
 else
     VERSION=$(rustup-toolchain-install-master -V | grep -o "[0-9.]*")