nix-bitcoin/pkgs/lndinit/get-sha256.sh

27 lines
772 B
Bash
Raw Normal View History

2022-03-29 19:48:56 +00:00
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p git gnupg curl jq
set -euo pipefail
TMPDIR="$(mktemp -d -p /tmp)"
trap "rm -rf $TMPDIR" EXIT
cd $TMPDIR
echo "Fetching latest release"
repo=lightninglabs/lndinit
latest=$(curl -s --show-error https://api.github.com/repos/$repo/releases/latest | jq -r .tag_name)
echo "Latest release is $latest"
git clone --depth 1 --branch $latest https://github.com/lightninglabs/lndinit 2>/dev/null
cd lndinit
# GPG verification
export GNUPGHOME=$TMPDIR
echo "Fetching Oliver Gugger's key"
gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys F4FC70F07310028424EFC20A8E4256593F177720 2> /dev/null
echo "Verifying latest release"
git verify-tag $latest
echo "tag: $latest"
git checkout -q tags/$latest
rm -rf .git
nix hash path .