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
|
|
|
|
|
2022-08-16 19:00:00 +00:00
|
|
|
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
|
2022-08-16 19:00:00 +00:00
|
|
|
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"
|
2022-08-16 19:00:00 +00:00
|
|
|
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"
|
2022-08-16 19:00:00 +00:00
|
|
|
git verify-tag "$latest"
|
2022-03-29 19:48:56 +00:00
|
|
|
|
|
|
|
echo "tag: $latest"
|
2022-08-16 19:00:00 +00:00
|
|
|
git checkout -q "tags/$latest"
|
2022-03-29 19:48:56 +00:00
|
|
|
rm -rf .git
|
|
|
|
nix hash path .
|