cdb: fix -Werror messages
[NixPkgs.git] / pkgs / applications / blockchains / electrs / update.sh
blobdb6a2fa5639f200b0a72ac787b93b5c7ee2ea658
1 #!/usr/bin/env nix-shell
2 #!nix-shell -i bash -p coreutils curl jq git gnupg common-updater-scripts
3 set -euo pipefail
5 # Fetch latest release, GPG-verify the tag, update derivation
7 scriptDir=$(cd "${BASH_SOURCE[0]%/*}" && pwd)
8 nixpkgs=$(realpath "$scriptDir"/../../../..)
10 oldVersion=$(nix-instantiate --eval -E "(import \"$nixpkgs\" { config = {}; overlays = []; }).electrs.version" | tr -d '"')
11 version=$(curl -s --show-error "https://api.github.com/repos/romanz/electrs/releases/latest" | jq -r '.tag_name' | tail -c +2)
13 if [[ $version == $oldVersion ]]; then
14 echo "Already at latest version $version"
15 exit 0
17 echo "New version: $version"
19 tmpdir=$(mktemp -d /tmp/electrs-verify-gpg.XXX)
20 repo=$tmpdir/repo
21 trap "rm -rf $tmpdir" EXIT
23 git clone --depth 1 --branch v${version} -c advice.detachedHead=false https://github.com/romanz/electrs $repo
24 git -C $repo checkout tags/v${version}
26 export GNUPGHOME=$tmpdir
27 echo
28 echo "Fetching romanz's key"
29 gpg --keyserver hkps://keys.openpgp.org --recv-keys 15c8c3574ae4f1e25f3f35c587cae5fa46917cbb 2> /dev/null
30 echo
31 echo "Verifying commit"
32 git -C $repo verify-tag v${version}
34 rm -rf $repo/.git
35 hash=$(nix hash path $repo)
37 (cd "$nixpkgs" && update-source-version electrs "$version" "$hash" && update-source-version electrs --ignore-same-version --source-key=cargoDeps)
38 echo
39 echo "electrs: $oldVersion -> $version"