gmic-qt: fix updateScript

This commit is contained in:
Lily Foster 2023-05-23 19:49:21 -04:00
parent 7084250df3
commit ba3e6a91d1
No known key found for this signature in database
GPG Key ID: 49340081E484C893

View File

@ -3,23 +3,27 @@
, fetchzip
, cimg
, cmake
, coreutils
, curl
, fftw
, gimp
, gimpPlugins
, gmic
, gnugrep
, gnused
, graphicsmagick
, libjpeg
, libpng
, libtiff
, ninja
, nix-update-script
, nix-update
, opencv3
, openexr
, pkg-config
, qtbase
, qttools
, wrapQtAppsHook
, writeShellScript
, zlib
, variant ? "standalone"
}:
@ -108,7 +112,23 @@ stdenv.mkDerivation (finalAttrs: {
inherit cimg gmic;
};
updateScript = nix-update-script { };
updateScript = writeShellScript "gmic-qt-update-script" ''
set -euo pipefail
export PATH="${lib.makeBinPath [ coreutils curl gnugrep gnused nix-update ]}:$PATH"
latestVersion=$(curl 'https://gmic.eu/files/source/' \
| grep -E 'gmic_[^"]+\.tar\.gz' \
| sed -E 's/.+<a href="gmic_([^"]+)\.tar\.gz".+/\1/g' \
| sort --numeric-sort --reverse | head -n1)
if [[ '${finalAttrs.version}' = "$latestVersion" ]]; then
echo "The new version same as the old version."
exit 0
fi
nix-update --version "$latestVersion"
'';
};
meta = {