Adds filename to sha256 file for use with sha256 -c

The manpage says:

> The  sums  are  computed as described in FIPS-180-2.  When checking, the input should be a former
> output of this program.  The default mode is to print a line with checksum, **a space, a  character
> indicating  input  mode ('*' for binary, ' ' for text or where binary is insignificant),** and name
> for each FILE.

By adding the filename to the generated sha256 file, a user would be
able to download an iso, the sha256 file, then use `sha256 -c
[file].iso.sha256` to verify the file.

* * *

This fixes nixos-homepage#224
This commit is contained in:
Samuel Dionne-Riel 2018-06-06 18:11:16 -04:00
parent 9f96e1e25d
commit 2181f3c02a

View file

@ -108,7 +108,7 @@ if ($bucket->head_key("$releasePrefix")) {
if (! -e $dstFile) { if (! -e $dstFile) {
print STDERR "downloading $srcFile to $dstFile...\n"; print STDERR "downloading $srcFile to $dstFile...\n";
write_file("$dstFile.sha256", $sha256_expected); write_file("$dstFile.sha256", "$sha256_expected $dstName");
system("NIX_REMOTE=https://cache.nixos.org/ nix cat-store '$srcFile' > '$dstFile.tmp'") == 0 system("NIX_REMOTE=https://cache.nixos.org/ nix cat-store '$srcFile' > '$dstFile.tmp'") == 0
or die "unable to fetch $srcFile\n"; or die "unable to fetch $srcFile\n";
rename("$dstFile.tmp", $dstFile) or die; rename("$dstFile.tmp", $dstFile) or die;