From 541f4f3f13a35ca3074efa6a823fdf515909f028 Mon Sep 17 00:00:00 2001 From: Tim Crawford Date: Mon, 22 Feb 2021 15:31:13 -0700 Subject: [PATCH] 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. --- scripts/deps.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/scripts/deps.sh b/scripts/deps.sh index 18da899..9654ee8 100755 --- a/scripts/deps.sh +++ b/scripts/deps.sh @@ -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)"