Skip to content

Commit

Permalink
deps.sh: Update rustup or inform user of env vars
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
crawfxrd authored and jackpot51 committed Jan 18, 2022
1 parent ca58502 commit 1cb61e6
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions scripts/deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ if [[ "${ID}" =~ "debian" ]] || [[ "${ID_LIKE}" =~ "debian" ]]; then
gcc \
gcc-avr \
libc-dev \
libhidapi-dev \
libhidapi-dev \
libudev-dev \
make \
pkgconf \
Expand Down Expand Up @@ -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
Expand All @@ -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"

0 comments on commit 1cb61e6

Please sign in to comment.