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

27 lines
799 B
Bash
Raw Normal View History

#!/usr/bin/env bash
2022-03-29 12:48:56 -07:00
set -euo pipefail
. "${BASH_SOURCE[0]%/*}/../../helper/run-in-nix-env" "git gnupg curl jq" "$@"
2022-03-29 12:48:56 -07:00
TMPDIR=$(mktemp -d -p /tmp)
trap 'rm -rf $TMPDIR' EXIT
cd "$TMPDIR"
2022-03-29 12:48:56 -07: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 12:48:56 -07:00
echo "Latest release is $latest"
git clone --depth 1 --branch "$latest" https://github.com/lightninglabs/lndinit 2>/dev/null
2022-03-29 12:48:56 -07: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 12:48:56 -07:00
echo "tag: $latest"
git checkout -q "tags/$latest"
2022-03-29 12:48:56 -07:00
rm -rf .git
nix hash path .