From ba99aec1b7cad7d690a27c2f6614a0643646ce67 Mon Sep 17 00:00:00 2001 From: Tim Crawford Date: Mon, 22 Feb 2021 15:47:15 -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 ecca65f..51eed66 100755 --- a/scripts/deps.sh +++ b/scripts/deps.sh @@ -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)"