summary refs log tree commit diff
path: root/pkgs/os-specific/linux/tp_smapi/update.nix
blob: 0c97d18472cd967f4fc9fe8c3cda410bea728380 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{ writeScript, coreutils, gnugrep, jq, curl
}:

writeScript "update-tp_smapi" ''
PATH=${coreutils}/bin:${gnugrep}/bin:${jq}/bin:${curl}/bin

pushd pkgs/os-specific/linux/tp_smapi

tmpfile=`mktemp`
tags=`curl -s https://api.github.com/repos/evgeni/tp_smapi/tags`
latest_tag=`echo $tags | jq -r '.[] | .name' | grep -oP "^tp-smapi/\K.*" | sort --version-sort | tail -1`
sha256=`curl -sL "https://github.com/evgeni/tp_smapi/archive/tp-smapi/$latest_tag.tar.gz" | sha256sum | cut -d" " -f1`

cat > update.json <<EOF
{
  "version": "$latest_tag",
  "url": "https://github.com/evgeni/tp_smapi/archive/tp-smapi/$latest_tag.tar.gz",
  "sha256": "$sha256"
}
EOF

popd
''