From 2181f3c02a1bb280f1007ab824a5bfb6f0c54495 Mon Sep 17 00:00:00 2001 From: Samuel Dionne-Riel Date: Wed, 6 Jun 2018 18:11:16 -0400 Subject: [PATCH] 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 --- mirror-nixos-branch.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mirror-nixos-branch.pl b/mirror-nixos-branch.pl index 5a0521a..abaf8fe 100755 --- a/mirror-nixos-branch.pl +++ b/mirror-nixos-branch.pl @@ -108,7 +108,7 @@ if ($bucket->head_key("$releasePrefix")) { if (! -e $dstFile) { 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 or die "unable to fetch $srcFile\n"; rename("$dstFile.tmp", $dstFile) or die;