firefox: Extend upgrade script with version prefix

Prevents upgrades of versioned ESR packages between major versions.
This commit is contained in:
Martin Weinelt 2022-06-28 11:53:18 +02:00
parent 0c4852c7bc
commit 76ff019153
No known key found for this signature in database
GPG key ID: 87C1E9888F856759
2 changed files with 4 additions and 1 deletions

View file

@ -48,6 +48,7 @@ rec {
tests = [ nixosTests.firefox-esr-102 ]; tests = [ nixosTests.firefox-esr-102 ];
updateScript = callPackage ./update.nix { updateScript = callPackage ./update.nix {
attrPath = "firefox-esr-102-unwrapped"; attrPath = "firefox-esr-102-unwrapped";
versionPrefix = "102";
versionSuffix = "esr"; versionSuffix = "esr";
}; };
}; };
@ -74,6 +75,7 @@ rec {
tests = [ nixosTests.firefox-esr-91 ]; tests = [ nixosTests.firefox-esr-91 ];
updateScript = callPackage ./update.nix { updateScript = callPackage ./update.nix {
attrPath = "firefox-esr-91-unwrapped"; attrPath = "firefox-esr-91-unwrapped";
versionPrefix = "91";
versionSuffix = "esr"; versionSuffix = "esr";
}; };
}; };

View file

@ -10,6 +10,7 @@
, attrPath , attrPath
, runtimeShell , runtimeShell
, baseUrl ? "http://archive.mozilla.org/pub/firefox/releases/" , baseUrl ? "http://archive.mozilla.org/pub/firefox/releases/"
, versionPrefix ? ""
, versionSuffix ? "" , versionSuffix ? ""
, versionKey ? "version" , versionKey ? "version"
}: }:
@ -32,7 +33,7 @@ writeScript "update-${attrPath}" ''
# - sorts everything with semver in mind # - sorts everything with semver in mind
# - picks up latest release # - picks up latest release
version=`xidel -s $url --extract "//a" | \ version=`xidel -s $url --extract "//a" | \
grep "^[0-9.]*${versionSuffix}/$" | \ grep "^${versionPrefix}[0-9.]*${versionSuffix}/$" | \
sed s/[/]$// | \ sed s/[/]$// | \
sort --version-sort | \ sort --version-sort | \
tail -n 1` tail -n 1`