-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
scripts: Split installing Rust to its own script
Signed-off-by: Tim Crawford <[email protected]>
- Loading branch information
Showing
4 changed files
with
37 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/sh | ||
# SPDX-License-Identifier: GPL-3.0-only | ||
|
||
# Install Rust via rustup, along with the pinned toolchain. | ||
|
||
# shellcheck shell=dash | ||
# shellcheck disable=SC1091 | ||
|
||
set -Ee | ||
|
||
RUSTUP_NEW_INSTALL=0 | ||
|
||
# NOTE: rustup is used to allow multiple toolchain installations. | ||
if command -v rustup >/dev/null 2>&1; then | ||
rustup self update | ||
else | ||
RUSTUP_NEW_INSTALL=1 | ||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \ | ||
| sh -s -- -y --default-toolchain stable | ||
|
||
. "${HOME}/.cargo/env" | ||
fi | ||
|
||
# XXX: rustup has no command to install a toolchain from a TOML file. | ||
# Rely on the fact that `show` will install the default toolchain. | ||
rustup show | ||
|
||
if [ "$RUSTUP_NEW_INSTALL" = "1" ]; then | ||
printf "\e[33m>> rustup was just installed. Ensure cargo is on the PATH with:\e[0m\n" | ||
printf " source ~/.cargo/env\n\n" | ||
fi |