diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2005-03-14T17·05+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2005-03-14T17·05+0000 |
commit | 5863f2472233ac3991bbd5e659b990f662b340d2 (patch) | |
tree | f510cfe95344a12c91111aba7a65344d19e7e252 /scripts | |
parent | bd333b939cc2fd2006466507ffc78976f85323b5 (diff) |
* Print SHA-1 hashes in base-32 by default.
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/nix-prefetch-url.in | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/scripts/nix-prefetch-url.in b/scripts/nix-prefetch-url.in index 23cc617ca45a..2311d1bde690 100644 --- a/scripts/nix-prefetch-url.in +++ b/scripts/nix-prefetch-url.in @@ -6,7 +6,12 @@ hash=$2 hashType=$NIX_HASH_ALGO if test -z "$hashType"; then hashType=md5 -fi +fi + +hashFormat= +if test "$hashType" = "sha1"; then + hashFormat=--base32 +fi if test -z "$url"; then echo "syntax: nix-prefetch-url URL" >&2 @@ -32,7 +37,7 @@ if test -z "$hash"; then @curl@ --fail --location --max-redirs 20 "$url" > $tmpPath1 # Compute the hash. - hash=$(@bindir@/nix-hash --type "$hashType" --flat $tmpPath1) + hash=$(@bindir@/nix-hash --type "$hashType" $hashFormat --flat $tmpPath1) if ! test -n "$QUIET"; then echo "hash is $hash" >&2; fi # Rename it so that the fetchurl builder can find it. |