diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2003-08-15 10:13:41 +0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2003-08-15 10:13:41 +0000 |
commit | e374dbf89b0ba9a4f5835ef9ac30eda6df1dce6a (patch) | |
tree | ab3712823c18dcb08fd4506716b4a102b7cfdc8b /corepkgs/fetchurl | |
parent | 01e30360d46ce940d8b83f4ff7a71e8464c1422b (diff) |
* A script `nix-prefetch-url' to fetch a URL, place it in the Nix
store, and print its hash.
Diffstat (limited to 'corepkgs/fetchurl')
-rw-r--r-- | corepkgs/fetchurl/fetchurl.sh.in | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/corepkgs/fetchurl/fetchurl.sh.in b/corepkgs/fetchurl/fetchurl.sh.in index 7e876a25e..88e4d81f2 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 |