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)
- 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: 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: 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: 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)

View file

@ -441,6 +441,7 @@ if [ "${clNode}" != "${choice}" ]; then
fi
# 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 on

View file

@ -94,7 +94,7 @@ case $CHOICE in
fi
cd /home/bitcoin/suez || exit 1
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 "Press ENTER to return to main menu."
read key

View file

@ -118,7 +118,7 @@ case $CHOICE in
/home/admin/config.scripts/bonus.suez.sh on
fi
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=--rpcserver=localhost:1${L2rpcportmod}009
echo

View file

@ -570,10 +570,10 @@ function suez() {
clear
echo "# Showing the channels of ${lightning} ${chain}net - consider reducing the font size (press CTRL- or CMD-)"
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}
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=--rpcserver=localhost:1${L2rpcportmod}009
fi

View file

@ -30,10 +30,9 @@ PGPsigner="$1"
PGPpubkeyLink="$2"
PGPpubkeyFingerprint="$3"
wget -O /var/cache/raspiblitz/pgp_keys_${PGPsigner}.asc "${PGPpubkeyLink}"
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
echo
echo "# WARNING --> the PGP fingerprint is not as expected for ${PGPsigner}" >&2
@ -65,7 +64,7 @@ echo
cat "$_temp"
echo "# goodSignature(${goodSignature})"
correctKey=$(tr -d " \t\n\r" < "$_temp" | grep "${PGPpubkeyFingerprint}" -c)
correctKey=$(tr -d " \t\n\r" <"$_temp" | grep "${PGPpubkeyFingerprint}" -c)
echo "# correctKey(${correctKey})"
if [ "${correctKey}" -lt 1 ] || [ "${goodSignature}" -lt 1 ]; then

View file

