-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·59 lines (48 loc) · 1.1 KB
/
build.sh
File metadata and controls
executable file
·59 lines (48 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash
if command -v gsed 2>/dev/null; then
SED=gsed
else
SED=sed
fi
stable() {
rustup toolchain add stable >&2
rustup run stable rustc --version | egrep -o '1\.[0-9]+\.[0-9]+'
}
beta() {
rustup toolchain add beta >&2
rustup run beta rustc --version | \
$SED 's/.\+\(1\.[0-9]\+\.[0-9]\+[^ ]*\).*/\1/'
}
nightly() {
rustup toolchain add nightly >&2
rustup run nightly rustc --version | \
$SED 's/.\+\(1\.[0-9]\+\.[0-9]\+\)-nightly ([0-9a-f]\+ \(.\+\))/\1 (\2)/'
}
pickdate() {
echo "$1" | $SED 's/\(1\.[0-9]\+\.[0-9]\+\) (\(.\+\))/\2/'
}
rustup update
s=$(stable)
b=$(beta)
n=$(nightly)
nightlyDate=$(pickdate "$n")
$SED \
-e "s/{STABLE}/$s/" \
-e "s/{BETA}/$b/" \
-e "s/{NIGHTLY}/$n/" \
index.html.tmpl > index.html
cat <<EOS > stable
[toolchain]
channel = "$s"
EOS
# We can't pick the beta version without knowing the _exact_ release date,
# which is not even exposed anywhere.
# Maybe we can eventually parse https://static.rust-lang.org/manifests.txt
cat <<EOS > beta
[toolchain]
channel = "beta"
EOS
cat <<EOS > nightly
[toolchain]
channel = "nightly-${nightlyDate}"
EOS