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

27 lines
769 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"
2022-03-29 19:48:56 +00:00
echo "Fetching latest release"
repo=lightninglabs/lndinit
latest=$(curl -fsS "https://api.github.com/repos/$repo/releases/latest" | jq -r .tag_name)
2022-03-29 19:48:56 +00:00
echo "Latest release is $latest"
git clone --depth 1 --branch "$latest" https://github.com/lightninglabs/lndinit 2>/dev/null
2022-03-29 19:48:56 +00:00
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"
2022-03-29 19:48:56 +00:00
echo "tag: $latest"
git checkout -q "tags/$latest"
2022-03-29 19:48:56 +00:00
rm -rf .git
nix hash path .