sdrangel: fix build on x86_64-darwin
[NixPkgs.git] / pkgs / tools / misc / ntfy-sh / update.sh
blob748c4df6542793d2e0d2373bbc5dc237588e08bb
1 #! /usr/bin/env nix-shell
2 #! nix-shell -i bash -p gnugrep gnused coreutils curl wget jq nix-update prefetch-npm-deps nodejs
4 set -euo pipefail
5 pushd "$(dirname "${BASH_SOURCE[0]}")"
7 version=$(curl -s "https://api.github.com/repos/binwiederhier/ntfy/tags" | jq -r .[0].name | grep -oP "^v\K.*")
8 url="https://raw.githubusercontent.com/binwiederhier/ntfy/v$version/"
10 if [[ "$UPDATE_NIX_OLD_VERSION" == "$version" ]]; then
11 echo "Already up to date!"
12 exit 0
15 rm -f package-lock.json
16 wget "$url/web/package-lock.json"
17 npm_hash=$(prefetch-npm-deps package-lock.json)
18 sed -i 's#npmDepsHash = "[^"]*"#npmDepsHash = "'"$npm_hash"'"#' default.nix
19 rm -f package-lock.json
21 popd
22 nix-update ntfy-sh --version $version