From 98873022d4265c8ed77b1e2942c46ebea5afd93a Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Tue, 19 Jan 2021 11:18:21 -0300 Subject: [PATCH] opentabletdriver: improve update.sh script Allow it to update deb package sha256 automatically. --- pkgs/tools/X11/opentabletdriver/default.nix | 7 +++++-- pkgs/tools/X11/opentabletdriver/update.sh | 8 ++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/pkgs/tools/X11/opentabletdriver/default.nix b/pkgs/tools/X11/opentabletdriver/default.nix index dc527f47dd34..0450635b6546 100644 --- a/pkgs/tools/X11/opentabletdriver/default.nix +++ b/pkgs/tools/X11/opentabletdriver/default.nix @@ -155,8 +155,11 @@ stdenv.mkDerivation rec { dontWrapGApps = true; dontStrip = true; - passthru.tests = { - otd-runs = nixosTests.opentabletdriver; + passthru = { + updateScript = ./update.sh; + tests = { + otd-runs = nixosTests.opentabletdriver; + }; }; meta = with lib; { diff --git a/pkgs/tools/X11/opentabletdriver/update.sh b/pkgs/tools/X11/opentabletdriver/update.sh index 04fae30c05a5..715857cf8f46 100755 --- a/pkgs/tools/X11/opentabletdriver/update.sh +++ b/pkgs/tools/X11/opentabletdriver/update.sh @@ -14,6 +14,14 @@ if [[ "$new_version" == "$old_version" ]]; then [[ "${1}" != "--force" ]] && exit 0 fi +# Updating the hash of deb package manually since there seems to be no way to do it automatically +oldDebPkgUrl="https://github.com/InfinityGhost/OpenTabletDriver/releases/download/v${old_version}/OpenTabletDriver.deb"; +newDebPkgUrl="https://github.com/InfinityGhost/OpenTabletDriver/releases/download/v${new_version}/OpenTabletDriver.deb"; +oldDebSha256=$(nix-prefetch-url "$oldDebPkgUrl") +newDebSha256=$(nix-prefetch-url "$newDebPkgUrl") +echo "oldDebSha256: $oldDebSha256 newDebSha256: $newDebSha256" +sed -i ./default.nix -re "s|\"$oldDebSha256\"|\"$newDebSha256\"|" + cd ../../../.. update-source-version opentabletdriver "$new_version" store_src="$(nix-build . -A opentabletdriver.src --no-out-link)"