Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically install rustup during setup #199

Merged
merged 1 commit into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion scripts/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ set -e

has_bin() { which $1 >/dev/null 2>&1; }

has_bin rustup || e "Missing rustup. Install from https://rustup.rs"
if ! has_bin rustup; then
i "Installing rustup according to https://rustup.rs"
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
fi

MISSING=
add_missing() {
Expand Down
8 changes: 8 additions & 0 deletions scripts/sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,11 @@ book_example button2 led
book_example timer button_abort
book_example usb memory_game
book_example store store

RUSTUP_CMD="$(curl -s https://rustup.rs \
| sed -n '/^<div id="platform-instructions-unix"/,/^<\/div>$/'\
'{s#^ *<pre class="rustup-command">\(.*\)</pre>$#\1#p;T;q}'
)"
sed -i '\#^ i ".*https://rustup.rs"$#{n;i\
'" $RUSTUP_CMD"'
;d}' scripts/setup.sh