commit 05f44c30f71e6da951bbae40483eb65a3e778e7a parent cc6ea58f4c4e98634985e10bc7d00a06e55c7e5f Author: Daniel Bainton <dpb@driftaway.org> Date: Thu, 15 May 2014 12:04:53 +0300 Add checksum checking Diffstat:
M | mk.fetch | | | 15 | ++++++++++++--- |
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/mk.fetch b/mk.fetch @@ -10,8 +10,17 @@ fetch-git:QV: fetch-http:QV: if test x"$url" != x""; then - if ! test -f `basename $url`; then - wget -c $url + if test x"$pkgsrc" = x""; then + pkgsrc=`basename $url` + fi + t=$(cat checksums | sha512sum -c && echo ok || echo fail) + if test "$(echo $t | grep ok)" = ""; then + rm -f "$pkgsrc" + wget -c "$url" -O "$pkgsrc" + fi + if test -e "$pkgsrc"; then + tar -xf "$pkgsrc" + else + echo "Package fetching failed" fi - tar -xf `basename $url` fi