summary refs log tree commit diff
path: root/pkgs/servers/monitoring/uchiwa/update.sh
blob: 2802037a4f52b4d679779bc6a8bc3e2b5aab3dd0 (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
24
25
26
27
28
29
30
31
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p nodePackages.bower2nix curl.bin git.out jq.out

set -euo pipefail
IFS=$'\n\t'

# set -x

REPO=sensu/uchiwa

VERSION=$(curl https://api.github.com/repos/${REPO}/tags -s | jq '.[0]' -r | jq .name -r)

t=$(mktemp)

echo "Updating to: ${VERSION}"

curl https://raw.githubusercontent.com/${REPO}/${VERSION}/bower.json -s > $t
bower2nix $t bower-packages.nix

pushd $(git rev-parse --show-toplevel)
sha=$(nix-prefetch-url -A uchiwa.src)
popd

cat <<_EOF > src.nix
{
  version = "${VERSION}";
  sha256  = "${sha}";
}
_EOF

rm $t