mirror of
https://github.com/NixOS/nix
synced 2025-07-09 03:43:54 +02:00
* A script `nix-prefetch-url' to fetch a URL, place it in the Nix
store, and print its hash.
This commit is contained in:
parent
01e30360d4
commit
e374dbf89b
4 changed files with 64 additions and 5 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue