epson-escpr2: add update script

This commit is contained in:
Shawn8901
2025-11-18 20:58:34 +01:00
parent dea9062e0d
commit d88c9eb569
2 changed files with 24 additions and 0 deletions
+3
View File
@@ -14,6 +14,7 @@ stdenv.mkDerivation {
# To find the most recent version go to
# https://support.epson.net/linux/Printer/LSB_distribution_pages/en/escpr2.php
# and retrieve the download link for source package for arm CPU for the tar.gz (the x86 link targets to rpm source files)
url = "https://download3.ebz.epson.net/dsc/f/03/00/17/28/09/4e8dc40219d4b52e414b608de92552af4fd46eca/epson-inkjet-printer-escpr2-1.2.35-1.tar.gz";
hash = "sha256-aYEuEION/C32/SnngreX/nqK/6Yzkuxf0k0HpferTYM=";
};
@@ -37,6 +38,8 @@ stdenv.mkDerivation {
"--with-cupsppddir=${placeholder "out"}/share/cups/model"
];
passthru.updateScript = ./update.sh;
meta = {
homepage = "http://download.ebz.epson.net/dsc/search/01/search/";
description = "ESC/P-R 2 Driver (generic driver)";
+21
View File
@@ -0,0 +1,21 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p bash curl jq common-updater-scripts
set -eou pipefail
result=$(curl -sSL 'https://download-center.epson.com/api/v1/modules/?device_id=XP-970%20Series&os=DEBARM32&region=US&language=en' | jq -r '.items[] | select(.module_name == "Epson Inkjet Printer Driver 2 (ESC/P-R) for Linux" and .cti_category == "Sources")')
latestVersion=$(jq '.version' <<< "$result" | tr -d '"')
currentVersion=$(nix-instantiate --eval -E "with import ./. {}; (lib.getVersion epson-escpr2)" | tr -d '"')
echo "latest version: $latestVersion"
echo "current version: $currentVersion"
if [[ "$latestVersion" == "$currentVersion" ]]; then
echo "package is up-to-date"
exit 0
fi
url=$(jq '.url' <<< "$result" | tr -d '"')
hash=$(nix --extra-experimental-features nix-command hash convert --hash-algo sha256 --to sri $(nix-prefetch-url $url))
update-source-version epson-escpr2 $latestVersion $hash $url --ignore-same-version