2021-11-08 03:42:24 -08:00
|
|
|
#!/usr/bin/env nix-shell
|
2022-08-21 05:41:38 -07:00
|
|
|
#! nix-shell -i bash -p gnupg wget gnused
|
2021-11-08 03:42:24 -08:00
|
|
|
set -euo pipefail
|
|
|
|
|
2022-08-21 05:41:38 -07:00
|
|
|
version="0.8.0"
|
2021-12-14 10:51:20 -08:00
|
|
|
repo=https://github.com/Ride-The-Lightning/c-lightning-REST
|
|
|
|
|
2022-08-21 05:41:38 -07:00
|
|
|
scriptDir=$(cd "${BASH_SOURCE[0]%/*}" && pwd)
|
|
|
|
|
|
|
|
updateSrc() {
|
2022-08-16 12:00:00 -07:00
|
|
|
TMPDIR=$(mktemp -d /tmp/clightning-rest.XXX)
|
|
|
|
trap 'rm -rf $TMPDIR' EXIT
|
2021-12-14 10:51:20 -08:00
|
|
|
|
2022-08-21 05:41:38 -07: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
|
2022-08-16 12:00:00 -07:00
|
|
|
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:42:24 -08:00
|
|
|
|
2022-08-21 05:41:38 -07:00
|
|
|
sed -i "
|
|
|
|
s|\bversion = .*;|version = \"$version\";|
|
|
|
|
s|\bhash = .*;|hash = \"$hash\";|
|
|
|
|
" default.nix
|
|
|
|
}
|
2021-11-08 03:42:24 -08:00
|
|
|
|
2022-08-21 05:41:38 -07:00
|
|
|
updateNodeModulesHash() {
|
2022-08-16 12:00:00 -07:00
|
|
|
"$scriptDir/../../helper/update-fixed-output-derivation.sh" ./default.nix clightning-rest.nodeModules nodeModules
|
2022-08-21 05:41:38 -07:00
|
|
|
}
|
2021-11-08 03:42:24 -08:00
|
|
|
|
2022-08-21 05:41:38 -07:00
|
|
|
if [[ $# == 0 ]]; then
|
|
|
|
# Each of these can be run separately
|
|
|
|
updateSrc
|
|
|
|
updateNodeModulesHash
|
|
|
|
else
|
2022-08-16 12:00:00 -07:00
|
|
|
"$@"
|
2022-08-21 05:41:38 -07:00
|
|
|
fi
|