@ -1,7 +1,7 @@
#!/bin/bash
# https://github.com/Ride-The-Lightning/RTL/releases
RTLVERSION="v0.13.0"
RTLVERSION="v0.13.6"
# check and load raspiblitz config
# to know which network is running
@ -63,10 +63,10 @@ if [ "$1" = "status" ] || [ "$1" = "menu" ]; then
localip=$(hostname -I | awk '{print $1}')
toraddress=$(sudo cat /mnt/hdd/tor/${netprefix}${typeprefix}RTL/hostname 2>/dev/null)
fingerprint=$(openssl x509 -in /mnt/hdd/app-data/nginx/tls.cert -fingerprint -noout | cut -d"=" -f2)
RTLHTTPS=$((RTLHTTP+1))
RTLHTTPS=$((RTLHTTP + 1))
if [ "$1" = "status" ]; then
echo "version='${RTLVERSION}'"
echo "installed='${isInstalled}'"
echo "localIP='${localip}'"
@ -96,7 +96,7 @@ if [ "$1" = "menu" ]; then
sudo /home/admin/config.scripts/blitz.display.sh qr "${toraddress}"
whiptail --title "Ride The Lightning (RTL - $LNTYPE - $CHAIN)" --msgbox "Open in your local web browser:
http://${localip}:${RTLHTTP}\n
https://${localip}:$((RTLHTTP+1)) with Fingerprint:
https://${localip}:$((RTLHTTP + 1)) with Fingerprint:
${fingerprint}\n
Use your Password B to login.\n
Hidden Service address for Tor Browser (QRcode on LCD):\n${toraddress}
@ -107,7 +107,7 @@ Hidden Service address for Tor Browser (QRcode on LCD):\n${toraddress}
else
whiptail --title "Ride The Lightning (RTL - $LNTYPE - $CHAIN)" --msgbox "Open in your local web browser & accept self-signed cert:
http://${localip}:${RTLHTTP}\n
https://${localip}:$((RTLHTTP+1)) with Fingerprint:
https://${localip}:$((RTLHTTP + 1)) with Fingerprint:
${fingerprint}\n
Use your Password B to login.\n
Activate Tor to access the web interface from outside your local network.
@ -117,7 +117,6 @@ Activate Tor to access the web interface from outside your local network.
exit 0
fi
########################################
# INSTALL (just user, code & compile)
########################################
@ -125,7 +124,7 @@ fi
if [ "$1" = "install" ]; then
# check if already installed
if [ -f /home/rtl/RTL/LICENSE ];then
if [ -f /home/rtl/RTL/LICENSE ]; then
echo "# RTL already installed - skipping"
exit 0
fi
@ -136,7 +135,7 @@ if [ "$1" = "install" ]; then
/home/admin/config.scripts/bonus.nodejs.sh on
# create rtl user (one for all instances)
if [ $(compgen -u | grep -c rtl) -eq 0 ];then
if [ $(compgen -u | grep -c rtl) -eq 0 ]; then
sudo adduser --disabled-password --gecos "" rtl || exit 1
fi
@ -229,7 +228,7 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
fi
# make sure softwarte is installed
if [ -f /home/rtl/RTL/LICENSE ];then
if [ -f /home/rtl/RTL/LICENSE ]; then
echo "# OK - the RTL code is already present"
else
echo "# install of codebase is needed first"
@ -241,8 +240,8 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
echo "# Make sure symlink to central app-data directory exists"
if ! [[ -L "/home/rtl/.lnd" ]]; then
sudo rm -rf "/home/rtl/.lnd" 2>/dev/null # not a symlink.. delete it silently
sudo ln -s "/mnt/hdd/app-data/lnd/" "/home/rtl/.lnd" # and create symlink
sudo rm -rf "/home/rtl/.lnd" 2>/dev/null # not a symlink.. delete it silently
sudo ln -s "/mnt/hdd/app-data/lnd/" "/home/rtl/.lnd" # and create symlink
fi
if [ "${LNTYPE}" == "lnd" ]; then
@ -253,7 +252,7 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
echo "# Updating Firewall"
sudo ufw allow ${RTLHTTP} comment "${systemdService} HTTP"
sudo ufw allow $((RTLHTTP+1)) comment "${systemdService} HTTPS"
sudo ufw allow $((RTLHTTP + 1)) comment "${systemdService} HTTPS"
echo
# make sure config directory exists
@ -314,7 +313,7 @@ WantedBy=multi-user.target
# Hidden Service for RTL if Tor is active
if [ "${runBehindTor}" = "on" ]; then
# make sure to keep in sync with tor.network.sh script
/home/admin/config.scripts/tor.onion-service.sh ${netprefix}${typeprefix}RTL 80 $((RTLHTTP+2)) 443 $((RTLHTTP+3))
/home/admin/config.scripts/tor.onion-service.sh ${netprefix}${typeprefix}RTL 80 $((RTLHTTP + 2)) 443 $((RTLHTTP + 3))
fi
# nginx configuration
@ -323,11 +322,11 @@ WantedBy=multi-user.target
sudo cp /home/admin/assets/nginx/sites-available/rtl_tor.conf /etc/nginx/sites-available/${netprefix}${typeprefix}rtl_tor.conf
sudo cp /home/admin/assets/nginx/sites-available/rtl_tor_ssl.conf /etc/nginx/sites-available/${netprefix}${typeprefix}rtl_tor_ssl.conf
sudo sed -i "s/3000/$RTLHTTP/g" /etc/nginx/sites-available/${netprefix}${typeprefix}rtl_ssl.conf
sudo sed -i "s/3001/$((RTLHTTP+1))/g" /etc/nginx/sites-available/${netprefix}${typeprefix}rtl_ssl.conf
sudo sed -i "s/3001/$((RTLHTTP + 1))/g" /etc/nginx/sites-available/${netprefix}${typeprefix}rtl_ssl.conf
sudo sed -i "s/3000/$RTLHTTP/g" /etc/nginx/sites-available/${netprefix}${typeprefix}rtl_tor.conf
sudo sed -i "s/3002/$((RTLHTTP+2))/g" /etc/nginx/sites-available/${netprefix}${typeprefix}rtl_tor.conf
sudo sed -i "s/3002/$((RTLHTTP + 2))/g" /etc/nginx/sites-available/${netprefix}${typeprefix}rtl_tor.conf
sudo sed -i "s/3000/$RTLHTTP/g" /etc/nginx/sites-available/${netprefix}${typeprefix}rtl_tor_ssl.conf
sudo sed -i "s/3003/$((RTLHTTP+3))/g" /etc/nginx/sites-available/${netprefix}${typeprefix}rtl_tor_ssl.conf
sudo sed -i "s/3003/$((RTLHTTP + 3))/g" /etc/nginx/sites-available/${netprefix}${typeprefix}rtl_tor_ssl.conf
sudo ln -sf /etc/nginx/sites-available/${netprefix}${typeprefix}rtl_ssl.conf /etc/nginx/sites-enabled/
sudo ln -sf /etc/nginx/sites-available/${netprefix}${typeprefix}rtl_tor.conf /etc/nginx/sites-enabled/
sudo ln -sf /etc/nginx/sites-available/${netprefix}${typeprefix}rtl_tor_ssl.conf /etc/nginx/sites-enabled/
@ -345,7 +344,7 @@ WantedBy=multi-user.target
echo "# OK - the ${systemdService}.service is now enabled & started"
echo "# Monitor with: sudo journalctl -f -u ${systemdService}"
# needed for API/WebUI as signal that install ran thru
# needed for API/WebUI as signal that install ran thru
echo "result='OK'"
exit 0
fi
@ -379,8 +378,8 @@ if [ "$1" = "connect-services" ]; then
echo "# Add the rtl user to the lit group"
sudo /usr/sbin/usermod --append --groups lit rtl
echo "# Symlink the lit-loop.macaroon"
sudo rm -rf "/home/rtl/.loop" # delete symlink
sudo ln -s "/home/lit/.loop/" "/home/rtl/.loop" # create symlink
sudo rm -rf "/home/rtl/.loop" # delete symlink
sudo ln -s "/home/lit/.loop/" "/home/rtl/.loop" # create symlink
echo "# Make the loop macaroon group readable"
sudo chmod 640 /home/rtl/.loop/mainnet/macaroons.db
elif [ "${loop}" = "on" ]; then
@ -388,8 +387,8 @@ if [ "$1" = "connect-services" ]; then
echo "# Add the rtl user to the loop group"
sudo /usr/sbin/usermod --append --groups loop rtl
echo "# Symlink the loop.macaroon"
sudo rm -rf "/home/rtl/.loop" # delete symlink
sudo ln -s "/home/loop/.loop/" "/home/rtl/.loop" # create symlink
sudo rm -rf "/home/rtl/.loop" # delete symlink
sudo ln -s "/home/loop/.loop/" "/home/rtl/.loop" # create symlink
echo "# Make the loop macaroon group readable"
sudo chmod 640 /home/rtl/.loop/mainnet/macaroons.db
else
@ -428,14 +427,14 @@ if [ "$1" = "prestart" ]; then
# determine correct loop swap server port (lit over loop single)
if [ "${lit}" = "on" ]; then
echo "# use lit loop port"
SWAPSERVERPORT=8443
echo "# use lit loop port"
SWAPSERVERPORT=8443
elif [ "${loop}" = "on" ]; then
echo "# use loop single instance port"
SWAPSERVERPORT=8081
echo "# use loop single instance port"
SWAPSERVERPORT=8081
else
echo "# No lit or loop single detected"
SWAPSERVERPORT=""
echo "# No lit or loop single detected"
SWAPSERVERPORT=""
fi
# prepare RTL-Config.json file
@ -455,20 +454,20 @@ if [ "$1" = "prestart" ]; then
# LND changes of config
if [ "${LNTYPE}" == "lnd" ]; then
echo "# LND Config"
cat /mnt/hdd/app-data/rtl/${systemdService}/RTL-Config.json | \
jq ".port = \"${RTLHTTP}\"" | \
jq ".multiPass = \"${RPCPASSWORD}\"" | \
jq ".multiPassHashed = \"\"" | \
jq ".nodes[0].lnNode = \"${hostname}\"" | \
jq ".nodes[0].lnImplementation = \"LND\"" | \
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.swapMacaroonPath = \"/home/rtl/.loop/${CHAIN}/\"" | \
jq ".nodes[0].Authentication.boltzMacaroonPath = \"/home/rtl/.boltz-lnd/macaroons/\"" | \
jq ".nodes[0].Settings.userPersona = \"OPERATOR\"" | \
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.swapServerUrl = \"https://127.0.0.1:${SWAPSERVERPORT}\"" > /mnt/hdd/app-data/rtl/${systemdService}/RTL-Config.json.tmp
cat /mnt/hdd/app-data/rtl/${systemdService}/RTL-Config.json |
jq ".port = \"${RTLHTTP}\"" |
jq ".multiPass = \"${RPCPASSWORD}\"" |
jq ".multiPassHashed = \"\"" |
jq ".nodes[0].lnNode = \"${hostname}\"" |
jq ".nodes[0].lnImplementation = \"LND\"" |
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.swapMacaroonPath = \"/home/rtl/.loop/${CHAIN}/\"" |
jq ".nodes[0].Authentication.boltzMacaroonPath = \"/home/rtl/.boltz-lnd/macaroons/\"" |
jq ".nodes[0].Settings.userPersona = \"OPERATOR\"" |
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.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
fi
@ -476,20 +475,20 @@ if [ "$1" = "prestart" ]; then
# https://github.com/Ride-The-Lightning/RTL/blob/master/docs/C-Lightning-setup.md
if [ "${LNTYPE}" == "cl" ]; then
echo "# CL Config"
cat /mnt/hdd/app-data/rtl/${systemdService}/RTL-Config.json | \
jq ".port = \"${RTLHTTP}\"" | \
jq ".multiPass = \"${RPCPASSWORD}\"" | \
jq ".multiPassHashed = \"\"" | \
jq ".nodes[0].lnNode = \"${hostname}\"" | \
jq ".nodes[0].lnImplementation = \"CLT\"" | \
jq ".nodes[0].Authentication.macaroonPath = \"/home/bitcoin/c-lightning-REST/${CLNETWORK}/certs\"" | \
jq ".nodes[0].Authentication.configPath = \"${CLCONF}\"" | \
jq ".nodes[0].Authentication.swapMacaroonPath = \"/home/rtl/.loop/${CHAIN}/\"" | \
jq ".nodes[0].Authentication.boltzMacaroonPath = \"/home/rtl/.boltz-lnd/macaroons/\"" | \
jq ".nodes[0].Settings.userPersona = \"OPERATOR\"" | \
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.swapServerUrl = \"https://127.0.0.1:${SWAPSERVERPORT}\"" > /mnt/hdd/app-data/rtl/${systemdService}/RTL-Config.json.tmp
cat /mnt/hdd/app-data/rtl/${systemdService}/RTL-Config.json |
jq ".port = \"${RTLHTTP}\"" |
jq ".multiPass = \"${RPCPASSWORD}\"" |
jq ".multiPassHashed = \"\"" |
jq ".nodes[0].lnNode = \"${hostname}\"" |
jq ".nodes[0].lnImplementation = \"CLT\"" |
jq ".nodes[0].Authentication.macaroonPath = \"/home/bitcoin/c-lightning-REST/${CLNETWORK}/certs\"" |
jq ".nodes[0].Authentication.configPath = \"${CLCONF}\"" |
jq ".nodes[0].Authentication.swapMacaroonPath = \"/home/rtl/.loop/${CHAIN}/\"" |
jq ".nodes[0].Authentication.boltzMacaroonPath = \"/home/rtl/.boltz-lnd/macaroons/\"" |
jq ".nodes[0].Settings.userPersona = \"OPERATOR\"" |
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.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
fi
@ -546,9 +545,9 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then
fi
# only if 'purge' is an additional parameter (other instances/services might need this)
if [ "$(echo "$@" | grep -c purge)" -gt 0 ];then
if [ "$(echo "$@" | grep -c purge)" -gt 0 ]; then
home/admin/config.scripts/bonus.rtl.sh uninstall
if [ $LNTYPE = cl ];then
if [ $LNTYPE = cl ]; then
/home/admin/config.scripts/cl.rest.sh off ${CHAIN}
fi
echo "# Delete all configs"
@ -557,14 +556,13 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then
# close ports on firewall
sudo ufw deny "${RTLHTTP}"
sudo ufw deny $((RTLHTTP+1))
sudo ufw deny $((RTLHTTP + 1))
# needed for API/WebUI as signal that install ran thru
# needed for API/WebUI as signal that install ran thru
echo "result='OK'"
exit 0
fi
if [ "$1" = "update" ]; then
echo "# UPDATING RTL"
cd /home/rtl/RTL || exit 1
@ -616,7 +614,10 @@ if [ "$1" = "update" ]; then
echo "# OK - RTL install looks good"
echo
fi
currentRTLcommit=$(cd /home/rtl/RTL; git describe --tags)
currentRTLcommit=$(
cd /home/rtl/RTL
git describe --tags
)
echo "# Updated RTL to $currentRTLcommit"
else
echo "# Unknown option: $updateOption"

