summary refs log tree commit diff
path: root/pkgs/development/compilers/rust/print-hashes.sh
blob: ebf8d900bb3b5ab9ac1631604ffea8a4c2c3e172 (plain) (blame)
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
#!/usr/bin/env bash
set -euo pipefail

# All rust-related downloads can be found at
# https://static.rust-lang.org/dist/index.html.  To find the date on
# which a particular thing was last updated, look for the *-date.txt
# file, e.g.
# https://static.rust-lang.org/dist/channel-rust-beta-date.txt

PLATFORMS=(
  i686-unknown-linux-gnu
  x86_64-unknown-linux-gnu
  x86_64-unknown-linux-musl
  arm-unknown-linux-gnueabihf
  armv7-unknown-linux-gnueabihf
  aarch64-unknown-linux-gnu
  aarch64-unknown-linux-musl
  x86_64-apple-darwin
  aarch64-apple-darwin
  powerpc64le-unknown-linux-gnu
  riscv64gc-unknown-linux-gnu
)
BASEURL=https://static.rust-lang.org/dist
VERSION=${1:-}
DATE=${2:-}

if [[ -z $VERSION ]]
then
    echo "No version supplied"
    exit -1
fi

if [[ -n $DATE ]]
then
    BASEURL=$BASEURL/$DATE
fi

for PLATFORM in "${PLATFORMS[@]}"
do
    URL="$BASEURL/rust-$VERSION-$PLATFORM.tar.gz.sha256"
    SHA256=$(curl -sSfL $URL | cut -d ' ' -f 1)
    echo "$PLATFORM = \"$SHA256\";"
done