From e374dbf89b0ba9a4f5835ef9ac30eda6df1dce6a Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 15 Aug 2003 10:13:41 +0000 Subject: * A script `nix-prefetch-url' to fetch a URL, place it in the Nix store, and print its hash. --- corepkgs/fetchurl/fetchurl.sh.in | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'corepkgs/fetchurl/fetchurl.sh.in') diff --git a/corepkgs/fetchurl/fetchurl.sh.in b/corepkgs/fetchurl/fetchurl.sh.in index 7e876a25e2aa..88e4d81f2e48 100644 --- a/corepkgs/fetchurl/fetchurl.sh.in +++ b/corepkgs/fetchurl/fetchurl.sh.in @@ -1,7 +1,16 @@ #! /bin/sh +export PATH=/bin:/usr/bin + echo "downloading $url into $out..." -@wget@ "$url" -O "$out" || exit 1 + +prefetch=@prefix@/store/nix-prefetch-url-$md5 +if test -f "$prefetch"; then + echo "using prefetched $prefetch"; + mv $prefetch $out || exit 1 +else + @wget@ "$url" -O "$out" || exit 1 +fi actual=$(@bindir@/nix-hash --flat $out) if test "$actual" != "$md5"; then -- cgit 1.4.1