firefox: use SHA512SUM in update.nix

This commit is contained in:
taku0 2021-05-05 10:59:09 +09:00
parent bd0e86a969
commit 8432387de2

View file

@ -6,6 +6,7 @@
, gnused
, gnugrep
, curl
, gnupg
, attrPath
, runtimeShell
, baseUrl ? "http://archive.mozilla.org/pub/firefox/releases/"
@ -15,7 +16,12 @@
writeScript "update-${attrPath}" ''
#!${runtimeShell}
PATH=${lib.makeBinPath [ common-updater-scripts coreutils curl gnugrep gnused xidel ]}
PATH=${lib.makeBinPath [ common-updater-scripts coreutils curl gnugrep gnupg gnused xidel ]}
set -eux
HOME=`mktemp -d`
export GNUPGHOME=`mktemp -d`
gpg --import ${../firefox-bin/mozilla.asc}
url=${baseUrl}
@ -31,5 +37,11 @@ writeScript "update-${attrPath}" ''
sort --version-sort | \
tail -n 1`
update-source-version ${attrPath} "$version" "" "" --version-key=${versionKey}
curl --silent --show-error -o "$HOME"/shasums "$url$version/SHA512SUMS"
curl --silent --show-error -o "$HOME"/shasums.asc "$url$version/SHA512SUMS.asc"
gpgv --keyring="$GNUPGHOME"/pubring.kbx "$HOME"/shasums.asc "$HOME"/shasums
hash=$(grep '\.source\.tar\.xz$' "$HOME"/shasums | grep '^[^ ]*' -o)
update-source-version ${attrPath} "$version" "$hash" "" --version-key=${versionKey}
''