1
1
#! /usr/bin/env bash
2
2
# ignore-tidy-linelength
3
3
4
- set -ex
4
+ set -eux
5
5
6
6
hide_output () {
7
7
set +x
@@ -20,24 +20,54 @@ exit 1
20
20
set -x
21
21
}
22
22
23
+ # Download, verify SHA512, and remove the downloaded file
24
+ # Usage: <file name> <url> <file sha> <full tar command using fname>
25
+ download () {
26
+ fname=" $1 "
27
+ shift
28
+ url=" $1 "
29
+ shift
30
+ sha=" $1 "
31
+ shift
32
+
33
+ curl " $url " -o " $fname "
34
+ echo " $sha $fname " | shasum -a 512 --check || exit 1
35
+ " $@ "
36
+ rm " $fname "
37
+ }
38
+
23
39
mkdir netbsd
24
40
cd netbsd
25
41
26
42
mkdir -p /x-tools/x86_64-unknown-netbsd/sysroot
27
43
28
44
# URL=https://ci-mirrors.rust-lang.org/rustc
29
45
30
- SOURCE_URL=https://cdn.netbsd.org/pub/NetBSD/NetBSD-9.0/source/sets
31
- curl $SOURCE_URL /src.tgz | tar xzf -
32
- curl $SOURCE_URL /gnusrc.tgz | tar xzf -
33
- curl $SOURCE_URL /sharesrc.tgz | tar xzf -
34
- curl $SOURCE_URL /syssrc.tgz | tar xzf -
35
-
36
- BINARY_URL=https://cdn.netbsd.org/pub/NetBSD/NetBSD-9.0/amd64/binary/sets
37
- curl $BINARY_URL /base.tar.xz | \
38
- tar xJf - -C /x-tools/x86_64-unknown-netbsd/sysroot ./usr/include ./usr/lib ./lib
39
- curl $BINARY_URL /comp.tar.xz | \
40
- tar xJf - -C /x-tools/x86_64-unknown-netbsd/sysroot ./usr/include ./usr/lib
46
+ # Hashes come from https://cdn.netbsd.org/pub/NetBSD/security/hashes/NetBSD-9.0_hashes.asc
47
+ SRC_SHA=2c791ae009a6929c6fc893ec5df7e62910ee8207e0b2159d6937309c03efe175b6ae1e445829a13d041b6851334ad35c521f2fa03c97675d4a05f1fafe58ede0
48
+ GNUSRC_SHA=3710085a73feecf6a843415271ec794c90146b03f6bbd30f07c9e0c79febf8995d557e40194f1e05db655e4f5ef2fae97563f8456fceaae65d4ea98857a83b1c
49
+ SHARESRC_SHA=f080776ed82c3ac5d6272dee39746f87897d8e6984996caf5bf6d87bf11d9c9e0c1ad5c437c21258bd278bb6fd76974946e878f548517885f71c556096231369
50
+ SYSSRC_SHA=60b9ddf4cc6402256473e2e1eefeabd9001aa4e205208715ecc6d6fc3f5b400e469944580077271b8e80562a4c2f601249e69e07a504f46744e0c50335f1cbf1
51
+ BASE_SHA=b5926b107cebf40c3c19b4f6cd039b610987dd7f819e7cdde3bd1e5230a856906e7930b15ab242d52ced9f0bda01d574be59488b8dbb95fa5df2987d0a70995f
52
+ COMP_SHA=38ea54f30d5fc2afea87e5096f06873e00182789e8ad9cec0cb3e9f7c538c1aa4779e63fd401a36ba02676158e83fa5c95e8e87898db59c1914fb206aecd82d2
53
+
54
+ # FIXME: the archive URL is being used temporarily while the CDN is down.
55
+ # We should serve this from our own CDN
56
+ # SOURCE_URL=https://cdn.netbsd.org/pub/NetBSD/NetBSD-9.0/source/sets
57
+ SOURCE_URL=http://archive.netbsd.org/pub/NetBSD-archive/NetBSD-9.0/source/sets
58
+ download src.tgz " $SOURCE_URL /src.tgz" " $SRC_SHA " tar xzf src.tgz
59
+ download gnusrc.tgz " $SOURCE_URL /gnusrc.tgz" " $GNUSRC_SHA " tar xzf gnusrc.tgz
60
+ download sharesrc.tgz " $SOURCE_URL /sharesrc.tgz" " $SHARESRC_SHA " tar xzf sharesrc.tgz
61
+ download syssrc.tgz " $SOURCE_URL /syssrc.tgz" " $SYSSRC_SHA " tar xzf syssrc.tgz
62
+
63
+ # FIXME: the archive URL is being used temporarily while the CDN is down.
64
+ # We should serve this from our own CDN
65
+ # BINARY_URL=https://cdn.netbsd.org/pub/NetBSD/NetBSD-9.0/amd64/binary/sets
66
+ BINARY_URL=http://archive.netbsd.org/pub/NetBSD-archive/NetBSD-9.0/amd64/binary/sets
67
+ download base.tar.xz " $BINARY_URL /base.tar.xz" " $BASE_SHA " \
68
+ tar xJf base.tar.xz -C /x-tools/x86_64-unknown-netbsd/sysroot ./usr/include ./usr/lib ./lib
69
+ download comp.tar.xz " $BINARY_URL /comp.tar.xz" " $COMP_SHA " \
70
+ tar xJf comp.tar.xz -C /x-tools/x86_64-unknown-netbsd/sysroot ./usr/include ./usr/lib
41
71
42
72
cd usr/src
43
73
0 commit comments