2017-01-04 22:38:55 +00:00
|
|
|
{ writeScript
|
|
|
|
, lib
|
2016-12-25 08:35:20 +00:00
|
|
|
, xidel
|
2017-01-04 22:38:55 +00:00
|
|
|
, common-updater-scripts
|
2016-12-25 08:35:20 +00:00
|
|
|
, coreutils
|
|
|
|
, gnused
|
|
|
|
, gnugrep
|
|
|
|
, curl
|
2021-05-05 02:59:09 +01:00
|
|
|
, gnupg
|
2017-01-04 22:38:55 +00:00
|
|
|
, attrPath
|
2019-02-26 11:45:54 +00:00
|
|
|
, runtimeShell
|
2016-12-25 08:35:20 +00:00
|
|
|
, baseUrl ? "http://archive.mozilla.org/pub/firefox/releases/"
|
|
|
|
, versionSuffix ? ""
|
2018-11-16 14:04:54 +00:00
|
|
|
, versionKey ? "version"
|
2016-12-25 08:35:20 +00:00
|
|
|
}:
|
|
|
|
|
2017-01-04 22:38:55 +00:00
|
|
|
writeScript "update-${attrPath}" ''
|
2019-02-26 11:45:54 +00:00
|
|
|
#!${runtimeShell}
|
2021-05-05 02:59:09 +01:00
|
|
|
PATH=${lib.makeBinPath [ common-updater-scripts coreutils curl gnugrep gnupg gnused xidel ]}
|
|
|
|
|
|
|
|
set -eux
|
|
|
|
HOME=`mktemp -d`
|
|
|
|
export GNUPGHOME=`mktemp -d`
|
2021-06-16 16:07:09 +01:00
|
|
|
gpg --receive-keys 14F26682D0916CDD81E37B6D61B7B526D98F0353
|
2016-12-25 08:35:20 +00:00
|
|
|
|
|
|
|
url=${baseUrl}
|
|
|
|
|
|
|
|
# retriving latest released version
|
|
|
|
# - extracts all links from the $url
|
|
|
|
# - extracts lines only with number and dots followed by a slash
|
|
|
|
# - removes trailing slash
|
|
|
|
# - sorts everything with semver in mind
|
|
|
|
# - picks up latest release
|
2018-03-14 12:01:25 +00:00
|
|
|
version=`xidel -s $url --extract "//a" | \
|
2016-12-25 08:35:20 +00:00
|
|
|
grep "^[0-9.]*${versionSuffix}/$" | \
|
|
|
|
sed s/[/]$// | \
|
|
|
|
sort --version-sort | \
|
|
|
|
tail -n 1`
|
|
|
|
|
2021-05-05 02:59:09 +01:00
|
|
|
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}
|
2016-12-25 08:35:20 +00:00
|
|
|
''
|