diff options
author | Peter Hoeg <peter@hoeg.com> | 2018-01-12 23:02:30 +0800 |
---|---|---|
committer | Peter Hoeg <peter@hoeg.com> | 2018-01-12 23:02:39 +0800 |
commit | 96e777adfdcdb82efe41f6f88e312d23f2e80654 (patch) | |
tree | 186ad3ba74adba5af79d0c74d121aea3ea8e139b /pkgs/servers | |
parent | 754b5961a25c4329c45860333410d4713b0a7ffe (diff) |
uchiwa: add update script
Diffstat (limited to 'pkgs/servers')
-rwxr-xr-x | pkgs/servers/monitoring/uchiwa/update.sh | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/pkgs/servers/monitoring/uchiwa/update.sh b/pkgs/servers/monitoring/uchiwa/update.sh new file mode 100755 index 0000000000000..10da7f8adbf93 --- /dev/null +++ b/pkgs/servers/monitoring/uchiwa/update.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i bash -p curl.bin git.out nix jq.out nodePackages.bower2nix + +set -euo pipefail +IFS=$'\n\t' + +# set -x + +REPO=sensu/uchiwa +VERSION=0.0.1 +SHA="1111111111111111111111111111111111111111111111111111" +DIR=$(pwd) + +write_src() { + cat <<_EOF > $DIR/src.nix +{ + version = "${VERSION}"; + sha256 = "${SHA}"; +} +_EOF +} + +LATEST_VERSION=$(curl https://api.github.com/repos/${REPO}/tags -s | jq '.[0]' -r | jq .name -r) +echo "Latest version: ${LATEST_VERSION}" + +VERSION=${1:-${LATEST_VERSION}} +echo "Updating to: ${VERSION}" + +TOP=$(git rev-parse --show-toplevel) + +cd $(dirname $0) + +write_src +pushd $TOP >/dev/null +SHA=$(nix-prefetch-url -A uchiwa.src) +popd >/dev/null +write_src + +curl https://raw.githubusercontent.com/${REPO}/${VERSION}/bower.json -s > bower.json +rm -f bower-packages.nix +bower2nix bower.json $DIR/bower-packages.nix +rm -f bower.json |