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
|
2017-01-04 22:38:55 +00:00
|
|
|
, attrPath
|
2016-12-25 08:35:20 +00:00
|
|
|
, baseUrl ? "http://archive.mozilla.org/pub/firefox/releases/"
|
|
|
|
, versionSuffix ? ""
|
|
|
|
}:
|
|
|
|
|
2017-01-04 22:38:55 +00:00
|
|
|
writeScript "update-${attrPath}" ''
|
|
|
|
PATH=${lib.makeBinPath [ common-updater-scripts coreutils curl gnugrep gnused xidel ]}
|
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
|
|
|
|
version=`xidel -q $url --extract "//a" | \
|
|
|
|
grep "^[0-9.]*${versionSuffix}/$" | \
|
|
|
|
sed s/[/]$// | \
|
|
|
|
sort --version-sort | \
|
|
|
|
tail -n 1`
|
|
|
|
|
|
|
|
shasum=`curl --silent $url$version/SHA512SUMS | grep 'source\.tar\.xz' | cut -d ' ' -f 1`
|
|
|
|
|
2017-01-04 22:38:55 +00:00
|
|
|
update-source-version ${attrPath} "$version" "$shasum"
|
2016-12-25 08:35:20 +00:00
|
|
|
''
|