about summary refs log tree commit diff
path: root/pkgs-ng/build-support/fetchurl/builder.sh
blob: 4560017220f93a2b081f30f29ba0c335a7883d6e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#! /bin/sh

. $stdenv/setup

echo "downloading $url into $out..."

#prefetch=@prefix@/store/nix-prefetch-url-$md5
prefetch=/nix/store/nix-prefetch-url-$md5
if test -f "$prefetch"; then
    echo "using prefetched $prefetch";
    mv $prefetch $out || exit 1
else
    wget --passive-ftp "$url" -O "$out" || exit 1
fi

#actual=$(@bindir@/nix-hash --flat $out)
actual=$(/nix/bin/nix-hash --flat $out)
if test "$actual" != "$md5"; then
    echo "hash is $actual, expected $md5"
    exit 1
fi