mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-11-19 18:37:41 +01:00
Compare commits
23 Commits
5128-debug
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
771a03f9c9 | ||
|
|
254d982e91 | ||
|
|
36d0f39e7d | ||
|
|
f270960279 | ||
|
|
2696f59075 | ||
|
|
fdbb3b8119 | ||
|
|
3500186968 | ||
|
|
678ec7a4e9 | ||
|
|
34a12b7768 | ||
|
|
76a94e3b37 | ||
|
|
463ce18643 | ||
|
|
f7d5c29c22 | ||
|
|
2f3610f531 | ||
|
|
1ada4ac6f2 | ||
|
|
548ce434b6 | ||
|
|
ef2fa4e942 | ||
|
|
374d6e2410 | ||
|
|
d0c81b8942 | ||
|
|
6af0211741 | ||
|
|
dee2569212 | ||
|
|
d4303e8682 | ||
|
|
cffda2d39c | ||
|
|
fb311f8c26 |
@@ -1,3 +1,10 @@
|
||||
## What's new in Version 1.12.1 of RaspiBlitz?
|
||||
|
||||
- Update: Bitcoin Core v29.2 [details](https://github.com/bitcoin/bitcoin/blob/master/doc/release-notes/release-notes-29.2.md)
|
||||
- Update: Electrum Server in Rust (electrs) v0.10.10 [details](https://github.com/romanz/electrs/blob/master/RELEASE-NOTES.md#01010-jul-19-2025)
|
||||
- Update: AlbyHub v1.20.0 [details](https://github.com/getAlby/hub/releases/tag/v1.20.0)
|
||||
- Update: Bitcoin Knots 29.2 (optional) [details](https://github.com/bitcoinknots/bitcoin/releases/tag/v29.2.knots20251010)
|
||||
|
||||
## What's new in Version 1.12.0 of RaspiBlitz?
|
||||
|
||||
Introducing a new drive layout, now allowing to even boot and running the system from NVMe.
|
||||
|
||||
@@ -407,7 +407,7 @@ echo -e "\n*** SOFTWARE UPDATE ***"
|
||||
# sqlite3 -> database
|
||||
# fdisk -> create partitions
|
||||
# lsb-release -> needed to know which distro version we're running to add APT sources
|
||||
general_utils="sudo policykit-1 htop git curl bash-completion vim jq dphys-swapfile bsdmainutils autossh telnet vnstat parted dosfstools fbi sysbench build-essential dialog bc python3-dialog unzip whois fdisk lsb-release smartmontools rsyslog qrencode dnsutils"
|
||||
general_utils="sudo htop git curl bash-completion vim jq dphys-swapfile bsdmainutils autossh telnet vnstat parted dosfstools fbi sysbench build-essential dialog bc python3-dialog unzip whois fdisk lsb-release smartmontools rsyslog qrencode dnsutils"
|
||||
# add btrfs-progs if not bookworm on aarch64
|
||||
[ "${architecture}" = "aarch64" ] && ! grep "12 (bookworm)" < /etc/os-release && general_utils="${general_utils} btrfs-progs"
|
||||
# python3-mako --> https://github.com/rootzoll/raspiblitz/issues/3441
|
||||
@@ -423,8 +423,25 @@ apt-get autoremove -y
|
||||
|
||||
echo -e "\n*** Python DEFAULT libs & dependencies ***"
|
||||
|
||||
if [ -f "/usr/bin/python3.11" ]; then
|
||||
# use python 3.11 if available
|
||||
if [ -f "/usr/bin/python3.13" ]; then
|
||||
# use python 3.13 if available (Debian 13 Trixie)
|
||||
update-alternatives --install /usr/bin/python python /usr/bin/python3.13 1
|
||||
# keep python backwards compatible
|
||||
ln -s /usr/bin/python3.13 /usr/bin/python3.9
|
||||
ln -s /usr/bin/python3.13 /usr/bin/python3.10
|
||||
ln -s /usr/bin/python3.13 /usr/bin/python3.11
|
||||
ln -s /usr/bin/python3.13 /usr/bin/python3.12
|
||||
echo "python calls python3.13"
|
||||
elif [ -f "/usr/bin/python3.12" ]; then
|
||||
# use python 3.12 if available
|
||||
update-alternatives --install /usr/bin/python python /usr/bin/python3.12 1
|
||||
# keep python backwards compatible
|
||||
ln -s /usr/bin/python3.12 /usr/bin/python3.9
|
||||
ln -s /usr/bin/python3.12 /usr/bin/python3.10
|
||||
ln -s /usr/bin/python3.12 /usr/bin/python3.11
|
||||
echo "python calls python3.12"
|
||||
elif [ -f "/usr/bin/python3.11" ]; then
|
||||
# use python 3.11 if available (Debian 12 Bookworm)
|
||||
update-alternatives --install /usr/bin/python python /usr/bin/python3.11 1
|
||||
# keep python backwards compatible
|
||||
ln -s /usr/bin/python3.11 /usr/bin/python3.9
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
variable "iso_name" { default = "debian-12.11.0-amd64-netinst.iso" }
|
||||
variable "iso_checksum" { default = "30ca12a15cae6a1033e03ad59eb7f66a6d5a258dcf27acd115c2bd42d22640e8" }
|
||||
# images, checksums and signatures are at:
|
||||
# https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/
|
||||
variable "iso_name" { default = "debian-13.1.0-amd64-netinst.iso" }
|
||||
variable "iso_checksum" { default = "658b28e209b578fe788ec5867deebae57b6aac5fce3692bbb116bab9c65568b3" }
|
||||
|
||||
variable "pack" { default = "lean" }
|
||||
variable "github_user" { default = "raspiblitz" }
|
||||
|
||||
@@ -459,7 +459,13 @@ Do you really want to update Bitcoin Core now?
|
||||
|
||||
error=""
|
||||
warn=""
|
||||
sudo -u admin /home/admin/config.scripts/bitcoin.update.sh tested
|
||||
sudo -u admin /home/admin/config.scripts/bitcoin.update.sh tested || {
|
||||
whiptail --title "ERROR" --msgbox "bitcoin.update.sh failed
|
||||
|
||||
It was called at $(readlink -f "${BASH_SOURCE[0]}"):${LINENO}
|
||||
Consider running that manually to debug " 10 80
|
||||
exit 0
|
||||
}
|
||||
whiptail \
|
||||
--title " Bitcoin Core update " \
|
||||
--yes-button "Reboot" \
|
||||
|
||||
@@ -63,6 +63,10 @@ if [ "$1" == "prestart" ]; then
|
||||
echo "${bitcoinlog_entry}=${bitcoinlog_path}" >> /mnt/hdd/app-data/bitcoin/bitcoin.conf
|
||||
fi
|
||||
|
||||
# delete any debuglogfile in app-storage and link to new location in app-data
|
||||
rm -f /mnt/hdd/app-storage/bitcoin/debug.log
|
||||
ln -s /mnt/hdd/app-data/bitcoin/debug.log /mnt/hdd/app-storage/bitcoin/debug.log
|
||||
|
||||
# make sure entry has the correct value
|
||||
echo "# make sure entry(${bitcoinlog_entry}) has the correct value(${bitcoinlog_path})"
|
||||
sed -i "s|^${bitcoinlog_entry}=.*|${bitcoinlog_entry}=${bitcoinlog_path}|g" /mnt/hdd/app-data/bitcoin/bitcoin.conf
|
||||
|
||||
3
home.admin/config.scripts/bitcoin.install.sh
Normal file → Executable file
3
home.admin/config.scripts/bitcoin.install.sh
Normal file → Executable file
@@ -2,7 +2,7 @@
|
||||
|
||||
# set version (change if update is available)
|
||||
# https://bitcoincore.org/en/download/
|
||||
bitcoinVersion="29.0"
|
||||
bitcoinVersion="29.2"
|
||||
|
||||
|
||||
# command info
|
||||
@@ -146,6 +146,7 @@ if [ "$1" = "install" ]; then
|
||||
# install
|
||||
sudo -u admin tar -xvf ${binaryName}
|
||||
sudo install -m 0755 -o root -g root -t /usr/local/bin/ bitcoin-${bitcoinVersion}/bin/*
|
||||
sudo install -m 0644 -o root -g root -D -t /usr/local/share/man/man1 bitcoin-${bitcoinVersion}/share/man/man1/*
|
||||
sleep 3
|
||||
if ! sudo /usr/local/bin/bitcoind --version | grep "${bitcoinVersion}"; then
|
||||
echo
|
||||
|
||||
@@ -28,7 +28,7 @@ fi
|
||||
mode="$1"
|
||||
|
||||
# RECOMMENDED UPDATE BY RASPIBLITZ TEAM (latest tested version available)
|
||||
bitcoinVersion="" # example: 22.0 .. keep empty if no newer version as sd card build is available
|
||||
bitcoinVersion="30.0" # example: 22.0 .. keep empty if no newer version as sd card build is available
|
||||
|
||||
# GATHER DATA
|
||||
# setting download directory to the current user
|
||||
@@ -44,7 +44,7 @@ elif [ "$(uname -m | grep -c 'x86_64')" -gt 0 ]; then
|
||||
fi
|
||||
|
||||
# installed version
|
||||
installedVersion=$(sudo -u bitcoin bitcoind --version | head -n1 | cut -d" " -f4 | cut -c 2-)
|
||||
installedVersion=$(sudo -u bitcoin bitcoind --version | head -n1 | cut -d" " -f5 | cut -c 2-)
|
||||
|
||||
# test if the installed version already the tested/recommended update version
|
||||
bitcoinUpdateInstalled=$(echo "${installedVersion}" | grep -c "${bitcoinVersion}")
|
||||
@@ -137,12 +137,12 @@ if [ "${mode}" = "tested" ]; then
|
||||
if [ "${result}" -eq 2 ]; then
|
||||
# this can happen if bitcoin install script already has a higher version then the tested version set by this script (see above)
|
||||
echo "# installed version is newer then to be updated version --> ABORT"
|
||||
echo
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
if [ "${result}" -eq 0 ]; then
|
||||
echo "# version is already installed --> ABORT"
|
||||
echo
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -288,6 +288,7 @@ if [ "${mode}" = "tested" ] || [ "${mode}" = "reckless" ] || [ "${mode}" = "cust
|
||||
echo "# Installing Bitcoin Core v${bitcoinVersion}"
|
||||
tar -xvf ${binaryName}
|
||||
sudo install -m 0755 -o root -g root -t /usr/local/bin/ bitcoin-${bitcoinVersion}/bin/*
|
||||
sudo install -m 0644 -o root -g root -D -t /usr/local/share/man/man1 bitcoin-${bitcoinVersion}/share/man/man1/*
|
||||
sleep 3
|
||||
if ! sudo -u bitcoin /usr/local/bin/bitcoind --version | grep "${bitcoinVersion}"; then
|
||||
echo
|
||||
|
||||
@@ -123,12 +123,16 @@ else
|
||||
echo "# FAIL - git config pull.rebase true"
|
||||
exit
|
||||
fi
|
||||
git pull 1>&2
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "# OK - git pull"
|
||||
if [[ ${activeBranch} != pr* ]]; then
|
||||
git pull 1>&2
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "# OK - git pull"
|
||||
else
|
||||
echo "# FAIL - git pull"
|
||||
exit
|
||||
fi
|
||||
else
|
||||
echo "# FAIL - git pull"
|
||||
exit
|
||||
echo "# SKIP - git pull on PR-Branches"
|
||||
fi
|
||||
cd ..
|
||||
echo "# COPYING from GIT-Directory to /home/admin/"
|
||||
|
||||
@@ -328,13 +328,16 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
||||
echo "error='pip install upgrade Cython'"
|
||||
fi
|
||||
echo "# Installing dependencies from requirements.txt ..."
|
||||
sudo -u blitzapi ./venv/bin/python -m pip install --upgrade pip
|
||||
echo -e "[global]\nindex-url = https://pypi.org/simple" | sudo tee /etc/pip.conf > /dev/nul
|
||||
# install with https://www.piwheels.org/simple turned off to avoid issues with some packages
|
||||
sudo -u blitzapi env PIP_CONFIG_FILE=/dev/null PIP_INDEX_URL=https://pypi.org/simple PIP_EXTRA_INDEX_URL= ./venv/bin/pip install --no-cache-dir rich-toolkit==0.14.6
|
||||
echo -e "[global]\nindex-url = https://pypi.org/simple\nextra-index-url = https://www.piwheels.org/simple" | sudo tee /etc/pip.conf > /dev/null
|
||||
if ! sudo -u blitzapi ./venv/bin/pip install --no-cache-dir -r requirements.txt --no-deps; then
|
||||
echo "error='pip install failed'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
# prepare systemd service
|
||||
echo "# Creating blitzapi systemd service..."
|
||||
echo "
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
APPID="albyhub" # one-word lower-case no-specials
|
||||
|
||||
# https://github.com/getAlby/hub/releases
|
||||
VERSION="1.17.2"
|
||||
VERSION="1.20.0"
|
||||
|
||||
# port numbers the app should run on
|
||||
# delete if not an web app
|
||||
|
||||
@@ -148,6 +148,11 @@ if [ "$1" = "prestart" ]; then
|
||||
echo "## btc-rpc-explorer.service PRESTART CONFIG"
|
||||
echo "# --> /home/btcrpcexplorer/.config/btc-rpc-explorer.env"
|
||||
|
||||
# Robust initial values to avoid unset-variable issues
|
||||
isElectrsReady=0
|
||||
isFulcrumReady=0
|
||||
electrumTCPport=""
|
||||
|
||||
# check if electrs is installed & running
|
||||
if [ "${ElectRS}" == "on" ]; then
|
||||
|
||||
@@ -166,17 +171,18 @@ if [ "$1" = "prestart" ]; then
|
||||
electrumTCPport=50021
|
||||
fi
|
||||
|
||||
# Exit only if either service is on but neither is ready
|
||||
if { [ "${ElectRS}" == "on" ] && [ "${electrsReady}" == "0" ]; } || { [ "${fulcrum}" == "on" ] && [ "${fulcrumReady}" == "0" ]; }; then
|
||||
# Exit only if either service is on but not ready
|
||||
if { [ "${ElectRS}" == "on" ] && [ "${isElectrsReady}" == "0" ]; } || { [ "${fulcrum}" == "on" ] && [ "${isFulcrumReady}" == "0" ]; }; then
|
||||
echo "# An Electrum Server is ON but not ready .. might still building index - kick systemd service into fail/wait/restart"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ${isElectrsReady} -gt 0 ] || [ ${isFulcrumReady} -gt 0 ]; then
|
||||
if [ "${isElectrsReady}" -gt 0 ] || [ "${isFulcrumReady}" -gt 0 ]; then
|
||||
# CHECK THAT ELECTRUM SERVER IS PART OF CONFIG
|
||||
echo "# updating BTCEXP_ADDRESS_API=electrumx"
|
||||
sed -i 's/^BTCEXP_ADDRESS_API=.*/BTCEXP_ADDRESS_API=electrumx/g' /home/btcrpcexplorer/.config/btc-rpc-explorer.env
|
||||
sed -i "s/^BTCEXP_ELECTRUMX_SERVERS=.*/BTCEXP_ELECTRUMX_SERVERS=tcp://127.0.0.1:${electrumTCPport}/g" /home/btcrpcexplorer/.config/btc-rpc-explorer.env
|
||||
# Use different delimiter to avoid collision with "tcp://"
|
||||
sed -i "s|^BTCEXP_ELECTRUMX_SERVERS=.*|BTCEXP_ELECTRUMX_SERVERS=tcp://127.0.0.1:${electrumTCPport}|g" /home/btcrpcexplorer/.config/btc-rpc-explorer.env
|
||||
else
|
||||
# ELECTRS=OFF --> MAKE SURE IT IS NOT CONNECTED
|
||||
echo "# updating BTCEXP_ADDRESS_API=none"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
# https://github.com/romanz/electrs/releases
|
||||
ELECTRSVERSION="v0.10.6"
|
||||
ELECTRSVERSION="v0.10.10"
|
||||
|
||||
# command info
|
||||
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
||||
@@ -232,22 +232,25 @@ Check 'sudo nginx -t' for a detailed error message.
|
||||
echo
|
||||
echo "On Network Settings > Server menu:"
|
||||
echo "- deactivate automatic server selection"
|
||||
echo "- as manual server set '${localIP}' & '${portSSL}'"
|
||||
echo "- as manual server set '${localIP}':'${portTCP}':t"
|
||||
echo "- laptop and RaspiBlitz need to be within same local network"
|
||||
echo
|
||||
echo "To start directly from laptop terminal use"
|
||||
echo "PC: electrum --oneserver --server ${localIP}:${portSSL}:s"
|
||||
echo "MAC: open -a /Applications/Electrum.app --args --oneserver --server ${localIP}:${portSSL}:s"
|
||||
echo "PC: electrum --oneserver --server ${localIP}:${portTCP}:t"
|
||||
echo "MAC: open -a /Applications/Electrum.app --args --oneserver --server ${localIP}:${portTCP}:t"
|
||||
if [ ${TorRunning} -eq 1 ]; then
|
||||
echo
|
||||
echo "The Tor Hidden Service address for electrs is (see LCD for QR code):"
|
||||
echo "${TORaddress}"
|
||||
echo
|
||||
echo "To connect through TOR open the Tor Browser and start with the options:"
|
||||
echo "electrum --oneserver --server ${TORaddress}:50002:s --proxy socks5:127.0.0.1:9150"
|
||||
echo "electrum --oneserver --server ${TORaddress}:50001:t --proxy socks5:127.0.0.1:9150"
|
||||
sudo /home/admin/config.scripts/blitz.display.sh qr "${TORaddress}"
|
||||
fi
|
||||
echo
|
||||
echo "If you want to use SSL encrypted connections use in examples above"
|
||||
echo "'${localIP}':'${portSSL}':s' instead of '${localIP}':'${portTCP}':t"
|
||||
echo
|
||||
echo "For more details check the RaspiBlitz README on ElectRS:"
|
||||
echo "https://github.com/rootzoll/raspiblitz"
|
||||
echo
|
||||
@@ -303,7 +306,7 @@ if [ "$1" = "install" ]; then
|
||||
echo "# Installing Rust for the electrs user"
|
||||
echo
|
||||
# https://github.com/romanz/electrs/blob/master/doc/usage.md#build-dependencies
|
||||
sudo -u electrs curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sudo -u electrs sh -s -- --default-toolchain none -y
|
||||
sudo -u electrs curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sudo -u electrs sh -s -- --default-toolchain stable -y
|
||||
sudo apt install -y clang cmake build-essential # for building 'rust-rocksdb'
|
||||
|
||||
echo
|
||||
@@ -605,7 +608,7 @@ if [ "$1" = "update" ]; then
|
||||
"${PGPsigner}" "${PGPpubkeyLink}" "${PGPpubkeyFingerprint}" "${updateVersion}" || exit 1
|
||||
|
||||
echo "# Installing build dependencies"
|
||||
sudo -u electrs curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sudo -u electrs sh -s -- --default-toolchain none -y
|
||||
sudo -u electrs curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sudo -u electrs sh -s -- --default-toolchain stable -y
|
||||
sudo apt install -y clang cmake build-essential # for building 'rust-rocksdb'
|
||||
echo
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# set version (change if update is available)
|
||||
# https://github.com/ElementsProject/elements/releases
|
||||
VERSION="elements-23.2.7"
|
||||
VERSION="elements-23.3.0"
|
||||
SIG_PUBKEY="BD0F3062F87842410B06A0432F656B0610604482" # Pablo Greco <pgreco@blockstream.com>
|
||||
|
||||
# command info
|
||||
|
||||
@@ -12,10 +12,10 @@ APPID="knots" # one-word lower-case no-specials
|
||||
|
||||
# clean human readable version - will be displayed in UI
|
||||
# just numbers only separated by dots (2 or 0.1 or 1.3.4 or 3.4.5.2)
|
||||
VERSION="28.1"
|
||||
VERSION="29.2.2"
|
||||
|
||||
FILEMASTER="28.x"
|
||||
FILEMASTERTAG="28.1.knots20250305"
|
||||
FILEMASTER="29.x"
|
||||
FILEMASTERTAG="29.2.knots20251110"
|
||||
|
||||
# the git repo to get the source code from for install
|
||||
GITHUB_REPO="https://github.com/bitcoinknots/bitcoin"
|
||||
@@ -23,7 +23,7 @@ GITHUB_REPO="https://github.com/bitcoinknots/bitcoin"
|
||||
# the github tag of the version of the source code to install
|
||||
# can also be a commit hash
|
||||
# if empty it will use the latest source version
|
||||
GITHUB_TAG="v28.1.knots20250305"
|
||||
GITHUB_TAG="v29.2.knots20251110"
|
||||
|
||||
# the github signature to verify the author
|
||||
# leave GITHUB_SIGN_AUTHOR empty to skip verifying
|
||||
@@ -100,7 +100,7 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
||||
|
||||
# dont install when lightning is already installed
|
||||
# see https://github.com/raspiblitz/raspiblitz/pull/5021#issuecomment-2889640024
|
||||
if [ "${lightning}" != "" ] && [ "$2" != "-force" ]; then
|
||||
if [ "${lightning}" != "" ] && [ "${lightning}" != "none" ] && [ "$2" != "-force" ]; then
|
||||
echo "# ABORT KNOTS INSTALL - at the moment Knots can only be installed & run if no lightning implementation is installed."
|
||||
echo "# For experimental overrule use on terminal: '/home/admin/config.scripts/bonus.knots.sh on -force'"
|
||||
sleep 6
|
||||
|
||||
128
home.admin/config.scripts/cl-plugin.clnnip47.sh
Normal file
128
home.admin/config.scripts/cl-plugin.clnnip47.sh
Normal file
@@ -0,0 +1,128 @@
|
||||
#!/bin/bash
|
||||
|
||||
# command info
|
||||
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
||||
echo
|
||||
echo "Install the cln-nip47 plugin (Nostr Wallet Connect) for Core Lightning"
|
||||
echo "Source: https://github.com/daywalker90/cln-nip47"
|
||||
echo
|
||||
echo "Usage:"
|
||||
echo "cl-plugin.clnnip47.sh [on|off|remove] <testnet|mainnet|signet>"
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# load CLN network aliases and useful vars
|
||||
# provides: netprefix ("" or "t" or "s"), CLCONF, lightningcli_alias, CLNETWORK
|
||||
source <(/home/admin/config.scripts/network.aliases.sh getvars cl $2)
|
||||
|
||||
plugin="cln-nip47"
|
||||
plugindir="/home/bitcoin/cl-plugins-available/${plugin}"
|
||||
pluginbin="${plugindir}/target/release/${plugin}"
|
||||
enabled_dir="/home/bitcoin/${netprefix}cl-plugins-enabled"
|
||||
symlink_target="${enabled_dir}/${plugin}"
|
||||
repo_url="https://github.com/daywalker90/cln-nip47.git"
|
||||
|
||||
# ensure enabled directory exists (idempotent)
|
||||
if [ ! -d "${enabled_dir}" ]; then
|
||||
sudo -u bitcoin mkdir -p "${enabled_dir}"
|
||||
fi
|
||||
|
||||
install_build() {
|
||||
# clone if missing
|
||||
if [ ! -d "${plugindir}/.git" ]; then
|
||||
sudo -u bitcoin mkdir -p "/home/bitcoin/cl-plugins-available"
|
||||
cd /home/bitcoin/cl-plugins-available || exit 1
|
||||
sudo -u bitcoin git clone "${repo_url}" "${plugin}" || exit 1
|
||||
else
|
||||
# update repo if it exists
|
||||
cd "${plugindir}" || exit 1
|
||||
sudo -u bitcoin git fetch --all
|
||||
sudo -u bitcoin git pull --ff-only || true
|
||||
fi
|
||||
|
||||
# build release binary (idempotent) using system-wide Rust (/opt/rust)
|
||||
echo "# Building ${plugin} with cargo --release (RUSTUP_HOME=/opt/rust CARGO_HOME=/opt/rust) ..."
|
||||
cd "${plugindir}" || exit 1
|
||||
sudo -u bitcoin RUSTUP_HOME=/opt/rust CARGO_HOME=/opt/rust cargo build --release || exit 1
|
||||
|
||||
# ensure binary permissions
|
||||
if [ -f "${pluginbin}" ]; then
|
||||
sudo chmod +x "${pluginbin}"
|
||||
else
|
||||
echo "# Build seems to have failed, missing ${pluginbin}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# create/refresh symlink into enabled dir
|
||||
if [ -L "${symlink_target}" ] || [ -f "${symlink_target}" ]; then
|
||||
sudo rm -f "${symlink_target}"
|
||||
fi
|
||||
sudo ln -s "${pluginbin}" "${enabled_dir}" || exit 1
|
||||
}
|
||||
|
||||
if [ "$1" = "on" ]; then
|
||||
install_build
|
||||
|
||||
# set flag in raspiblitz config (idempotent)
|
||||
/home/admin/config.scripts/blitz.conf.sh set ${netprefix}clnnip47 "on"
|
||||
|
||||
# set default CLN config options if not present yet
|
||||
if ! grep -q "^nip47-relays=" "${CLCONF}"; then
|
||||
echo "# setting nip47-relays=wss://relay.getalby.com/v1"
|
||||
sudo /home/admin/config.scripts/blitz.conf.sh set "nip47-relays" "wss://relay.getalby.com/v1" "${CLCONF}" "noquotes"
|
||||
fi
|
||||
if ! grep -q "^nip47-notifications=" "${CLCONF}"; then
|
||||
echo "# setting nip47-notifications=false"
|
||||
sudo /home/admin/config.scripts/blitz.conf.sh set "nip47-notifications" "false" "${CLCONF}" "noquotes"
|
||||
fi
|
||||
|
||||
# restart service to apply updated CLCONF and load plugin (if system is ready)
|
||||
source <(/home/admin/_cache.sh get state)
|
||||
if [ "${state}" = "ready" ] && [ "$3" != "norestart" ]; then
|
||||
echo "# Restarting ${netprefix}lightningd to apply nip47 options and load plugin"
|
||||
sudo systemctl restart ${netprefix}lightningd
|
||||
fi
|
||||
|
||||
# Display next steps
|
||||
echo ""
|
||||
echo "#####################################################################################################"
|
||||
echo "# Usage: cl nip47-create label [budget_msat] [interval]"
|
||||
echo "# https://github.com/daywalker90/cln-nip47?tab=readme-ov-file#methods"
|
||||
echo ""
|
||||
echo "# Example: cl nip47-create my_nwc 10000 30d"
|
||||
echo "creates a new NWC entry named `my_nwc` with a budget of 10000 msat and an interval of 30 days"
|
||||
echo ""
|
||||
echo "# To display as QR code for scanning:"
|
||||
echo "cl nip47-list | jq -r '.[].my_nwc.uri' | qrencode -t ANSIUTF8"
|
||||
echo ""
|
||||
echo "#####################################################################################################"
|
||||
|
||||
|
||||
fi
|
||||
|
||||
if [ "$1" = "off" ]; then
|
||||
echo "# Stop the ${plugin} if running (ignore errors)"
|
||||
$lightningcli_alias plugin stop "${symlink_target}" 2>/dev/null || true
|
||||
|
||||
echo "# Remove symlink from enabled dir"
|
||||
sudo rm -f "${symlink_target}"
|
||||
|
||||
# remove any explicit plugin options from ${CLCONF} using the nip47-* keys (no-op if none)
|
||||
echo "# Clean any nip47-* options from ${CLCONF} (if present)"
|
||||
sudo sed -i "/^nip47-/d" ${CLCONF}
|
||||
|
||||
# set flag in raspiblitz config
|
||||
/home/admin/config.scripts/blitz.conf.sh set ${netprefix}clnnip47 "off"
|
||||
|
||||
echo "# The ${plugin} has been disabled"
|
||||
fi
|
||||
|
||||
if [ "$1" = "remove" ]; then
|
||||
# ensure it's turned off first
|
||||
$0 off $2 norestart
|
||||
|
||||
echo "# Removing plugin source directory ${plugindir}"
|
||||
sudo rm -rf "${plugindir}"
|
||||
echo "# Removed ${plugin}"
|
||||
fi
|
||||
Reference in New Issue
Block a user