View file

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

View file

@ -1,6 +1,6 @@
#!/bin/bash
function help(){
function help() {
echo
echo "Install the backup plugin for Core Lightning"
echo "Replicates the lightningd.sqlite3 database on the SDcard"
@ -16,11 +16,10 @@ function help(){
}
# https://github.com/lightningd/plugins/commits/master/backup
# use the version beore the migration to poetry
pinnedVersion="4d3560b129b12cba0381fff0b1e30ac32ef84106"
pinnedVersion="30003279e35e5931fc85d7e6211ea4de6f9554d7"
# command info
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ];then
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
help
fi
@ -38,25 +37,32 @@ function install() {
sudo -u bitcoin git pull
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"
sudo -u bitcoin pip install --user -r ${plugindir}/${plugin}/requirements.txt 1>/dev/null
if [ $(echo $PATH | grep -c "/home/bitcoin/.local/bin") -eq 0 ];then
export PATH=$PATH:/home/bitcoin/.local/bin
echo "PATH=\$PATH:/home/bitcoin/.local/bin" | sudo tee -a /etc/profile
fi
# upgrade pip
sudo pip3 install --upgrade pip
# pip dependencies
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
# 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 \
/home/bitcoin/${netprefix}cl-plugins-enabled/
/home/bitcoin/${netprefix}cl-plugins-enabled/
fi
else
echo "# The ${plugin} plugin is already loaded"
fi
}
if [ "$1" = on ];then
if [ "$1" = on ]; then
install
@ -64,27 +70,30 @@ if [ "$1" = on ];then
sudo systemctl stop ${netprefix}lightningd
# don't overwrite old backup
if [ -f /home/bitcoin/${netprefix}lightningd.sqlite3.backup ];then
if [ -f /home/bitcoin/${netprefix}lightningd.sqlite3.backup ]; then
echo "# Backup the existing old backup on the SDcard"
now=$(date +"%Y_%m_%d_%H%M%S")
sudo mv /home/bitcoin/${netprefix}lightningd.sqlite3.backup \
/home/bitcoin/${netprefix}lightningd.sqlite3.backup.${now} || exit 1
/home/bitcoin/${netprefix}lightningd.sqlite3.backup.${now} || exit 1
fi
# 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
fi
# https://github.com/lightningd/plugins/tree/master/backup#setup
echo "# Initialize the backup plugin"
sudo -u bitcoin ${plugindir}/backup/backup-cli init\
--lightning-dir /home/bitcoin/.lightning/${CLNETWORK} \
file:///home/bitcoin/${netprefix}lightningd.sqlite3.backup
cd ${plugindir}/backup/ || exit 1
sudo -u bitcoin poetry run ./backup-cli init --lightning-dir /home/bitcoin/.lightning/${CLNETWORK} \
file:///home/bitcoin/${netprefix}lightningd.sqlite3.backup
if [ $(crontab -u admin -l | grep -c "backup-compact $CHAIN") -eq 0 ]; then
echo "Add weekly backup-compact as a cronjob"
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
echo "# The crontab for admin now is:"
crontab -u admin -l
@ -96,19 +105,21 @@ if [ "$1" = on ];then
echo "# Started the ${netprefix}lightningd.service"
fi
elif [ "$1" = off ]; then
elif
[ "$1" = off ]
then
echo "# Removing the backup plugin"
sudo rm -f /home/bitcoin/${netprefix}cl-plugins-enabled/backup.py
echo "# Backup the existing old backup on the SDcard"
now=$(date +"%Y_%m_%d_%H%M%S")
sudo mv /home/bitcoin/${netprefix}lightningd.sqlite3.backup \
/home/bitcoin/${netprefix}lightningd.sqlite3.backup.${now}
/home/bitcoin/${netprefix}lightningd.sqlite3.backup.${now}
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 [ "$1" = restore ];then
elif
[ "$1" = restore ]
then
install
@ -118,21 +129,22 @@ elif [ "$1" = restore ];then
sudo systemctl stop ${netprefix}lightningd
# 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
if sudo ls /home/bitcoin/.lightning/${CLNETWORK}/lightningd.sqlite3;then
if sudo ls /home/bitcoin/.lightning/${CLNETWORK}/lightningd.sqlite3; then
now=$(date +"%Y_%m_%d_%H%M%S")
echo "# Backup the existing old database on the disk"
sudo cp /home/bitcoin/.lightning/${CLNETWORK}/lightningd.sqlite3 \
/home/bitcoin/.lightning/${CLNETWORK}/lightningd.sqlite3.backup.${now} || exit 1
if [ "$(echo "$@" | grep -c "force")" -gt 0 ];then
/home/bitcoin/.lightning/${CLNETWORK}/lightningd.sqlite3.backup.${now} || exit 1
if [ "$(echo "$@" | grep -c "force")" -gt 0 ]; then
sudo rm /home/bitcoin/.lightning/${CLNETWORK}/lightningd.sqlite3
fi
fi
# 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 \
/home/bitcoin/.lightning/${CLNETWORK}/lightningd.sqlite3
@ -143,8 +155,9 @@ elif [ "$1" = restore ];then
fi
fi
elif [ "$1" = backup-compact ];then
elif
[ "$1" = backup-compact ]
then
# https://github.com/lightningd/plugins/tree/master/backup#performing-backup-compaction
dbPath="/home/bitcoin/.lightning/${CLNETWORK}/lightningd.sqlite3"
backupPath="/home/bitcoin/${netprefix}lightningd.sqlite3.backup"
@ -154,7 +167,7 @@ elif [ "$1" = backup-compact ];then
echo "$dbSize MB $dbPath"
backupSize=$(sudo du -m "${backupPath}" | awk '{print $1}')
echo "$backupSize MB $backupPath"
if [ "$backupSize" -gt $((dbSize+200)) ] ; then
if [ "$backupSize" -gt $((dbSize + 200)) ]; then
echo "# The backup is 200MB+ larger than the db, running '${netprefix}lightning-cli backup-compact' ..."
$lightningcli_alias backup-compact
else

View file

@ -1,7 +1,7 @@
#!/bin/bash
# command info
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ];then
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
echo
echo "Install the cln-grpc plugin for CLN"
echo "Usage:"
@ -31,10 +31,12 @@ function buildGRPCplugin() {
echo "# - Build the cln-grpc plugin"
if [ ! -f /home/bitcoin/cl-plugins-available/cln-grpc ]; then
# check if the source code is present
if [ ! -d /home/bitcoin/lightning/plugins/grpc-plugin ];then
if [ ! -d /home/bitcoin/lightning/plugins/grpc-plugin ]; then
echo "# - install Core Lightning ..."
/home/admin/config.scripts/cl.install.sh install || exit 1
fi
echo "# install dependencies"
sudo apt-get install protobuf-compiler -y
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
cd /home/bitcoin/lightning/plugins/grpc-plugin || exit 1
@ -61,7 +63,7 @@ function switchOn() {
# symlink to plugin directory
echo "# symlink cln-grpc to /home/bitcoin/${netprefix}cl-plugins-enabled/"
# 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/
# blitz.conf.sh set [key] [value] [?conffile] <noquotes>
@ -102,7 +104,7 @@ elif [ "$1" = on ]; then
elif [ "$1" = off ]; then
sed -i "/^grpc-port/d" "${CLCONF}"
sudo rm -rf /home/bitcoin/${netprefix}cl-plugins-enabled/cln-grpc
if [ "$(echo "$@" | grep -c purge)" -gt 0 ];then
if [ "$(echo "$@" | grep -c purge)" -gt 0 ]; then
sudo rm -rf /home/bitcoin/cl-plugins-available/cln-grpc
fi
/home/admin/config.scripts/blitz.conf.sh set "${netprefix}clnGRPCport" "off"
@ -113,7 +115,7 @@ elif [ "$1" = off ]; then
exit 0
elif [ "$1" = update ]; then
if [ "$(echo "$@" | grep -c source)" -gt 0 ];then
if [ "$(echo "$@" | grep -c source)" -gt 0 ]; then
cd /home/bitcoin/lightning/ || exit 1
sudo -u bitcoin git pull
fi

View file

@ -1,7 +1,7 @@
#!/bin/bash
# command info
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ];then
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
echo
echo "Install and show the output of the chosen plugin for Core Lightning"
echo "Usage:"
@ -16,7 +16,7 @@ if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ];then
exit 1
fi
if [ "$1" = "on" ];then
if [ "$1" = "on" ]; then
source <(/home/admin/config.scripts/network.aliases.sh getvars cl $3)
@ -29,27 +29,27 @@ if [ "$1" = "on" ];then
fi
# enable
if [ "$(echo "$@" | grep -c "persist")" -gt 0 ];then
if [ ! -L /home/bitcoin/${netprefix}cl-plugins-enabled/${plugin}.py ];then
if [ "$(echo "$@" | grep -c "persist")" -gt 0 ]; then
if [ ! -L /home/bitcoin/${netprefix}cl-plugins-enabled/${plugin}.py ]; then
echo "# Symlink to /home/bitcoin/${netprefix}cl-plugins-enabled"
sudo ln -s /home/bitcoin/cl-plugins-available/plugins/${plugin}/${plugin}.py \
/home/bitcoin/${netprefix}cl-plugins-enabled
/home/bitcoin/${netprefix}cl-plugins-enabled
source <(/home/admin/_cache.sh get state)
if [ "${state}" == "ready" ]; then
echo "# Restart the ${netprefix}lightningd.service to activate the ${plugin} plugin"
sudo systemctl restart ${netprefix}lightningd
fi
fi
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"
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
fi
fi
echo
echo "Node URI:"
ln_getinfo=$($lightningcli_alias -H getinfo 2>/dev/null)
@ -60,12 +60,12 @@ if [ "$1" = "on" ];then
echo
echo "# Running:"
echo "${netprefix}lightning-cli ${plugin}"
echo
echo
$lightningcli_alias ${plugin}
echo
if [ "$(echo "$@" | grep -c "runonce")" -gt 0 ];then
if [ "$(echo "$@" | grep -c "runonce")" -gt 0 ]; then
$lightningcli_alias plugin stop /home/bitcoin/cl-plugins-available/plugins/${plugin}/${plugin}.py
fi
fi
fi

