From 3b6c3bee9174dfe56fd0e586449457467abe7116 Mon Sep 17 00:00:00 2001 From: Serhii Khoma Date: Fri, 18 Jun 2021 14:59:10 +0300 Subject: [PATCH] hubstaff: 1.5.2-bead991b -> 1.5.19-9e79d1da (#126855) * hubstaff: 1.5.15 -> 1.5.19-9e79d1da * hubstaff: use updateScript for automatic updates * Apply suggestions from code review * Delete revision.json Co-authored-by: Sandro --- pkgs/applications/misc/hubstaff/default.nix | 21 ++++++++++++++----- pkgs/applications/misc/hubstaff/revision.json | 5 ----- pkgs/applications/misc/hubstaff/update.sh | 18 ---------------- 3 files changed, 16 insertions(+), 28 deletions(-) delete mode 100644 pkgs/applications/misc/hubstaff/revision.json delete mode 100755 pkgs/applications/misc/hubstaff/update.sh diff --git a/pkgs/applications/misc/hubstaff/default.nix b/pkgs/applications/misc/hubstaff/default.nix index f291ab898e3d..1bc22b6613d4 100644 --- a/pkgs/applications/misc/hubstaff/default.nix +++ b/pkgs/applications/misc/hubstaff/default.nix @@ -1,13 +1,12 @@ { lib, stdenv, fetchurl, unzip, makeWrapper, libX11, zlib, libSM, libICE , libXext , freetype, libXrender, fontconfig, libXft, libXinerama , libXfixes, libXScrnSaver, libnotify, glib , gtk3, libappindicator-gtk3 -, curl }: +, curl, writeShellScript, common-updater-scripts }: let - - data = builtins.fromJSON (builtins.readFile ./revision.json); - - inherit (data) version url sha256; + url = "https://hubstaff-production.s3.amazonaws.com/downloads/HubstaffClient/Builds/Release/1.5.19-9e79d1da/Hubstaff-1.5.19-9e79d1da.sh"; + version = "1.5.19-9e79d1da"; + sha256 = "1l4sq8cblpl1kclkx5pgy0ldfmqa3n8bvdl5qml0n78r0lpk382j"; rpath = lib.makeLibraryPath [ libX11 zlib libSM libICE libXext freetype libXrender fontconfig libXft @@ -56,6 +55,18 @@ stdenv.mkDerivation { ln -s $opt/data/resources $opt/x86_64/resources ''; + updateScript = writeShellScript "hubstaff-updater" '' + set -eu -o pipefail + + installation_script_url=$(curl --fail --head --location --silent --output /dev/null --write-out %{url_effective} https://app.hubstaff.com/download/linux) + + version=$(echo "$installation_script_url" | sed -r 's/^https:\/\/hubstaff\-production\.s3\.amazonaws\.com\/downloads\/HubstaffClient\/Builds\/Release\/([^\/]+)\/Hubstaff.+$/\1/') + + sha256=$(nix-prefetch-url "$installation_script_url") + + ${common-updater-scripts}/bin/update-source-version hubstaff "$version" "$sha256" "$installation_script_url" + ''; + meta = with lib; { description = "Time tracking software"; homepage = "https://hubstaff.com/"; diff --git a/pkgs/applications/misc/hubstaff/revision.json b/pkgs/applications/misc/hubstaff/revision.json deleted file mode 100644 index 9b0ffe67f0cd..000000000000 --- a/pkgs/applications/misc/hubstaff/revision.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "url": "https://hubstaff-production.s3.amazonaws.com/downloads/HubstaffClient/Builds/Release/1.5.15-28673d1c/Hubstaff-1.5.15-28673d1c.sh", - "version": "1.5.15-28673d1c", - "sha256": "0ging41l3a3sdj6bggh913h71gqmb8l3rplp4civpgclnfzv7fg2" -} diff --git a/pkgs/applications/misc/hubstaff/update.sh b/pkgs/applications/misc/hubstaff/update.sh deleted file mode 100755 index c4c1caf55db4..000000000000 --- a/pkgs/applications/misc/hubstaff/update.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env nix-shell -#!nix-shell -i bash -p nix-prefetch-git curl - -SCRIPT_DIR=$(dirname "$(readlink -f "$BASH_SOURCE")") - -installation_script_url=$(curl --fail --head --location --silent --output /dev/null --write-out %{url_effective} https://app.hubstaff.com/download/linux) - -version=$(echo "$installation_script_url" | sed -r 's/^https:\/\/hubstaff\-production\.s3\.amazonaws\.com\/downloads\/HubstaffClient\/Builds\/Release\/([^\/]+)\/Hubstaff.+$/\1/') - -sha256=$(nix-prefetch-url "$installation_script_url") - -cat < $SCRIPT_DIR/revision.json -{ - "url": "$installation_script_url", - "version": "$version", - "sha256": "$sha256" -} -EOT