]> git.proxmox.com Git - rustc.git/blob - vendor/mdbook/ci/install-rustup.sh
New upstream version 1.44.1+dfsg1
[rustc.git] / vendor / mdbook / ci / install-rustup.sh
1 #!/usr/bin/env bash
2 # Install/update rustup.
3 # The first argument should be the toolchain to install.
4 #
5 # It is helpful to have this as a separate script due to some issues on
6 # Windows where immediately after `rustup self update`, rustup can fail with
7 # "Device or resource busy".
8
9 set -ex
10 if [ -z "$1" ]
11 then
12 echo "First parameter must be toolchain to install."
13 exit 1
14 fi
15 TOOLCHAIN="$1"
16
17 # Install/update rustup.
18 if command -v rustup
19 then
20 echo `command -v rustup` `rustup -V` already installed
21 rustup self update
22 else
23 # macOS currently does not have rust pre-installed.
24 curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $TOOLCHAIN --profile=minimal
25 echo "##[add-path]$HOME/.cargo/bin"
26 fi