Debian Codegraph @

ci/install-rust.sh

raw symbols SCIP
1 #!/bin/bash
2 #
3 # IMPORTANT: See
4 # https://gnome.pages.gitlab.gnome.org/librsvg/devel-docs/ci.html#container-image-version
5
6 set -o errexit -o pipefail -o noclobber -o nounset
7
8 source ./ci/env.sh
9
10 export CARGO_HOME='/usr/local/cargo'
11
12 PARSED=$(getopt --options '' --longoptions 'rustup-version:,stable:,minimum:,nightly:,arch:' --name "$0" -- "$@")
13 eval set -- "$PARSED"
14 unset PARSED
15
16 RUSTUP_VERSION=
17 STABLE=
18 MINIMUM=
19 NIGHTLY=
20 ARCH=
21
22 while true; do
23 case "$1" in
24 '--rustup-version')
25 RUSTUP_VERSION=$2
26 shift 2
27 ;;
28
29 '--stable')
30 STABLE=$2
31 shift 2
32 ;;
33
34 '--minimum')
35 MINIMUM=$2
36 shift 2
37 ;;
38
39 '--nightly')
40 NIGHTLY=$2
41 shift 2
42 ;;
43
44 '--arch')
45 ARCH=$2
46 shift 2
47 ;;
48
49 '--')
50 shift
51 break
52 ;;
53
54 *)
55 echo "Programming error"
56 exit 3
57 ;;
58 esac
59 done
60
61 if [ -z "$RUSTUP_VERSION" ]; then
62 echo "missing --rustup-version argument"
63 exit 1
64 fi
65
66 if [ -z "$STABLE" ]; then
67 echo "missing --stable argument, please pass the stable version of rustc you want"
68 exit 1
69 fi
70
71 if [ -z "$ARCH" ]; then
72 echo "missing --arch argument, please pass an architecture triple like x86_64-unknown-linux-gnu"
73 exit 1
74 fi
75
76 RUSTUP_URL="https://static.rust-lang.org/rustup/archive/$RUSTUP_VERSION/$ARCH/rustup-init"
77 wget "$RUSTUP_URL"
78
79 chmod +x rustup-init
80 ./rustup-init -y --no-modify-path --profile minimal --default-toolchain "$STABLE"
81 rm rustup-init
82 chmod -R a+w "$RUSTUP_HOME" "$CARGO_HOME"
83
84 if [ -n "$MINIMUM" ]; then
85 rustup toolchain install "$MINIMUM"
86 fi
87
88 if [ -n "$NIGHTLY" ]; then
89 rustup toolchain install "$NIGHTLY"
90 fi