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 <tcrawford@system76.com>
This commit is contained in:
Tim Crawford
2022-01-14 09:30:09 -07:00
committed by Jeremy Soller
parent ca58502137
commit 1cb61e6918

View File

@ -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"