Skip to content
Snippets Groups Projects
Commit 5863f247 authored by Eelco Dolstra's avatar Eelco Dolstra
Browse files

* Print SHA-1 hashes in base-32 by default.

parent bd333b93
No related branches found
No related tags found
No related merge requests found
...@@ -6,7 +6,12 @@ hash=$2 ...@@ -6,7 +6,12 @@ hash=$2
hashType=$NIX_HASH_ALGO hashType=$NIX_HASH_ALGO
if test -z "$hashType"; then if test -z "$hashType"; then
hashType=md5 hashType=md5
fi fi
hashFormat=
if test "$hashType" = "sha1"; then
hashFormat=--base32
fi
if test -z "$url"; then if test -z "$url"; then
echo "syntax: nix-prefetch-url URL" >&2 echo "syntax: nix-prefetch-url URL" >&2
...@@ -32,7 +37,7 @@ if test -z "$hash"; then ...@@ -32,7 +37,7 @@ if test -z "$hash"; then
@curl@ --fail --location --max-redirs 20 "$url" > $tmpPath1 @curl@ --fail --location --max-redirs 20 "$url" > $tmpPath1
# Compute the hash. # 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 if ! test -n "$QUIET"; then echo "hash is $hash" >&2; fi
# Rename it so that the fetchurl builder can find it. # Rename it so that the fetchurl builder can find it.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment