Skip to content

Instantly share code, notes, and snippets.

@jonasnick
Created October 26, 2021 12:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonasnick/5242eea465372884d77d2db647f3072f to your computer and use it in GitHub Desktop.
Save jonasnick/5242eea465372884d77d2db647f3072f to your computer and use it in GitHub Desktop.
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p git gnupg curl
set -euo pipefail
TMPDIR="$(mktemp -d -p /tmp)"
trap "rm -rf $TMPDIR" EXIT
cd $TMPDIR
echo "Fetching latest release"
git clone https://github.com/elementsproject/elements 2> /dev/null
cd elements
latest=$(git describe --tags `git rev-list --tags --max-count=1`)
echo "Latest release is ${latest}"
# GPG verification
export GNUPGHOME=$TMPDIR
echo "Fetching Andrew's Key"
curl https://www.wpsoftware.net/andrew/andrew.gpg > andrew.gpg
gpg --import andrew.gpg
echo "Verifying latest release"
git verify-tag ${latest}
echo "tag: ${latest}"
# The prefix option is necessary because GitHub prefixes the archive contents in this format
sha=$(git archive --format tar.gz --prefix=elements-${latest}/ ${latest} | sha256sum | cut -d\ -f1)
echo "sha256: $sha"
echo "in base32: $(nix hash to-base32 --type sha256 $sha)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment