From 1d8cb6dd7d5e191e71ade00935a70587f9657706 Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Fri, 31 Dec 2021 14:42:25 +0000 Subject: [PATCH] mc: add trivial updater script --- pkgs/tools/misc/mc/default.nix | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pkgs/tools/misc/mc/default.nix b/pkgs/tools/misc/mc/default.nix index b9ff4ad33d2c..be24d3e2c0b7 100644 --- a/pkgs/tools/misc/mc/default.nix +++ b/pkgs/tools/misc/mc/default.nix @@ -17,6 +17,9 @@ , coreutils , autoreconfHook , autoSignDarwinBinariesHook + +# updater only +, writeScript }: stdenv.mkDerivation rec { @@ -69,6 +72,17 @@ stdenv.mkDerivation rec { $out/bin/mc ''; + passthru.updateScript = writeScript "update-mc" '' + #!/usr/bin/env nix-shell + #!nix-shell -i bash -p curl pcre common-updater-scripts + + set -eu -o pipefail + + # Expect the text in format of "Current version is: 4.8.27; ...". + new_version="$(curl -s https://midnight-commander.org/ | pcregrep -o1 'Current version is: (([0-9]+\.?)+);')" + update-source-version mc "$new_version" + ''; + meta = with lib; { description = "File Manager and User Shell for the GNU Project"; downloadPage = "https://www.midnight-commander.org/downloads/";