1#!/usr/bin/env bash
2set -euo pipefail
3
4# All rust-related downloads can be found at
5# https://static.rust-lang.org/dist/index.html. To find the date on
6# which a particular thing was last updated, look for the *-date.txt
7# file, e.g.
8# https://static.rust-lang.org/dist/channel-rust-beta-date.txt
9
10PLATFORMS=(
11 i686-unknown-linux-gnu
12 x86_64-unknown-linux-gnu
13 x86_64-unknown-linux-musl
14 arm-unknown-linux-gnueabihf
15 armv7-unknown-linux-gnueabihf
16 aarch64-unknown-linux-gnu
17 aarch64-unknown-linux-musl
18 x86_64-apple-darwin
19 aarch64-apple-darwin
20 powerpc64le-unknown-linux-gnu
21 riscv64gc-unknown-linux-gnu
22 mips64el-unknown-linux-gnuabi64
23)
24BASEURL=https://static.rust-lang.org/dist
25VERSION=${1:-}
26DATE=${2:-}
27
28if [[ -z $VERSION ]]
29then
30 echo "No version supplied"
31 exit -1
32fi
33
34if [[ -n $DATE ]]
35then
36 BASEURL=$BASEURL/$DATE
37fi
38
39for PLATFORM in "${PLATFORMS[@]}"
40do
41 URL="$BASEURL/rust-$VERSION-$PLATFORM.tar.gz.sha256"
42 SHA256=$(curl -sSfL $URL | cut -d ' ' -f 1)
43 echo "$PLATFORM = \"$SHA256\";"
44done