cln update to v23.02, backup-plugin update, add poetry (#3684)

* cln backup-plugin update, add poetry
* fix mkdir error, remove commented code, fmt #3677
* poetry and path fixes
* add terminal feedback, format #3676
* detect the full name of the plugin
* install pyln-client tqdm with pip
* git-verify: add --keyid-format LONG
to recognise if the signing key is not the main key
* cln update to v23.02
* cln-grpc: add protobuf-compiler dep
* rtl update to v0.13.6 and formatting
* C-lightningREST update to v0.10.1
This commit is contained in:
openoms 2023-03-07 20:06:39 +00:00 committed by GitHub
parent 2f88ea9d25
commit 7639b75311
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 204 additions and 246 deletions

View file

@ -14,10 +14,11 @@
- New on WebUI: Jam (JoinMarket Web UI) v0.1.4 [details](https://github.com/joinmarket-webui/joinmarket-webui/releases/tag/v0.1.4) - New on WebUI: Jam (JoinMarket Web UI) v0.1.4 [details](https://github.com/joinmarket-webui/joinmarket-webui/releases/tag/v0.1.4)
- Update: Bitcoin Core v24.0.1 [details](https://github.com/bitcoin/bitcoin/blob/master/doc/release-notes/release-notes-24.0.1.md) - Update: Bitcoin Core v24.0.1 [details](https://github.com/bitcoin/bitcoin/blob/master/doc/release-notes/release-notes-24.0.1.md)
- Update: LND v0.15.5 [details](https://github.com/lightningnetwork/lnd/releases/tag/v0.15.5-beta) - Update: LND v0.15.5 [details](https://github.com/lightningnetwork/lnd/releases/tag/v0.15.5-beta)
- Update: Core Lightning v22.11.1 [details](https://github.com/ElementsProject/lightning/releases/tag/v22.11.1) - Update: Core Lightning v23.02 [details](https://github.com/ElementsProject/lightning/releases/tag/v23.02)
- Update: C-lightningREST v0.10.1 [details](https://github.com/Ride-The-Lightning/c-lightning-REST/releases/tag/v0.10.1)
- Update: Electrum Server in Rust (electrs) v0.9.11 [details](https://github.com/romanz/electrs/blob/master/RELEASE-NOTES.md#0911-jan-5-2023) - Update: Electrum Server in Rust (electrs) v0.9.11 [details](https://github.com/romanz/electrs/blob/master/RELEASE-NOTES.md#0911-jan-5-2023)
- Update: Lightning Terminal v0.8.4-alpha [details](https://github.com/lightninglabs/lightning-terminal/releases/tag/v0.8.4-alpha) - Update: Lightning Terminal v0.8.4-alpha [details](https://github.com/lightninglabs/lightning-terminal/releases/tag/v0.8.4-alpha)
- Update: RTL v0.13.0 with update option [details](https://github.com/Ride-The-Lightning/RTL/releases/tag/v0.12.3) - Update: RTL v0.13.6 with update option [details](https://github.com/Ride-The-Lightning/RTL/releases/tag/v0.13.6)
- Update: Thunderhub v0.13.16 with balance sharing disabled [details](https://github.com/apotdevin/thunderhub/releases/tag/v0.13.16) - Update: Thunderhub v0.13.16 with balance sharing disabled [details](https://github.com/apotdevin/thunderhub/releases/tag/v0.13.16)
- Update: LNbits 0.9.6 [details](https://github.com/lnbits/lnbits-legend/releases/tag/0.9.6) - Update: LNbits 0.9.6 [details](https://github.com/lnbits/lnbits-legend/releases/tag/0.9.6)
- Update: BTCPayServer 1.7.5 (using postgres for new installs) [details](https://github.com/btcpayserver/btcpayserver/releases/tag/v1.7.5) - Update: BTCPayServer 1.7.5 (using postgres for new installs) [details](https://github.com/btcpayserver/btcpayserver/releases/tag/v1.7.5)

View file

@ -441,6 +441,7 @@ if [ "${clNode}" != "${choice}" ]; then
fi fi
# make sure that cln-grpc is on for the WebAPI # make sure that cln-grpc is on for the WebAPI
echo "# install the cln-grpc plugin"
/home/admin/config.scripts/cl-plugin.cln-grpc.sh install /home/admin/config.scripts/cl-plugin.cln-grpc.sh install
/home/admin/config.scripts/cl-plugin.cln-grpc.sh on /home/admin/config.scripts/cl-plugin.cln-grpc.sh on

View file

@ -94,7 +94,7 @@ case $CHOICE in
fi fi
cd /home/bitcoin/suez || exit 1 cd /home/bitcoin/suez || exit 1
echo echo
sudo -u bitcoin /home/bitcoin/.local/bin/poetry run ./suez --client=c-lightning --client-args=--conf=${CLCONF} sudo -u bitcoin poetry run ./suez --client=c-lightning --client-args=--conf=${CLCONF}
echo echo
echo "Press ENTER to return to main menu." echo "Press ENTER to return to main menu."
read key read key

View file

@ -118,7 +118,7 @@ case $CHOICE in
/home/admin/config.scripts/bonus.suez.sh on /home/admin/config.scripts/bonus.suez.sh on
fi fi
cd /home/bitcoin/suez || exit 1 cd /home/bitcoin/suez || exit 1
sudo -u bitcoin /home/bitcoin/.local/bin/poetry run ./suez \ sudo -u bitcoin poetry run ./suez \
--client-args=-n=${CHAIN} \ --client-args=-n=${CHAIN} \
--client-args=--rpcserver=localhost:1${L2rpcportmod}009 --client-args=--rpcserver=localhost:1${L2rpcportmod}009
echo echo

View file

@ -570,10 +570,10 @@ function suez() {
clear clear
echo "# Showing the channels of ${lightning} ${chain}net - consider reducing the font size (press CTRL- or CMD-)" echo "# Showing the channels of ${lightning} ${chain}net - consider reducing the font size (press CTRL- or CMD-)"
if [ ${lightning} = cl ]; then if [ ${lightning} = cl ]; then
sudo -u bitcoin /home/bitcoin/.local/bin/poetry run ./suez \ sudo -u bitcoin poetry run ./suez \
--client=c-lightning --client-args=--conf=${CLCONF} --client=c-lightning --client-args=--conf=${CLCONF}
elif [ ${lightning} = lnd ]; then elif [ ${lightning} = lnd ]; then
sudo -u bitcoin /home/bitcoin/.local/bin/poetry run ./suez \ sudo -u bitcoin poetry run ./suez \
--client-args=-n=${CHAIN} \ --client-args=-n=${CHAIN} \
--client-args=--rpcserver=localhost:1${L2rpcportmod}009 --client-args=--rpcserver=localhost:1${L2rpcportmod}009
fi fi

View file

@ -30,10 +30,9 @@ PGPsigner="$1"
PGPpubkeyLink="$2" PGPpubkeyLink="$2"
PGPpubkeyFingerprint="$3" PGPpubkeyFingerprint="$3"
wget -O /var/cache/raspiblitz/pgp_keys_${PGPsigner}.asc "${PGPpubkeyLink}" wget -O /var/cache/raspiblitz/pgp_keys_${PGPsigner}.asc "${PGPpubkeyLink}"
gpg --import --import-options show-only /var/cache/raspiblitz/pgp_keys_${PGPsigner}.asc gpg --import --import-options show-only /var/cache/raspiblitz/pgp_keys_${PGPsigner}.asc
fingerprint=$(gpg --show-keys /var/cache/raspiblitz/pgp_keys_${PGPsigner}.asc 2>/dev/null | grep "${PGPpubkeyFingerprint}" -c) fingerprint=$(gpg --show-keys --keyid-format LONG /var/cache/raspiblitz/pgp_keys_${PGPsigner}.asc 2>/dev/null | grep "${PGPpubkeyFingerprint}" -c)
if [ "${fingerprint}" -lt 1 ]; then if [ "${fingerprint}" -lt 1 ]; then
echo echo
echo "# WARNING --> the PGP fingerprint is not as expected for ${PGPsigner}" >&2 echo "# WARNING --> the PGP fingerprint is not as expected for ${PGPsigner}" >&2

View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# https://github.com/Ride-The-Lightning/RTL/releases # https://github.com/Ride-The-Lightning/RTL/releases
RTLVERSION="v0.13.0" RTLVERSION="v0.13.6"
# check and load raspiblitz config # check and load raspiblitz config
# to know which network is running # to know which network is running
@ -117,7 +117,6 @@ Activate Tor to access the web interface from outside your local network.
exit 0 exit 0
fi fi
######################################## ########################################
# INSTALL (just user, code & compile) # INSTALL (just user, code & compile)
######################################## ########################################
@ -455,19 +454,19 @@ if [ "$1" = "prestart" ]; then
# LND changes of config # LND changes of config
if [ "${LNTYPE}" == "lnd" ]; then if [ "${LNTYPE}" == "lnd" ]; then
echo "# LND Config" echo "# LND Config"
cat /mnt/hdd/app-data/rtl/${systemdService}/RTL-Config.json | \ cat /mnt/hdd/app-data/rtl/${systemdService}/RTL-Config.json |
jq ".port = \"${RTLHTTP}\"" | \ jq ".port = \"${RTLHTTP}\"" |
jq ".multiPass = \"${RPCPASSWORD}\"" | \ jq ".multiPass = \"${RPCPASSWORD}\"" |
jq ".multiPassHashed = \"\"" | \ jq ".multiPassHashed = \"\"" |
jq ".nodes[0].lnNode = \"${hostname}\"" | \ jq ".nodes[0].lnNode = \"${hostname}\"" |
jq ".nodes[0].lnImplementation = \"LND\"" | \ jq ".nodes[0].lnImplementation = \"LND\"" |
jq ".nodes[0].Authentication.macaroonPath = \"/home/rtl/.lnd/data/chain/${network}/${CHAIN}/\"" | \ jq ".nodes[0].Authentication.macaroonPath = \"/home/rtl/.lnd/data/chain/${network}/${CHAIN}/\"" |
jq ".nodes[0].Authentication.configPath = \"/home/rtl/.lnd/${netprefix}lnd.conf\"" | \ jq ".nodes[0].Authentication.configPath = \"/home/rtl/.lnd/${netprefix}lnd.conf\"" |
jq ".nodes[0].Authentication.swapMacaroonPath = \"/home/rtl/.loop/${CHAIN}/\"" | \ jq ".nodes[0].Authentication.swapMacaroonPath = \"/home/rtl/.loop/${CHAIN}/\"" |
jq ".nodes[0].Authentication.boltzMacaroonPath = \"/home/rtl/.boltz-lnd/macaroons/\"" | \ jq ".nodes[0].Authentication.boltzMacaroonPath = \"/home/rtl/.boltz-lnd/macaroons/\"" |
jq ".nodes[0].Settings.userPersona = \"OPERATOR\"" | \ jq ".nodes[0].Settings.userPersona = \"OPERATOR\"" |
jq ".nodes[0].Settings.lnServerUrl = \"https://127.0.0.1:${portprefix}8080\"" | \ jq ".nodes[0].Settings.lnServerUrl = \"https://127.0.0.1:${portprefix}8080\"" |
jq ".nodes[0].Settings.channelBackupPath = \"/mnt/hdd/app-data/rtl/${systemdService}-SCB-backup-$hostname\"" | \ jq ".nodes[0].Settings.channelBackupPath = \"/mnt/hdd/app-data/rtl/${systemdService}-SCB-backup-$hostname\"" |
jq ".nodes[0].Settings.swapServerUrl = \"https://127.0.0.1:${SWAPSERVERPORT}\"" >/mnt/hdd/app-data/rtl/${systemdService}/RTL-Config.json.tmp jq ".nodes[0].Settings.swapServerUrl = \"https://127.0.0.1:${SWAPSERVERPORT}\"" >/mnt/hdd/app-data/rtl/${systemdService}/RTL-Config.json.tmp
mv /mnt/hdd/app-data/rtl/${systemdService}/RTL-Config.json.tmp /mnt/hdd/app-data/rtl/${systemdService}/RTL-Config.json mv /mnt/hdd/app-data/rtl/${systemdService}/RTL-Config.json.tmp /mnt/hdd/app-data/rtl/${systemdService}/RTL-Config.json
fi fi
@ -476,19 +475,19 @@ if [ "$1" = "prestart" ]; then
# https://github.com/Ride-The-Lightning/RTL/blob/master/docs/C-Lightning-setup.md # https://github.com/Ride-The-Lightning/RTL/blob/master/docs/C-Lightning-setup.md
if [ "${LNTYPE}" == "cl" ]; then if [ "${LNTYPE}" == "cl" ]; then
echo "# CL Config" echo "# CL Config"
cat /mnt/hdd/app-data/rtl/${systemdService}/RTL-Config.json | \ cat /mnt/hdd/app-data/rtl/${systemdService}/RTL-Config.json |
jq ".port = \"${RTLHTTP}\"" | \ jq ".port = \"${RTLHTTP}\"" |
jq ".multiPass = \"${RPCPASSWORD}\"" | \ jq ".multiPass = \"${RPCPASSWORD}\"" |
jq ".multiPassHashed = \"\"" | \ jq ".multiPassHashed = \"\"" |
jq ".nodes[0].lnNode = \"${hostname}\"" | \ jq ".nodes[0].lnNode = \"${hostname}\"" |
jq ".nodes[0].lnImplementation = \"CLT\"" | \ jq ".nodes[0].lnImplementation = \"CLT\"" |
jq ".nodes[0].Authentication.macaroonPath = \"/home/bitcoin/c-lightning-REST/${CLNETWORK}/certs\"" | \ jq ".nodes[0].Authentication.macaroonPath = \"/home/bitcoin/c-lightning-REST/${CLNETWORK}/certs\"" |
jq ".nodes[0].Authentication.configPath = \"${CLCONF}\"" | \ jq ".nodes[0].Authentication.configPath = \"${CLCONF}\"" |
jq ".nodes[0].Authentication.swapMacaroonPath = \"/home/rtl/.loop/${CHAIN}/\"" | \ jq ".nodes[0].Authentication.swapMacaroonPath = \"/home/rtl/.loop/${CHAIN}/\"" |
jq ".nodes[0].Authentication.boltzMacaroonPath = \"/home/rtl/.boltz-lnd/macaroons/\"" | \ jq ".nodes[0].Authentication.boltzMacaroonPath = \"/home/rtl/.boltz-lnd/macaroons/\"" |
jq ".nodes[0].Settings.userPersona = \"OPERATOR\"" | \ jq ".nodes[0].Settings.userPersona = \"OPERATOR\"" |
jq ".nodes[0].Settings.lnServerUrl = \"https://127.0.0.1:${portprefix}6100\"" | \ jq ".nodes[0].Settings.lnServerUrl = \"https://127.0.0.1:${portprefix}6100\"" |
jq ".nodes[0].Settings.channelBackupPath = \"/mnt/hdd/app-data/rtl/${systemdService}-SCB-backup-$hostname\"" | \ jq ".nodes[0].Settings.channelBackupPath = \"/mnt/hdd/app-data/rtl/${systemdService}-SCB-backup-$hostname\"" |
jq ".nodes[0].Settings.swapServerUrl = \"https://127.0.0.1:${SWAPSERVERPORT}\"" >/mnt/hdd/app-data/rtl/${systemdService}/RTL-Config.json.tmp jq ".nodes[0].Settings.swapServerUrl = \"https://127.0.0.1:${SWAPSERVERPORT}\"" >/mnt/hdd/app-data/rtl/${systemdService}/RTL-Config.json.tmp
mv /mnt/hdd/app-data/rtl/${systemdService}/RTL-Config.json.tmp /mnt/hdd/app-data/rtl/${systemdService}/RTL-Config.json mv /mnt/hdd/app-data/rtl/${systemdService}/RTL-Config.json.tmp /mnt/hdd/app-data/rtl/${systemdService}/RTL-Config.json
fi fi
@ -564,7 +563,6 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then
exit 0 exit 0
fi fi
if [ "$1" = "update" ]; then if [ "$1" = "update" ]; then
echo "# UPDATING RTL" echo "# UPDATING RTL"
cd /home/rtl/RTL || exit 1 cd /home/rtl/RTL || exit 1
@ -616,7 +614,10 @@ if [ "$1" = "update" ]; then
echo "# OK - RTL install looks good" echo "# OK - RTL install looks good"
echo echo
fi fi
currentRTLcommit=$(cd /home/rtl/RTL; git describe --tags) currentRTLcommit=$(
cd /home/rtl/RTL
git describe --tags
)
echo "# Updated RTL to $currentRTLcommit" echo "# Updated RTL to $currentRTLcommit"
else else
echo "# Unknown option: $updateOption" echo "# Unknown option: $updateOption"

View file

@ -33,9 +33,9 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
cd /home/bitcoin || exit 1 cd /home/bitcoin || exit 1
# dependency # poetry
sudo -u bitcoin curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py\ sudo pip3 install --upgrade pip
| sudo -u bitcoin python - sudo pip3 install poetry
# download source code # download source code
sudo -u bitcoin git clone https://github.com/prusnak/suez.git sudo -u bitcoin git clone https://github.com/prusnak/suez.git
@ -43,7 +43,7 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
sudo -u bitcoin git reset --hard $SUEZVERSION sudo -u bitcoin git reset --hard $SUEZVERSION
sudo -u bitcoin /home/admin/config.scripts/blitz.git-verify.sh \ sudo -u bitcoin /home/admin/config.scripts/blitz.git-verify.sh \
"${PGPsigner}" "${PGPpubkeyLink}" "${PGPpubkeyFingerprint}" || exit 1 "${PGPsigner}" "${PGPpubkeyLink}" "${PGPpubkeyFingerprint}" || exit 1
sudo -u bitcoin /home/bitcoin/.local/bin/poetry install sudo -u bitcoin poetry install
# setting value in raspi blitz config # setting value in raspi blitz config
/home/admin/config.scripts/blitz.conf.sh set suez "on" /home/admin/config.scripts/blitz.conf.sh set suez "on"
@ -74,8 +74,8 @@ if [ "$1" = "update" ]; then
echo "# UPDATE SUEZ" echo "# UPDATE SUEZ"
cd /home/bitcoin || exit 1 cd /home/bitcoin || exit 1
# dependency # dependency
sudo -u bitcoin curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py\ sudo pip3 install --upgrade pip
| sudo -u bitcoin python - sudo pip3 install poetry
# download source code # download source code
if [ -d suez ]; then if [ -d suez ]; then
sudo -u bitcoin git clone https://github.com/prusnak/suez.git sudo -u bitcoin git clone https://github.com/prusnak/suez.git
@ -84,7 +84,7 @@ if [ "$1" = "update" ]; then
sudo -u bitcoin git pull sudo -u bitcoin git pull
sudo -u bitcoin /home/admin/config.scripts/blitz.git-verify.sh \ sudo -u bitcoin /home/admin/config.scripts/blitz.git-verify.sh \
"${PGPsigner}" "${PGPpubkeyLink}" "${PGPpubkeyFingerprint}" || exit 1 "${PGPsigner}" "${PGPpubkeyLink}" "${PGPpubkeyFingerprint}" || exit 1
sudo -u bitcoin /home/bitcoin/.local/bin/poetry install sudo -u bitcoin poetry install
echo "# Updated to the latest in https://github.com/prusnak/suez/commits/master" echo "# Updated to the latest in https://github.com/prusnak/suez/commits/master"
exit 0 exit 0
fi fi

View file

@ -16,8 +16,7 @@ function help(){
} }
# https://github.com/lightningd/plugins/commits/master/backup # https://github.com/lightningd/plugins/commits/master/backup
# use the version beore the migration to poetry pinnedVersion="30003279e35e5931fc85d7e6211ea4de6f9554d7"
pinnedVersion="4d3560b129b12cba0381fff0b1e30ac32ef84106"
# command info # command info
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
@ -38,14 +37,21 @@ function install() {
sudo -u bitcoin git pull sudo -u bitcoin git pull
sudo -u bitcoin git reset --hard ${pinnedVersion} || exit 1 sudo -u bitcoin git reset --hard ${pinnedVersion} || exit 1
if [ $($lightningcli_alias plugin list 2>/dev/null | grep -c "${plugin}") -eq 0 ];then if [ $($lightningcli_alias plugin list 2>/dev/null | grep -c "/${plugin}") -eq 0 ]; then
echo "# Checking dependencies" echo "# Checking dependencies"
sudo -u bitcoin pip install --user -r ${plugindir}/${plugin}/requirements.txt 1>/dev/null # upgrade pip
if [ $(echo $PATH | grep -c "/home/bitcoin/.local/bin") -eq 0 ];then sudo pip3 install --upgrade pip
export PATH=$PATH:/home/bitcoin/.local/bin
echo "PATH=\$PATH:/home/bitcoin/.local/bin" | sudo tee -a /etc/profile # pip dependencies
fi sudo -u bitcoin pip3 install pyln-client tqdm
# poetry
sudo pip3 install poetry || exit 1
cd ${plugindir}/backup/ || exit 1
sudo -u bitcoin poetry install
sudo chmod +x ${plugindir}/${plugin}/${plugin}.py sudo chmod +x ${plugindir}/${plugin}/${plugin}.py
# symlink to the default plugin dir # symlink to the default plugin dir
if [ ! -L /home/bitcoin/${netprefix}cl-plugins-enabled/backup.py ]; then if [ ! -L /home/bitcoin/${netprefix}cl-plugins-enabled/backup.py ]; then
sudo ln -s ${plugindir}/backup/backup.py \ sudo ln -s ${plugindir}/backup/backup.py \
@ -72,19 +78,22 @@ if [ "$1" = on ];then
fi fi
# always re-init plugin # always re-init plugin
if sudo ls /home/bitcoin/.lightning/${CLNETWORK}/backup.lock; then if sudo ls /home/bitcoin/.lightning/${CLNETWORK}/backup.lock 2>/dev/null; then
sudo rm /home/bitcoin/.lightning/${CLNETWORK}/backup.lock sudo rm /home/bitcoin/.lightning/${CLNETWORK}/backup.lock
fi fi
# https://github.com/lightningd/plugins/tree/master/backup#setup # https://github.com/lightningd/plugins/tree/master/backup#setup
echo "# Initialize the backup plugin" echo "# Initialize the backup plugin"
sudo -u bitcoin ${plugindir}/backup/backup-cli init\ cd ${plugindir}/backup/ || exit 1
--lightning-dir /home/bitcoin/.lightning/${CLNETWORK} \ sudo -u bitcoin poetry run ./backup-cli init --lightning-dir /home/bitcoin/.lightning/${CLNETWORK} \
file:///home/bitcoin/${netprefix}lightningd.sqlite3.backup file:///home/bitcoin/${netprefix}lightningd.sqlite3.backup
if [ $(crontab -u admin -l | grep -c "backup-compact $CHAIN") -eq 0 ]; then if [ $(crontab -u admin -l | grep -c "backup-compact $CHAIN") -eq 0 ]; then
echo "Add weekly backup-compact as a cronjob" echo "Add weekly backup-compact as a cronjob"
cronjob="@weekly /home/admin/config.scripts/cl-plugin.backup.sh backup-compact $CHAIN" cronjob="@weekly /home/admin/config.scripts/cl-plugin.backup.sh backup-compact $CHAIN"
(crontab -u admin -l; echo "$cronjob" ) | crontab -u admin - (
crontab -u admin -l
echo "$cronjob"
) | crontab -u admin -
fi fi
echo "# The crontab for admin now is:" echo "# The crontab for admin now is:"
crontab -u admin -l crontab -u admin -l
@ -96,8 +105,9 @@ if [ "$1" = on ];then
echo "# Started the ${netprefix}lightningd.service" echo "# Started the ${netprefix}lightningd.service"
fi fi
elif
elif [ "$1" = off ]; then [ "$1" = off ]
then
echo "# Removing the backup plugin" echo "# Removing the backup plugin"
sudo rm -f /home/bitcoin/${netprefix}cl-plugins-enabled/backup.py sudo rm -f /home/bitcoin/${netprefix}cl-plugins-enabled/backup.py
echo "# Backup the existing old backup on the SDcard" echo "# Backup the existing old backup on the SDcard"
@ -107,8 +117,9 @@ elif [ "$1" = off ]; then
echo "# Removing the backup.lock file" echo "# Removing the backup.lock file"
sudo rm -f /home/bitcoin/.lightning/${CLNETWORK}/backup.lock sudo rm -f /home/bitcoin/.lightning/${CLNETWORK}/backup.lock
elif
elif [ "$1" = restore ];then [ "$1" = restore ]
then
install install
@ -118,7 +129,7 @@ elif [ "$1" = restore ];then
sudo systemctl stop ${netprefix}lightningd sudo systemctl stop ${netprefix}lightningd
# https://github.com/lightningd/plugins/tree/master/backup#restoring-a-backup # https://github.com/lightningd/plugins/tree/master/backup#restoring-a-backup
# ./backup-cli restore file:///mnt/external/location ~/.lightning/bitcoin/lightningd.sqlite3 # poetry run ./backup-cli restore file:///mnt/external/location ~/.lightning/bitcoin/lightningd.sqlite3
# make sure to not overwrite old database # make sure to not overwrite old database
if sudo ls /home/bitcoin/.lightning/${CLNETWORK}/lightningd.sqlite3; then if sudo ls /home/bitcoin/.lightning/${CLNETWORK}/lightningd.sqlite3; then
@ -132,7 +143,8 @@ elif [ "$1" = restore ];then
fi fi
# restore # restore
sudo -u bitcoin ${plugindir}/backup/backup-cli restore \ cd ${plugindir}/backup/ || exit 1
sudo -u bitcoin poetry run ./backup-cli restore \
file:///home/bitcoin/${netprefix}lightningd.sqlite3.backup \ file:///home/bitcoin/${netprefix}lightningd.sqlite3.backup \
/home/bitcoin/.lightning/${CLNETWORK}/lightningd.sqlite3 /home/bitcoin/.lightning/${CLNETWORK}/lightningd.sqlite3
@ -143,8 +155,9 @@ elif [ "$1" = restore ];then
fi fi
fi fi
elif
elif [ "$1" = backup-compact ];then [ "$1" = backup-compact ]
then
# https://github.com/lightningd/plugins/tree/master/backup#performing-backup-compaction # https://github.com/lightningd/plugins/tree/master/backup#performing-backup-compaction
dbPath="/home/bitcoin/.lightning/${CLNETWORK}/lightningd.sqlite3" dbPath="/home/bitcoin/.lightning/${CLNETWORK}/lightningd.sqlite3"
backupPath="/home/bitcoin/${netprefix}lightningd.sqlite3.backup" backupPath="/home/bitcoin/${netprefix}lightningd.sqlite3.backup"

View file

@ -35,6 +35,8 @@ function buildGRPCplugin() {
echo "# - install Core Lightning ..." echo "# - install Core Lightning ..."
/home/admin/config.scripts/cl.install.sh install || exit 1 /home/admin/config.scripts/cl.install.sh install || exit 1
fi fi
echo "# install dependencies"
sudo apt-get install protobuf-compiler -y
echo "# rust for cln-grpc, includes rustfmt" echo "# rust for cln-grpc, includes rustfmt"
sudo -u bitcoin curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sudo -u bitcoin sh -s -- -y sudo -u bitcoin curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sudo -u bitcoin sh -s -- -y
cd /home/bitcoin/lightning/plugins/grpc-plugin || exit 1 cd /home/bitcoin/lightning/plugins/grpc-plugin || exit 1
@ -61,7 +63,7 @@ function switchOn() {
# symlink to plugin directory # symlink to plugin directory
echo "# symlink cln-grpc to /home/bitcoin/${netprefix}cl-plugins-enabled/" echo "# symlink cln-grpc to /home/bitcoin/${netprefix}cl-plugins-enabled/"
# delete old symlink # delete old symlink
sudo rm /home/bitcoin/${netprefix}cl-plugins-enabled/cln-grpc sudo rm -f /home/bitcoin/${netprefix}cl-plugins-enabled/cln-grpc
sudo ln -s /home/bitcoin/cl-plugins-available/cln-grpc /home/bitcoin/${netprefix}cl-plugins-enabled/ sudo ln -s /home/bitcoin/cl-plugins-available/cln-grpc /home/bitcoin/${netprefix}cl-plugins-enabled/
# blitz.conf.sh set [key] [value] [?conffile] <noquotes> # blitz.conf.sh set [key] [value] [?conffile] <noquotes>

View file

@ -43,7 +43,7 @@ if [ "$1" = "on" ];then
fi fi
else else
if [ $($lightningcli_alias | grep -c "${plugin}") -eq 0 ];then if [ $($lightningcli_alias | grep -c "/${plugin}") -eq 0 ]; then
echo "# Just start the ${plugin} plugin" echo "# Just start the ${plugin} plugin"
sudo -u bitcoin pip install -r /home/bitcoin/cl-plugins-available/plugins/${plugin}/requirements.txt sudo -u bitcoin pip install -r /home/bitcoin/cl-plugins-available/plugins/${plugin}/requirements.txt
$lightningcli_alias plugin start /home/bitcoin/cl-plugins-available/plugins/${plugin}/${plugin}.py $lightningcli_alias plugin start /home/bitcoin/cl-plugins-available/plugins/${plugin}/${plugin}.py

View file

@ -2,16 +2,20 @@
# https://lightning.readthedocs.io/ # https://lightning.readthedocs.io/
# https://github.com/ElementsProject/lightning/releases # https://github.com/ElementsProject/lightning/releases
CLVERSION=v22.11.1 CLVERSION=v23.02
# install the latest master by using the last commit id # install the latest master by using the last commit id
# https://github.com/ElementsProject/lightning/commit/master # https://github.com/ElementsProject/lightning/commit/master
# CLVERSION="063366ed7e3b7cc12a8d1681acc2b639cf07fa23" # CLVERSION="063366ed7e3b7cc12a8d1681acc2b639cf07fa23"
PGPsigner="endothermicdev"
PGPpubkeyLink="https://github.com/${PGPsigner}.gpg"
PGPpubkeyFingerprint="8F55EE750D950E3E"
# https://github.com/ElementsProject/lightning/tree/master/contrib/keys # https://github.com/ElementsProject/lightning/tree/master/contrib/keys
PGPsigner="cdecker" # rustyrussel D9200E6CD1ADB8F1 # cdecker A26D6D9FE088ED58 # niftynei BFF0F67810C1EED1 # PGPsigner="cdecker" # rustyrussel D9200E6CD1ADB8F1 # cdecker A26D6D9FE088ED58 # niftynei BFF0F67810C1EED1
PGPpubkeyLink="https://raw.githubusercontent.com/ElementsProject/lightning/master/contrib/keys/${PGPsigner}.txt" # PGPpubkeyLink="https://raw.githubusercontent.com/ElementsProject/lightning/master/contrib/keys/${PGPsigner}.txt"
PGPpubkeyFingerprint="A26D6D9FE088ED58" # PGPpubkeyFingerprint="A26D6D9FE088ED58"
# help # help
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
@ -30,8 +34,7 @@ if [ $# -eq 0 ]||[ "$1" = "-h" ]||[ "$1" = "--help" ];then
exit 1 exit 1
fi fi
function installDependencies() function installDependencies() {
{
echo "- installDependencies()" echo "- installDependencies()"
# from https://lightning.readthedocs.io/INSTALL.html#to-build-on-ubuntu # from https://lightning.readthedocs.io/INSTALL.html#to-build-on-ubuntu
sudo apt-get install -y \ sudo apt-get install -y \
@ -44,16 +47,15 @@ function installDependencies()
sudo pip3 install --upgrade pip sudo pip3 install --upgrade pip
sudo -u bitcoin pip install mako sudo -u bitcoin pip install mako
# poetry # poetry
sudo -u bitcoin pip3 install --user poetry sudo pip3 install poetry
if ! grep -Eq '^PATH="$HOME/.local/bin:$PATH"' /mnt/hdd/raspiblitz.conf; then if ! grep -Eq '^PATH="$HOME/.local/bin:$PATH"' /home/bitcoin/.profile; then
echo 'PATH="$HOME/.local/bin:$PATH"' | sudo tee -a /home/bitcoin/.profile echo 'PATH="$HOME/.local/bin:$PATH"' | sudo tee -a /home/bitcoin/.profile
fi fi
export PATH="home/bitcoin/.local/bin:$PATH" export PATH="home/bitcoin/.local/bin:$PATH"
sudo -u bitcoin /home/bitcoin/.local/bin/poetry install sudo -u bitcoin poetry install
} }
function buildAndInstallCLbinaries() function buildAndInstallCLbinaries() {
{
echo "- Configuring EXPERIMENTAL_FEATURES enabled" echo "- Configuring EXPERIMENTAL_FEATURES enabled"
echo echo
sudo -u bitcoin ./configure --enable-experimental-features sudo -u bitcoin ./configure --enable-experimental-features
@ -119,65 +121,6 @@ if [ "$1" = "install" ]; then
exit 1 exit 1
fi fi
## Download and verify zip
# # prepare download dir
# sudo rm -rf /home/bitcoin/download
# sudo -u bitcoin mkdir -p /home/bitcoin/download
# cd /home/bitcoin/download || exit 1
#
# sudo -u bitcoin wget -O "pgp_keys.asc" ${PGPpubkeyLink}
# sudo -u bitcoin gpg --import --import-options show-only ./pgp_keys.asc
# fingerprint=$(gpg "pgp_keys.asc" 2>/dev/null | grep "${PGPpubkeyFingerprint}" -c)
# if [ ${fingerprint} -lt 1 ]; then
# echo
# echo "# WARNING --> the PGP fingerprint is not as expected for ${PGPsigner}"
# echo "Should contain PGP: ${PGPpubkeyFingerprint}"
# echo "PRESS ENTER to TAKE THE RISK if you think all is OK"
# read key
# fi
# sudo -u bitcoin gpg --import ./pgp_keys.asc
#
# sudo -u bitcoin wget https://github.com/ElementsProject/lightning/releases/download/${CLVERSION}/SHA256SUMS
# sudo -u bitcoin wget https://github.com/ElementsProject/lightning/releases/download/${CLVERSION}/SHA256SUMS.asc
#
# verifyResult=$(LANG=en_US.utf8; sudo -u bitcoin gpg --verify SHA256SUMS.asc 2>&1)
#
# goodSignature=$(echo ${verifyResult} | grep 'Good signature' -c)
# echo "goodSignature(${goodSignature})"
# correctKey=$(echo ${verifyResult} | tr -d " \t\n\r" | grep "${PGPpubkeyFingerprint}" -c)
# echo "correctKey(${correctKey})"
# if [ ${correctKey} -lt 1 ] || [ ${goodSignature} -lt 1 ]; then
# echo
# echo "# DOWNLOAD FAILED --> PGP verification not OK / signature(${goodSignature}) verify(${correctKey})"
# exit 1
# else
# echo
# echo "****************************************************************"
# echo "OK --> the PGP signature of the Core Lightning SHA256SUMS is correct"
# echo "****************************************************************"
# echo
# fi
#
# sudo -u bitcoin wget https://github.com/ElementsProject/lightning/releases/download/${CLVERSION}/clightning-${CLVERSION}.zip
#
# hashCheckResult=$(sha256sum -c SHA256SUMS 2>&1)
# goodHash=$(echo ${hashCheckResult} | grep 'OK' -c)
# echo "goodHash(${goodHash})"
# if [ ${goodHash} -lt 1 ]; then
# echo
# echo "# BUILD FAILED --> Hash check not OK"
# exit 1
# else
# echo
# echo "********************************************************************"
# echo "OK --> the hash of the downloaded Core Lightning source code is correct"
# echo "********************************************************************"
# echo
# fi
#
# sudo -u bitcoin unzip clightning-${CLVERSION}.zip
# cd clightning-${CLVERSION} || exit 1
# download and verify the source from github # download and verify the source from github
cd /home/bitcoin || exit 1 cd /home/bitcoin || exit 1
echo echo
@ -284,8 +227,10 @@ if [ "$1" = on ]||[ "$1" = update ]||[ "$1" = testPR ];then
installDependencies installDependencies
currentCLversion=$(cd /home/bitcoin/lightning 2>/dev/null; \ currentCLversion=$(
git describe --tags 2>/dev/null) cd /home/bitcoin/lightning 2>/dev/null
git describe --tags 2>/dev/null
)
echo "# Building from source Core Lightning $currentCLversion" echo "# Building from source Core Lightning $currentCLversion"
buildAndInstallCLbinaries buildAndInstallCLbinaries
@ -296,7 +241,7 @@ if [ "$1" = on ]||[ "$1" = update ]||[ "$1" = testPR ];then
########## ##########
# make sure binary is installed (will skip if already done) # make sure binary is installed (will skip if already done)
/home/admin/config.scripts/cl.install.sh install /home/admin/config.scripts/cl.install.sh install || exit 1
echo "# Make sure bitcoin is in the ${TORGROUP} group" echo "# Make sure bitcoin is in the ${TORGROUP} group"
sudo usermod -a -G ${TORGROUP} bitcoin sudo usermod -a -G ${TORGROUP} bitcoin
@ -364,7 +309,9 @@ always-use-proxy=true
############# #############
echo echo
echo "# Set logrotate for ${netprefix}lightningd" echo "# Set logrotate for ${netprefix}lightningd"
if ! sudo ls /home/bitcoin/.lightning/${CLNETWORK}/cl.log_old; then
sudo -u bitcoin mkdir /home/bitcoin/.lightning/${CLNETWORK}/cl.log_old sudo -u bitcoin mkdir /home/bitcoin/.lightning/${CLNETWORK}/cl.log_old
fi
echo "\ echo "\
/home/bitcoin/.lightning/${CLNETWORK}/cl.log /home/bitcoin/.lightning/${CLNETWORK}/cl.log
{ {
@ -376,10 +323,6 @@ always-use-proxy=true
notifempty notifempty
nocompress nocompress
sharedscripts sharedscripts
# We don't need to kill as we use copytruncate
#postrotate
# kill -HUP \`cat /run/lightningd/lightningd.pid\'
#endscript
su bitcoin bitcoin su bitcoin bitcoin
}" | sudo tee /etc/logrotate.d/${netprefix}lightningd }" | sudo tee /etc/logrotate.d/${netprefix}lightningd
# debug: # debug:
@ -396,8 +339,7 @@ alias ${netprefix}cl=\"sudo -u bitcoin /usr/local/bin/lightning-cli\
--conf=${CLCONF}\" --conf=${CLCONF}\"
alias ${netprefix}cllog=\"sudo\ alias ${netprefix}cllog=\"sudo\
tail -n 30 -f /home/bitcoin/.lightning/${CLNETWORK}/cl.log\" tail -n 30 -f /home/bitcoin/.lightning/${CLNETWORK}/cl.log\"
alias ${netprefix}clconf=\"sudo\ alias ${netprefix}clconf=\"sudo nano ${CLCONF}\"
nano ${CLCONF}\"
" | sudo tee -a /home/admin/_aliases " | sudo tee -a /home/admin/_aliases
sudo chown admin:admin /home/admin/_aliases sudo chown admin:admin /home/admin/_aliases
fi fi
@ -466,8 +408,7 @@ if [ "$1" = "display-seed" ]; then
#echo "# seedwords6x4(${seedwords6x4})" #echo "# seedwords6x4(${seedwords6x4})"
if [ ${#seedwords6x4} -gt 0 ]; then if [ ${#seedwords6x4} -gt 0 ]; then
ack=0 ack=0
while [ ${ack} -eq 0 ] while [ ${ack} -eq 0 ]; do
do
whiptail --title "Core Lightning ${displayNetwork} Wallet" \ whiptail --title "Core Lightning ${displayNetwork} Wallet" \
--msgbox "This is your Core Lightning ${displayNetwork} wallet seed. Store these numbered words in a safe location:\n\n${seedwords6x4}" 13 76 --msgbox "This is your Core Lightning ${displayNetwork} wallet seed. Store these numbered words in a safe location:\n\n${seedwords6x4}" 13 76
whiptail --title "Please Confirm" --yes-button "Show Again" --no-button "CONTINUE" --yesno " Are you sure that you wrote down the word list?" 8 55 whiptail --title "Please Confirm" --yes-button "Show Again" --no-button "CONTINUE" --yesno " Are you sure that you wrote down the word list?" 8 55

View file

@ -1,18 +1,18 @@
#!/bin/bash #!/bin/bash
# https://github.com/Ride-The-Lightning/c-lightning-REST/releases/ # https://github.com/Ride-The-Lightning/c-lightning-REST/releases/
CLRESTVERSION="v0.9.0" CLRESTVERSION="v0.10.1"
# help # help
if [ $# -eq 0 ]||[ "$1" = "-h" ]||[ "$1" = "--help" ];then if [ $# -eq 0 ]||[ "$1" = "-h" ]||[ "$1" = "--help" ];then
echo
echo "Core-Lightning-REST install script" echo "Core-Lightning-REST install script"
echo "The default version is: $CLRESTVERSION" echo "The default version is: $CLRESTVERSION"
echo "mainnet | testnet | signet instances can run parallel" echo "mainnet | testnet | signet instances can run parallel"
echo echo
echo "Usage:" echo "Usage:"
echo "cl.rest.sh [on|off|connect] <mainnet|testnet|signet> [?key-value]" echo "cl.rest.sh on <mainnet|testnet|signet>"
echo echo "cl.rest.sh connect <mainnet|testnet|signet> [?key-value]"
echo "cl.rest.sh off <mainnet|testnet|signet> <purge>"
exit 1 exit 1
fi fi