From 819c7e72f679d445e22366f2eafb9f59c8ebcda8 Mon Sep 17 00:00:00 2001 From: openoms <43343391+openoms@users.noreply.github.com> Date: Sat, 8 Jul 2023 20:52:10 +0000 Subject: [PATCH] RTL, clrest update, fix update options for cli (#3880) * clrest update to v0.10.3, add update option * rtl update to v0.14.0 * c-lightning-rest update to v0.10.5 * add to CHANGES * fix lnd update (cli only) --- CHANGES.md | 2 + home.admin/config.scripts/bonus.rtl.sh | 10 ++--- home.admin/config.scripts/cl.rest.sh | 60 +++++++++++++++++++++++--- 3 files changed, 61 insertions(+), 11 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 213df5386..067a8de71 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -5,6 +5,8 @@ - Update: LND v0.16.4-beta [details](https://github.com/lightningnetwork/lnd/releases/tag/v0.16.4-beta) - Update: Core Lightning v23.05.2 [details](https://github.com/ElementsProject/lightning/releases/tag/v23.05.2) - Update: Electrum Server in Rust (electrs) v0.9.14 [details](https://github.com/romanz/electrs/blob/master/RELEASE-NOTES.md#0914-jun-10-2023) +- Update: C-lightningREST v0.10.5 [details](https://github.com/Ride-The-Lightning/c-lightning-REST/releases/tag/v0.10.5) +- Update: RTL v0.14.0 [details](https://github.com/Ride-The-Lightning/RTL/releases/tag/v0.14.0) - Update: Lightning Terminal v0.10.1-alpha [details](https://github.com/lightninglabs/lightning-terminal/releases/tag/v0.10.1-alpha) - Update: LNDg v1.7.0 [details](https://github.com/cryptosharks131/lndg) - Update: Thunderhub v0.13.19 [details](https://github.com/apotdevin/thunderhub/releases/tag/v0.13.19) diff --git a/home.admin/config.scripts/bonus.rtl.sh b/home.admin/config.scripts/bonus.rtl.sh index 76e7f490c..8d21ae756 100755 --- a/home.admin/config.scripts/bonus.rtl.sh +++ b/home.admin/config.scripts/bonus.rtl.sh @@ -1,7 +1,7 @@ #!/bin/bash # https://github.com/Ride-The-Lightning/RTL/releases -RTLVERSION="v0.13.6" +RTLVERSION="v0.14.0" # check and load raspiblitz config # to know which network is running @@ -574,16 +574,16 @@ if [ "$1" = "update" ]; then # unset $1 set -- UPSTREAM=${1:-'@{u}'} - LOCAL=$(git rev-parse @) - REMOTE=$(git rev-parse "$UPSTREAM") + LOCAL=$(sudo -u rtl git rev-parse @) + REMOTE=$(sudo -u rtl git rev-parse "$UPSTREAM") if [ $LOCAL = $REMOTE ]; then - TAG=$(git tag | sort -V | grep -v rc | tail -1) + TAG=$(sudo -u rtl git tag | sort -V | grep -v rc | tail -1) echo "# You are up-to-date on version" $TAG else echo "# Pulling latest changes..." sudo -u rtl git pull -p echo "# Reset to the latest release tag" - TAG=$(git tag | sort -V | grep -v rc | tail -1) + TAG=$(sudo -u rtl git tag | sort -V | grep -v rc | tail -1) sudo -u rtl git reset --hard $TAG echo "# updating to the latest" # https://github.com/Ride-The-Lightning/RTL#or-update-existing-dependencies diff --git a/home.admin/config.scripts/cl.rest.sh b/home.admin/config.scripts/cl.rest.sh index 2ce73aaf2..66a120f7d 100644 --- a/home.admin/config.scripts/cl.rest.sh +++ b/home.admin/config.scripts/cl.rest.sh @@ -1,7 +1,7 @@ #!/bin/bash # https://github.com/Ride-The-Lightning/c-lightning-REST/releases/ -CLRESTVERSION="v0.10.2" +CLRESTVERSION="v0.10.5" # help if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then @@ -13,6 +13,7 @@ if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then echo "cl.rest.sh on " echo "cl.rest.sh connect [?key-value]" echo "cl.rest.sh off " + echo "cl.rest.sh update " exit 1 fi @@ -41,7 +42,7 @@ if [ "$1" = connect ]; then /home/admin/config.scripts/tor.onion-service.sh ${netprefix}clrest 443 ${portprefix}6100 1>/dev/null toraddress=$(sudo cat /mnt/hdd/tor/${netprefix}clrest/hostname) - hex_macaroon=$(xxd -plain /home/bitcoin/c-lightning-REST/${CLNETWORK}/certs//access.macaroon | tr -d '\n') + hex_macaroon=$(xxd -plain /home/bitcoin/c-lightning-REST/${CLNETWORK}/certs/access.macaroon | tr -d '\n') url="https://${localip}:${portprefix}6100/" lndconnect="lndconnect://${toraddress}:443?macaroon=${hex_macaroon}" # c-lightning-rest://http://your_hidden_service.onion:your_port?&macaroon=your_macaroon_file_in_HEX&protocol=http @@ -147,10 +148,10 @@ if [ "$1" = on ]; then sudo -u bitcoin /home/admin/config.scripts/blitz.git-verify.sh \ "${PGPsigner}" "${PGPpubkeyLink}" "${PGPpubkeyFingerprint}" "${CLRESTVERSION}" || exit 1 + export NG_CLI_ANALYTICS=false sudo -u bitcoin npm install fi - # config cd /home/bitcoin/c-lightning-REST || exit 1 sudo -u bitcoin mkdir ${CLNETWORK} echo " @@ -205,8 +206,9 @@ WantedBy=multi-user.target fi echo echo "# Monitor with:" - echo "sudo journalctl -f -u clrest" + echo "sudo journalctl -fu clrest" echo + exit 0 fi if [ "$1" = off ]; then @@ -214,11 +216,57 @@ if [ "$1" = off ]; then sudo systemctl stop ${netprefix}clrest sudo systemctl disable ${netprefix}clrest sudo rm -rf /home/bitcoin/c-lightning-REST/${CLNETWORK} - echo "# Deny port ${portprefix}6100 through the firewall" - sudo ufw deny "${portprefix}6100" + echo "# Remove the firewall rule" + sudo ufw delete allow "${portprefix}6100" /home/admin/config.scripts/tor.onion-service.sh off ${netprefix}clrest if [ "$(echo "$@" | grep -c purge)" -gt 0 ]; then echo "# Removing the source code and binaries" sudo rm -rf /home/bitcoin/c-lightning-REST fi + exit 0 fi + +if [ "$1" = "update" ]; then + echo "# UPDATING c-lightning-REST for ${CHAIN}" + cd /home/bitcoin/c-lightning-REST/${CLNETWORK} || exit 1 + # fetch latest master + sudo -u bitcoin git fetch + # unset $1 + set -- + UPSTREAM=${1:-'@{u}'} + LOCAL=$(sudo -u bitcoin git rev-parse @) + REMOTE=$(sudo -u bitcoin git rev-parse "$UPSTREAM") + if [ "$LOCAL" = "$REMOTE" ]; then + TAG=$(sudo -u bitcoin git tag | sort -V | grep -v rc | tail -1) + echo "# You are up-to-date on version" "$TAG" + else + sudo systemctl stop ${netprefix}clrest + echo "# Pulling latest changes..." + sudo -u bitcoin git pull -p + echo "# Reset to the latest release tag" + TAG=$(sudo -u bitcoin git tag | sort -V | grep -v rc | tail -1) + sudo -u bitcoin git reset --hard "$TAG" + sudo -u bitcoin /home/admin/config.scripts/blitz.git-verify.sh \ + "${PGPsigner}" "${PGPpubkeyLink}" "${PGPpubkeyFingerprint}" "${TAG}" || exit 1 + echo "# Updating to the latest" + echo "# Running npm install ..." + export NG_CLI_ANALYTICS=false + if sudo -u bitcoin npm install; then + echo "# OK - c-lightning-REST install looks good" + echo + else + echo "# FAIL - npm install did not run correctly - deleting code and exit" + /home/admin/config.scripts/cl.rest.sh off "" purge + exit 1 + fi + echo "# Updated to version" "$TAG" + echo + echo "# Starting the ${netprefix}clrest service ..." + sudo systemctl start ${netprefix}clrest + echo + fi + exit 0 +fi + +echo "# FAIL - Unknown Parameter $1" +exit 1