From 1cb61e69186d7dcb6d12c3b155a637229da4b619 Mon Sep 17 00:00:00 2001 From: Tim Crawford Date: Fri, 14 Jan 2022 09:30:09 -0700 Subject: [PATCH] deps.sh: Update rustup or inform user of env vars Ensure rustup is up-to-date to avoid users having a version that is too old to support the TOML format. If rustup was just installed, tell the user to source the new env vars to use the correct version of the toolchain. Signed-off-by: Tim Crawford --- scripts/deps.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/scripts/deps.sh b/scripts/deps.sh index 65ca8d754..a5ebec143 100755 --- a/scripts/deps.sh +++ b/scripts/deps.sh @@ -23,7 +23,7 @@ if [[ "${ID}" =~ "debian" ]] || [[ "${ID_LIKE}" =~ "debian" ]]; then gcc \ gcc-avr \ libc-dev \ - libhidapi-dev \ + libhidapi-dev \ libudev-dev \ make \ pkgconf \ @@ -63,7 +63,12 @@ fi msg "Initializing submodules" git submodule update --init --recursive -if ! which rustup &> /dev/null; then +RUSTUP_NEW_INSTALL=0 +if which rustup &> /dev/null; then + msg "Updating rustup" + rustup self update +else + RUSTUP_NEW_INSTALL=1 msg "Installing Rust" curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \ | sh -s -- -y --default-toolchain none @@ -75,4 +80,9 @@ fi msg "Installing pinned Rust toolchain and components" rustup show +if [[ $RUSTUP_NEW_INSTALL = 1 ]]; then + msg "rustup was just installed. Ensure cargo is on the PATH with:" + echo -e " source ~/.cargo/env\n" +fi + msg "\x1B[32mSuccessfully installed dependencies"