depot/third_party/nixpkgs/pkgs/applications/video/kodi-packages/addon-update-script/default.nix
Default email 07d6a74cbb Project import generated by Copybara.
GitOrigin-RevId: f5e8bdd07d1afaabf6b37afc5497b1e498b8046f
2021-03-19 18:17:44 +01:00

23 lines
632 B
Nix

{ writeShellScript
, nix
, curl
, gzip
, xmlstarlet
, common-updater-scripts
}:
{ attrPath }:
let
url = "http://mirrors.kodi.tv/addons/matrix/addons.xml.gz";
updateScript = writeShellScript "update.sh" ''
set -ex
attrPath=$1
namespace=$(${nix}/bin/nix-instantiate $systemArg --eval -E "with import ./. {}; $attrPath.namespace" | tr -d '"')
version=$(${curl}/bin/curl -s -L ${url} | ${gzip}/bin/gunzip -c | ${xmlstarlet}/bin/xml select -T -t -m "//addons/addon[@id='$namespace']" -v @version)
${common-updater-scripts}/bin/update-source-version "$attrPath" "$version"
'';
in
[ updateScript attrPath ]