deps: Skip installing Rust if rustup is available

Saves time and prevents errors with trying to install rustup twice or
potentially overriding the user's default toolchain.
This commit is contained in:
Tim Crawford 2021-02-22 15:47:15 -07:00 committed by Jeremy Soller
parent 71534e736c
commit ba99aec1b7

View File

@ -40,12 +40,14 @@ fi
msg "Initializing submodules"
git submodule update --init --recursive
msg "Installing Rust"
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
| sh -s -- -y --default-toolchain nightly
if ! which rustup &> /dev/null; then
msg "Installing Rust"
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
| sh -s -- -y --default-toolchain none
msg "Loading Rust environment"
source "${HOME}/.cargo/env"
msg "Loading Rust environment"
source "${HOME}/.cargo/env"
fi
msg "Installing pinned Rust toolchain"
rustup toolchain install "$(cat rust-toolchain)"