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:31:13 -07:00
committed by Jeremy Soller
parent 07dfef8cb9
commit 541f4f3f13

View File

@ -80,12 +80,14 @@ curl -sSf https://review.coreboot.org/tools/hooks/commit-msg \
-o .git/modules/coreboot/hooks/commit-msg && \
chmod +x .git/modules/coreboot/hooks/commit-msg
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 ~/.cargo/env
msg "Loading Rust environment"
source "${HOME}/.cargo/env"
fi
msg "Installing pinned Rust toolchain"
rustup toolchain install "$(cat rust-toolchain)"