* Fetchurl: check md5 checksum.
This commit is contained in:
parent
73b163c1a1
commit
5304a1eb3a
2 changed files with 10 additions and 3 deletions
|
@ -1,8 +1,8 @@
|
|||
Function(["url", "hash"],
|
||||
Function(["url", "md5"],
|
||||
Package(
|
||||
[ ("build", Relative("fetchurl/fetchurl.sh"))
|
||||
, ("url", Var("url"))
|
||||
, ("hash", Var("hash"))
|
||||
, ("md5", Var("md5"))
|
||||
, ("name", BaseName(Var("url")))
|
||||
]
|
||||
)
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
#! /bin/sh
|
||||
|
||||
wget "$url" -O "$out"
|
||||
echo "downloading $url into $out..."
|
||||
wget "$url" -O "$out" || exit 1
|
||||
|
||||
actual=$(md5sum -b $out | cut -c1-32)
|
||||
if ! test "$actual" == "$md5"; then
|
||||
echo "hash is $actual, expected $md5"
|
||||
exit 1
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue