nix-bitcoin/pkgs/rtl/generate.sh

42 lines
1.1 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
2021-11-08 03:41:42 -08:00
set -euo pipefail
. "${BASH_SOURCE[0]%/*}/../../helper/run-in-nix-env" "gnupg wget gnused" "$@"
2021-11-08 03:41:42 -08:00
2022-08-27 05:08:47 -07:00
version="0.13.1"
2021-12-14 10:51:19 -08:00
repo=https://github.com/Ride-The-Lightning/RTL
scriptDir=$(cd "${BASH_SOURCE[0]%/*}" && pwd)
updateSrc() {
TMPDIR=$(mktemp -d /tmp/rtl.XXX)
trap 'rm -rf $TMPDIR' EXIT
2021-12-14 10:51:19 -08:00
# Fetch and verify source tarball
export GNUPGHOME=$TMPDIR
# Fetch saubyk's key
gpg --keyserver hkps://keyserver.ubuntu.com --recv-key 3E9BD4436C288039CA827A9200C9E2BC2E45666F
file=v$version.tar.gz
wget -P "$TMPDIR" "$repo/archive/refs/tags/$file"
wget -P "$TMPDIR" "$repo/releases/download/v$version/$file.asc"
gpg --verify "$TMPDIR/$file.asc" "$TMPDIR/$file"
hash=$(nix hash file "$TMPDIR/$file")
2021-11-08 03:41:42 -08:00
sed -i "
s|\bversion = .*;|version = \"$version\";|
s|\bhash = .*;|hash = \"$hash\";|
" default.nix
}
2021-11-08 03:41:42 -08:00
updateNodeModulesHash() {
"$scriptDir/../../helper/update-fixed-output-derivation.sh" ./default.nix rtl.nodeModules nodeModules
}
2021-11-08 03:41:42 -08:00
if [[ $# == 0 ]]; then
# Each of these can be run separately
updateSrc
updateNodeModulesHash
else
"$@"
fi