View file

@ -2,19 +2,23 @@
# https://lightning.readthedocs.io/
# https://github.com/ElementsProject/lightning/releases
CLVERSION=v22.11.1
CLVERSION=v23.02
# install the latest master by using the last commit id
# https://github.com/ElementsProject/lightning/commit/master
# CLVERSION="063366ed7e3b7cc12a8d1681acc2b639cf07fa23"
PGPsigner="endothermicdev"
PGPpubkeyLink="https://github.com/${PGPsigner}.gpg"
PGPpubkeyFingerprint="8F55EE750D950E3E"
# https://github.com/ElementsProject/lightning/tree/master/contrib/keys
PGPsigner="cdecker" # rustyrussel D9200E6CD1ADB8F1 # cdecker A26D6D9FE088ED58 # niftynei BFF0F67810C1EED1
PGPpubkeyLink="https://raw.githubusercontent.com/ElementsProject/lightning/master/contrib/keys/${PGPsigner}.txt"
PGPpubkeyFingerprint="A26D6D9FE088ED58"
# PGPsigner="cdecker" # rustyrussel D9200E6CD1ADB8F1 # cdecker A26D6D9FE088ED58 # niftynei BFF0F67810C1EED1
# PGPpubkeyLink="https://raw.githubusercontent.com/ElementsProject/lightning/master/contrib/keys/${PGPsigner}.txt"
# PGPpubkeyFingerprint="A26D6D9FE088ED58"
# help
if [ $# -eq 0 ]||[ "$1" = "-h" ]||[ "$1" = "--help" ];then
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
echo
echo "Core Lightning install script"
echo "The default version is: ${CLVERSION}"
@ -30,30 +34,28 @@ if [ $# -eq 0 ]||[ "$1" = "-h" ]||[ "$1" = "--help" ];then
exit 1
fi
function installDependencies()
{
function installDependencies() {
echo "- installDependencies()"
# from https://lightning.readthedocs.io/INSTALL.html#to-build-on-ubuntu
sudo apt-get install -y \
autoconf automake build-essential git libtool libgmp-dev \
libsqlite3-dev python3 net-tools zlib1g-dev libsodium-dev \
gettext
autoconf automake build-essential git libtool libgmp-dev \
libsqlite3-dev python3 net-tools zlib1g-dev libsodium-dev \
gettext
# additional requirements
sudo apt-get install -y postgresql libpq-dev
# upgrade pip
sudo pip3 install --upgrade pip
sudo -u bitcoin pip install mako
# poetry
sudo -u bitcoin pip3 install --user poetry
if ! grep -Eq '^PATH="$HOME/.local/bin:$PATH"' /mnt/hdd/raspiblitz.conf; then
sudo pip3 install poetry
if ! grep -Eq '^PATH="$HOME/.local/bin:$PATH"' /home/bitcoin/.profile; then
echo 'PATH="$HOME/.local/bin:$PATH"' | sudo tee -a /home/bitcoin/.profile
fi
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
sudo -u bitcoin ./configure --enable-experimental-features
@ -74,7 +76,7 @@ echo "# Running: 'cl.install.sh $*'"
if [ "$1" = "update" ] && [ $# -gt 1 ]; then
CLVERSION=$2
if curl --output /dev/null --silent --head --fail \
https://github.com/ElementsProject/lightning/releases/tag/${CLVERSION};then
https://github.com/ElementsProject/lightning/releases/tag/${CLVERSION}; then
echo "# OK version exists at https://github.com/ElementsProject/lightning/releases/tag/${CLVERSION}"
else
echo "# ${CLVERSION} does not exist"
@ -86,15 +88,15 @@ fi
# check for PR if testPR
if [ "$1" = "testPR" ]; then
if [ $# -gt 1 ]; then
PRnumber=$2
else
echo "# Need PRnumber as the second paramater"
fi
echo "# Using the PR:"
echo "# https://github.com/ElementsProject/lightning/pull/${PRnumber}"
if [ $# -gt 1 ]; then
PRnumber=$2
else
echo "# Need PRnumber as the second paramater"
fi
echo "# Using the PR:"
echo "# https://github.com/ElementsProject/lightning/pull/${PRnumber}"
if curl --output /dev/null --silent --head --fail \
https://github.com/ElementsProject/lightning/pull/${PRnumber};then
https://github.com/ElementsProject/lightning/pull/${PRnumber}; then
echo "# OK the PR exists at https://github.com/ElementsProject/lightning/pull/${PRnumber}"
echo "# Press ENTER to proceed to install Core Lightning with the PR ${PRnumber} or CTRL+C to abort."
read key
@ -119,65 +121,6 @@ if [ "$1" = "install" ]; then
exit 1
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
cd /home/bitcoin || exit 1
echo
@ -190,7 +133,7 @@ if [ "$1" = "install" ]; then
sudo -u bitcoin git reset --hard ${CLVERSION}
sudo -u bitcoin /home/admin/config.scripts/blitz.git-verify.sh \
"${PGPsigner}" "${PGPpubkeyLink}" "${PGPpubkeyFingerprint}" "${CLVERSION}" || exit 1
"${PGPsigner}" "${PGPpubkeyLink}" "${PGPpubkeyFingerprint}" "${CLVERSION}" || exit 1
installDependencies
@ -220,7 +163,7 @@ source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
TORGROUP="debian-tor"
if [ "$1" = update ]||[ "$1" = testPR ];then
if [ "$1" = update ] || [ "$1" = testPR ]; then
source <(/home/admin/config.scripts/network.aliases.sh getvars cl mainnet)
else
source <(/home/admin/config.scripts/network.aliases.sh getvars cl $2)
@ -228,7 +171,7 @@ fi
echo "# Using the settings for: ${network} ${CHAIN}"
if [ "$1" = on ]||[ "$1" = update ]||[ "$1" = testPR ];then
if [ "$1" = on ] || [ "$1" = update ] || [ "$1" = testPR ]; then
if [ "${CHAIN}" == "testnet" ] && [ "${testnet}" != "on" ]; then
echo "# before activating testnet on cl, first activate testnet on bitcoind"
@ -242,14 +185,14 @@ if [ "$1" = on ]||[ "$1" = update ]||[ "$1" = testPR ];then
exit 1
fi
if [ "$1" = "update" ]||[ "$1" = "testPR" ];then
if [ "$1" = "update" ] || [ "$1" = "testPR" ]; then
echo "# apt update"
echo
sudo apt-get update
cd /home/bitcoin || exit 1
if [ "$1" = "update" ]||[ "$1" = "testPR" ];then
if [ "$1" = "update" ] || [ "$1" = "testPR" ]; then
echo
echo "# Deleting the old source code"
sudo rm -rf lightning
@ -262,7 +205,7 @@ if [ "$1" = on ]||[ "$1" = update ]||[ "$1" = testPR ];then
echo
if [ "$1" = "update" ]; then
if [ $# -gt 1 ];then
if [ $# -gt 1 ]; then
CLVERSION=$2
echo "# Installing the version ${CLVERSION}"
sudo -u bitcoin git reset --hard ${CLVERSION}
@ -284,8 +227,10 @@ if [ "$1" = on ]||[ "$1" = update ]||[ "$1" = testPR ];then
installDependencies
currentCLversion=$(cd /home/bitcoin/lightning 2>/dev/null; \
git describe --tags 2>/dev/null)
currentCLversion=$(
cd /home/bitcoin/lightning 2>/dev/null
git describe --tags 2>/dev/null
)
echo "# Building from source Core Lightning $currentCLversion"
buildAndInstallCLbinaries
@ -296,7 +241,7 @@ if [ "$1" = on ]||[ "$1" = update ]||[ "$1" = testPR ];then
##########
# 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"
sudo usermod -a -G ${TORGROUP} bitcoin
@ -313,11 +258,11 @@ if [ "$1" = on ]||[ "$1" = update ]||[ "$1" = testPR ];then
sudo mkdir -p /mnt/hdd/app-data/.lightning
sudo ln -s /mnt/hdd/app-data/.lightning /home/bitcoin/
if [ ${CLNETWORK} != "bitcoin" ] && [ ! -d /home/bitcoin/.lightning/${CLNETWORK} ] ;then
if [ ${CLNETWORK} != "bitcoin" ] && [ ! -d /home/bitcoin/.lightning/${CLNETWORK} ]; then
sudo -u bitcoin mkdir /home/bitcoin/.lightning/${CLNETWORK}
fi
if ! sudo ls ${CLCONF};then
if ! sudo ls ${CLCONF}; then
echo "# Create ${CLCONF}"
echo "# lightningd configuration for ${network} ${CHAIN}
@ -364,7 +309,9 @@ always-use-proxy=true
#############
echo
echo "# Set logrotate for ${netprefix}lightningd"
sudo -u bitcoin mkdir /home/bitcoin/.lightning/${CLNETWORK}/cl.log_old
if ! sudo ls /home/bitcoin/.lightning/${CLNETWORK}/cl.log_old; then
sudo -u bitcoin mkdir /home/bitcoin/.lightning/${CLNETWORK}/cl.log_old
fi
echo "\
/home/bitcoin/.lightning/${CLNETWORK}/cl.log
{
@ -376,10 +323,6 @@ always-use-proxy=true
notifempty
nocompress
sharedscripts
# We don't need to kill as we use copytruncate
#postrotate
# kill -HUP \`cat /run/lightningd/lightningd.pid\'
#endscript
su bitcoin bitcoin
}" | sudo tee /etc/logrotate.d/${netprefix}lightningd
# debug:
@ -396,8 +339,7 @@ alias ${netprefix}cl=\"sudo -u bitcoin /usr/local/bin/lightning-cli\
--conf=${CLCONF}\"
alias ${netprefix}cllog=\"sudo\
tail -n 30 -f /home/bitcoin/.lightning/${CLNETWORK}/cl.log\"
alias ${netprefix}clconf=\"sudo\
nano ${CLCONF}\"
alias ${netprefix}clconf=\"sudo nano ${CLCONF}\"
" | sudo tee -a /home/admin/_aliases
sudo chown admin:admin /home/admin/_aliases
fi
@ -418,16 +360,16 @@ alias ${netprefix}clconf=\"sudo\
# setting values in the raspiblitz.conf
/home/admin/config.scripts/blitz.conf.sh set ${netprefix}cl on
# blitz.conf.sh needs sudo access - cannot be run in cl.check.sh
if [ ! -f /home/bitcoin/${netprefix}cl-plugins-enabled/sparko ];then
if [ ! -f /home/bitcoin/${netprefix}cl-plugins-enabled/sparko ]; then
/home/admin/config.scripts/blitz.conf.sh set ${netprefix}sparko "off"
fi
if [ ! -f /home/bitcoin/cl-plugins-enabled/c-lightning-http-plugin ];then
if [ ! -f /home/bitcoin/cl-plugins-enabled/c-lightning-http-plugin ]; then
/home/admin/config.scripts/blitz.conf.sh set clHTTPplugin "off"
fi
if [ ! -f /home/bitcoin/${netprefix}cl-plugins-enabled/feeadjuster.py ]; then
/home/admin/config.scripts/blitz.conf.sh set ${netprefix}feeadjuster "off"
fi
if [ ! -f /home/bitcoin/${netprefix}cl-plugins-enabled/cln-grpc ];then
if [ ! -f /home/bitcoin/${netprefix}cl-plugins-enabled/cln-grpc ]; then
/home/admin/config.scripts/blitz.conf.sh set "${netprefix}clnGRPCport" "off"
fi
@ -464,10 +406,9 @@ if [ "$1" = "display-seed" ]; then
source ${seedwordFile}
#echo "# seedwords(${seedwords})"
#echo "# seedwords6x4(${seedwords6x4})"
if [ ${#seedwords6x4} -gt 0 ];then
if [ ${#seedwords6x4} -gt 0 ]; then
ack=0
while [ ${ack} -eq 0 ]
do
while [ ${ack} -eq 0 ]; do
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
whiptail --title "Please Confirm" --yes-button "Show Again" --no-button "CONTINUE" --yesno " Are you sure that you wrote down the word list?" 8 55
@ -477,9 +418,9 @@ if [ "$1" = "display-seed" ]; then
done
else
dialog \
--title "Core Lightning ${displayNetwork} Wallet" \
--exit-label "exit" \
--textbox "${seedwordFile}" 14 92
--title "Core Lightning ${displayNetwork} Wallet" \
--exit-label "exit" \
--textbox "${seedwordFile}" 14 92
fi
else
# hsmFile="/home/bitcoin/.lightning/${CLNETWORK}/hsm_secret"
@ -489,14 +430,14 @@ if [ "$1" = "display-seed" ]; then
exit 0
fi
if [ "$1" = "off" ];then
if [ "$1" = "off" ]; then
echo "# Removing the ${netprefix}lightningd.service"
sudo systemctl disable ${netprefix}lightningd
sudo systemctl stop ${netprefix}lightningd
echo "# Removing the aliases"
sudo sed -i "/${netprefix}lightning-cli/d" /home/admin/_aliases
sudo sed -i "/${netprefix}cl/d" /home/admin/_aliases
if [ "$(echo "$@" | grep -c purge)" -gt 0 ];then
if [ "$(echo "$@" | grep -c purge)" -gt 0 ]; then
echo "# Removing the binaries"
sudo rm -f /usr/local/bin/lightningd
sudo rm -f /usr/local/bin/lightning-cli

View file

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