Skip to content
This repository was archived by the owner on Apr 13, 2024. It is now read-only.

Commit ae3585e

Browse files
committed
buildroot/rebuild.sh: Validate checksum of downloaded tarball
Signed-off-by: Nathan Chancellor <[email protected]>
1 parent db4e36f commit ae3585e

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

buildroot/rebuild.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,16 @@
33

44
function download_br() {
55
mkdir -p src
6-
curl https://buildroot.org/downloads/buildroot-"${BUILDROOT_VERSION}".tar.gz | tar -xzf - -C src --strip-components=1
6+
TARBALL=buildroot-${BUILDROOT_VERSION}.tar.gz
7+
rm -rf "${TARBALL}"
8+
curl -LO https://buildroot.org/downloads/"${TARBALL}"
9+
SHA256=31a0dd7f5df75d20f6b74f0684918b643e5bf08d87dd5f9f02525852eecccf95
10+
if [[ $(sha256sum "${TARBALL}" | cut -d ' ' -f 1) != ${SHA256} ]]; then
11+
echo "Downloaded tarball's hash does not match known good one! Please try redownloading."
12+
exit 1
13+
fi
14+
tar -xzf "${TARBALL}" -C src --strip-components=1
15+
rm -rf "${TARBALL}"
716
}
817

918
# Make sure we don't have any unset variables

0 commit comments

Comments
 (0)