Merge pull request #104993 from SamirHafez/rescuetime-updateScript-multiPlatform
rescuetime: add multiPlatform updateScript
This commit is contained in:
commit
7422b1e843
@ -1,4 +1,4 @@
|
|||||||
{ stdenv, lib, fetchurl, dpkg, patchelf, qt5, libXtst, libXext, libX11, mkDerivation, makeWrapper, libXScrnSaver, writeScript }:
|
{ stdenv, lib, fetchurl, dpkg, patchelf, qt5, libXtst, libXext, libX11, mkDerivation, makeWrapper, libXScrnSaver, writeScript, common-updater-scripts, curl, pup }:
|
||||||
|
|
||||||
let
|
let
|
||||||
version = "2.16.4.2";
|
version = "2.16.4.2";
|
||||||
@ -12,7 +12,7 @@ let
|
|||||||
url = "https://www.rescuetime.com/installers/rescuetime_${version}_amd64.deb";
|
url = "https://www.rescuetime.com/installers/rescuetime_${version}_amd64.deb";
|
||||||
sha256 = "03bmnkxhip1wilnfqs8akmy1hppahxrmnm8gasnmw5s922vn06cv";
|
sha256 = "03bmnkxhip1wilnfqs8akmy1hppahxrmnm8gasnmw5s922vn06cv";
|
||||||
};
|
};
|
||||||
in mkDerivation {
|
in mkDerivation rec {
|
||||||
# https://www.rescuetime.com/updates/linux_release_notes.html
|
# https://www.rescuetime.com/updates/linux_release_notes.html
|
||||||
inherit version;
|
inherit version;
|
||||||
pname = "rescuetime";
|
pname = "rescuetime";
|
||||||
@ -35,12 +35,18 @@ in mkDerivation {
|
|||||||
$out/bin/rescuetime
|
$out/bin/rescuetime
|
||||||
'';
|
'';
|
||||||
|
|
||||||
passthru.updateScript = writeScript "rescuetime-updater" ''
|
passthru.updateScript = writeScript "${pname}-updater" ''
|
||||||
#!/usr/bin/env nix-shell
|
#!${stdenv.shell}
|
||||||
#!nix-shell -i bash -p curl pup common-updater-scripts
|
|
||||||
set -eu -o pipefail
|
set -eu -o pipefail
|
||||||
|
PATH=${stdenv.lib.makeBinPath [curl pup common-updater-scripts]}:$PATH
|
||||||
latestVersion="$(curl -sS https://www.rescuetime.com/release-notes/linux | pup '.release:first-of-type h2 strong text{}' | tr -d '\n')"
|
latestVersion="$(curl -sS https://www.rescuetime.com/release-notes/linux | pup '.release:first-of-type h2 strong text{}' | tr -d '\n')"
|
||||||
update-source-version rescuetime "$latestVersion"
|
|
||||||
|
for platform in ${stdenv.lib.concatStringsSep " " meta.platforms}; do
|
||||||
|
# The script will not perform an update when the version attribute is up to date from previous platform run
|
||||||
|
# We need to clear it before each run
|
||||||
|
update-source-version ${pname} 0 $(yes 0 | head -64 | tr -d "\n") --system=$platform
|
||||||
|
update-source-version ${pname} "$latestVersion" --system=$platform
|
||||||
|
done
|
||||||
'';
|
'';
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
|
Loading…
Reference in New Issue
Block a user