2017-01-04 23:38:55 +01:00
|
|
|
{ writeScript
|
|
|
|
, lib
|
2016-12-25 09:35:20 +01:00
|
|
|
, xidel
|
2017-01-04 23:38:55 +01:00
|
|
|
, common-updater-scripts
|
2016-12-25 09:35:20 +01:00
|
|
|
, coreutils
|
|
|
|
, gnused
|
|
|
|
, gnugrep
|
|
|
|
, curl
|
2017-01-04 23:38:55 +01:00
|
|
|
, attrPath
|
2019-02-26 12:45:54 +01:00
|
|
|
, runtimeShell
|
2016-12-25 09:35:20 +01:00
|
|
|
, baseUrl ? "http://archive.mozilla.org/pub/firefox/releases/"
|
|
|
|
, versionSuffix ? ""
|
2018-11-16 15:04:54 +01:00
|
|
|
, versionKey ? "version"
|
2016-12-25 09:35:20 +01:00
|
|
|
}:
|
|
|
|
|
2017-01-04 23:38:55 +01:00
|
|
|
writeScript "update-${attrPath}" ''
|
2019-02-26 12:45:54 +01:00
|
|
|
#!${runtimeShell}
|
2017-01-04 23:38:55 +01:00
|
|
|
PATH=${lib.makeBinPath [ common-updater-scripts coreutils curl gnugrep gnused xidel ]}
|
2016-12-25 09:35:20 +01: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 13:01:25 +01:00
|
|
|
version=`xidel -s $url --extract "//a" | \
|
2016-12-25 09:35:20 +01:00
|
|
|
grep "^[0-9.]*${versionSuffix}/$" | \
|
|
|
|
sed s/[/]$// | \
|
|
|
|
sort --version-sort | \
|
|
|
|
tail -n 1`
|
|
|
|
|
2019-03-02 22:11:54 +01:00
|
|
|
update-source-version ${attrPath} "$version" "" "" --version-key=${versionKey}
|
2016-12-25 09:35:20 +01:00
|
|
|
''
|