From 48f4054a9cc8f08284d11dd6b10bcdd816fa68c4 Mon Sep 17 00:00:00 2001 From: openoms <43343391+openoms@users.noreply.github.com> Date: Fri, 7 Apr 2023 14:35:11 +0200 Subject: [PATCH] RTL install fix (#3739) * c-lightning-REST update to 0.10.2, fmt * rtl: npm insatll with --legacy-peer-deps * purge c-lightning-REST as well with RTL --- CHANGES.md | 2 +- home.admin/config.scripts/bonus.rtl.sh | 18 +-- home.admin/config.scripts/cl.rest.sh | 148 ++++++++++++------------- 3 files changed, 84 insertions(+), 84 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 1030af0b9..86164b139 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -14,7 +14,7 @@ - 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.16.0-beta [details](https://github.com/lightningnetwork/lnd/releases/tag/v0.16.0-beta) - 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: C-lightningREST v0.10.2 [details](https://github.com/Ride-The-Lightning/c-lightning-REST/releases/tag/v0.10.2) - 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.6-alpha [details](https://github.com/lightninglabs/lightning-terminal/releases/tag/v0.8.6-alpha) - Update: RTL v0.13.6 with update option [details](https://github.com/Ride-The-Lightning/RTL/releases/tag/v0.13.6) diff --git a/home.admin/config.scripts/bonus.rtl.sh b/home.admin/config.scripts/bonus.rtl.sh index b898d6098..76e7f490c 100755 --- a/home.admin/config.scripts/bonus.rtl.sh +++ b/home.admin/config.scripts/bonus.rtl.sh @@ -162,7 +162,7 @@ if [ "$1" = "install" ]; then # install echo "# Running npm install ..." export NG_CLI_ANALYTICS=false - sudo -u rtl npm install --omit=dev + sudo -u rtl npm install --omit=dev --legacy-peer-deps if ! [ $? -eq 0 ]; then echo "# FAIL - npm install did not run correctly - deleting code and exit" sudo rm -r /home/rtl/RTL @@ -251,7 +251,7 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then fi echo "# Updating Firewall" - sudo ufw allow ${RTLHTTP} comment "${systemdService} HTTP" + sudo ufw allow "${RTLHTTP}" comment "${systemdService} HTTP" sudo ufw allow $((RTLHTTP + 1)) comment "${systemdService} HTTPS" echo @@ -546,17 +546,17 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then # only if 'purge' is an additional parameter (other instances/services might need this) if [ "$(echo "$@" | grep -c purge)" -gt 0 ]; then - home/admin/config.scripts/bonus.rtl.sh uninstall + /home/admin/config.scripts/bonus.rtl.sh uninstall if [ $LNTYPE = cl ]; then - /home/admin/config.scripts/cl.rest.sh off ${CHAIN} + /home/admin/config.scripts/cl.rest.sh off ${CHAIN} purge fi echo "# Delete all configs" sudo rm -rf /mnt/hdd/app-data/rtl fi # close ports on firewall - sudo ufw deny "${RTLHTTP}" - sudo ufw deny $((RTLHTTP + 1)) + sudo ufw delete allow "${RTLHTTP}" + sudo ufw delete allow $((RTLHTTP + 1)) # needed for API/WebUI as signal that install ran thru echo "result='OK'" @@ -589,7 +589,7 @@ if [ "$1" = "update" ]; then # https://github.com/Ride-The-Lightning/RTL#or-update-existing-dependencies echo "# Running npm install ..." export NG_CLI_ANALYTICS=false - sudo -u rtl npm install --omit=dev + sudo -u rtl npm install --omit=dev --legacy-peer-deps if ! [ $? -eq 0 ]; then echo "# FAIL - npm install did not run correctly - deleting code and exit" sudo rm -r /home/rtl/RTL @@ -605,7 +605,7 @@ if [ "$1" = "update" ]; then sudo -u rtl git pull -p echo "# Running npm install ..." export NG_CLI_ANALYTICS=false - sudo -u rtl npm install --only=prod --logLevel warn + sudo -u rtl npm install --omit=dev --legacy-peer-deps if ! [ $? -eq 0 ]; then echo "# FAIL - npm install did not run correctly - deleting code and exit" sudo rm -r /home/rtl/RTL @@ -615,7 +615,7 @@ if [ "$1" = "update" ]; then echo fi currentRTLcommit=$( - cd /home/rtl/RTL + cd /home/rtl/RTL || exit 1 git describe --tags ) echo "# Updated RTL to $currentRTLcommit" diff --git a/home.admin/config.scripts/cl.rest.sh b/home.admin/config.scripts/cl.rest.sh index cb2c3f1ce..2ce73aaf2 100644 --- a/home.admin/config.scripts/cl.rest.sh +++ b/home.admin/config.scripts/cl.rest.sh @@ -1,10 +1,10 @@ #!/bin/bash # https://github.com/Ride-The-Lightning/c-lightning-REST/releases/ -CLRESTVERSION="v0.10.1" +CLRESTVERSION="v0.10.2" # help -if [ $# -eq 0 ]||[ "$1" = "-h" ]||[ "$1" = "--help" ];then +if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then echo "Core-Lightning-REST install script" echo "The default version is: $CLRESTVERSION" echo "mainnet | testnet | signet instances can run parallel" @@ -29,7 +29,7 @@ source <(/home/admin/config.scripts/network.aliases.sh getvars cl $2) echo "# Running 'cl.rest.sh $*'" -if [ "$1" = connect ];then +if [ "$1" = connect ]; then if ! systemctl is-active --quiet ${netprefix}clrest; then /home/admin/config.scripts/cl.rest.sh on ${CHAIN} fi @@ -58,74 +58,74 @@ if [ "$1" = connect ];then # deactivated function showStepByStepQR() { - clear - echo - sudo /home/admin/config.scripts/blitz.display.sh qr "${toraddress}" - echo "The Tor address is shown as a QRcode below and on the LCD" - echo "Scan it to your phone with a QR scanner app and paste it to: 'Host'" - echo - echo "Host: ${toraddress}" - echo "REST Port: 443" - echo - qrencode -t ANSIUTF8 "${toraddress}" - echo - echo - echo "Alternatively to connect through the LAN the address is:" - echo "https://${localip}" - echo "REST Port: ${portprefix}6100" - echo - echo "# Press enter to continue to show the Macaroon" - read key - sudo /home/admin/config.scripts/blitz.display.sh hide - sudo /home/admin/config.scripts/blitz.display.sh qr "${hex_macaroon}" - clear - echo - echo "The Macaroon is shown as a QRcode below and on the LCD" - echo "Scan it to your phone with a QR scanner app and paste it to: 'Macaroon (Hex format)'" - echo - echo "Macaroon: ${hex_macaroon}" - echo - qrencode -t ANSIUTF8 "${hex_macaroon}" - echo - echo "# Press enter to hide the QRcode from the LCD" - read key - sudo /home/admin/config.scripts/blitz.display.sh hide - exit 0 + clear + echo + sudo /home/admin/config.scripts/blitz.display.sh qr "${toraddress}" + echo "The Tor address is shown as a QRcode below and on the LCD" + echo "Scan it to your phone with a QR scanner app and paste it to: 'Host'" + echo + echo "Host: ${toraddress}" + echo "REST Port: 443" + echo + qrencode -t ANSIUTF8 "${toraddress}" + echo + echo + echo "Alternatively to connect through the LAN the address is:" + echo "https://${localip}" + echo "REST Port: ${portprefix}6100" + echo + echo "# Press enter to continue to show the Macaroon" + read key + sudo /home/admin/config.scripts/blitz.display.sh hide + sudo /home/admin/config.scripts/blitz.display.sh qr "${hex_macaroon}" + clear + echo + echo "The Macaroon is shown as a QRcode below and on the LCD" + echo "Scan it to your phone with a QR scanner app and paste it to: 'Macaroon (Hex format)'" + echo + echo "Macaroon: ${hex_macaroon}" + echo + qrencode -t ANSIUTF8 "${hex_macaroon}" + echo + echo "# Press enter to hide the QRcode from the LCD" + read key + sudo /home/admin/config.scripts/blitz.display.sh hide + exit 0 } function showClRestQr() { - # c-lightning-rest://http://your_hidden_service.onion:your_port?&macaroon=your_macaroon_file_in_HEX&protocol=http - clear - echo - sudo /home/admin/config.scripts/blitz.display.sh qr "${clresttor}" - echo "The string to connect over Tor is shown as a QRcode below and on the LCD" - echo "Scan it to Zeus using the c-lightning-REST option" - echo - echo "c-lightning-REST connection string:" - echo "${clresttor}" - echo - qrencode -t ANSIUTF8 "${clresttor}" - echo - echo "# Press enter to show the string to connect over LAN" - read key - sudo /home/admin/config.scripts/blitz.display.sh hide - sudo /home/admin/config.scripts/blitz.display.sh qr "${clrestlan}" - clear - echo - echo "The string to connect over the local the network is shown as a QRcode below and on the LCD" - echo "Scan it to Zeus using the c-lightning-REST option" - echo "This will only work if your node si connected to the same network" - echo "To connect reemotely consider using a VPN like ZeroTier or Tailscale" - echo - echo "c-lightning-REST connection string:" - echo "${clrestlan}" - echo - qrencode -t ANSIUTF8 "${clrestlan}" - echo - echo "# Press enter to hide the QRcode from the LCD" - read key - sudo /home/admin/config.scripts/blitz.display.sh hide - exit 0 + # c-lightning-rest://http://your_hidden_service.onion:your_port?&macaroon=your_macaroon_file_in_HEX&protocol=http + clear + echo + sudo /home/admin/config.scripts/blitz.display.sh qr "${clresttor}" + echo "The string to connect over Tor is shown as a QRcode below and on the LCD" + echo "Scan it to Zeus using the c-lightning-REST option" + echo + echo "c-lightning-REST connection string:" + echo "${clresttor}" + echo + qrencode -t ANSIUTF8 "${clresttor}" + echo + echo "# Press enter to show the string to connect over LAN" + read key + sudo /home/admin/config.scripts/blitz.display.sh hide + sudo /home/admin/config.scripts/blitz.display.sh qr "${clrestlan}" + clear + echo + echo "The string to connect over the local the network is shown as a QRcode below and on the LCD" + echo "Scan it to Zeus using the c-lightning-REST option" + echo "This will only work if your node si connected to the same network" + echo "To connect reemotely consider using a VPN like ZeroTier or Tailscale" + echo + echo "c-lightning-REST connection string:" + echo "${clrestlan}" + echo + qrencode -t ANSIUTF8 "${clrestlan}" + echo + echo "# Press enter to hide the QRcode from the LCD" + read key + sudo /home/admin/config.scripts/blitz.display.sh hide + exit 0 } showClRestQr @@ -138,14 +138,14 @@ if [ "$1" = on ]; then sudo systemctl stop ${netprefix}clrest sudo systemctl disable ${netprefix}clrest - if [ ! -f /home/bitcoin/c-lightning-REST/cl-rest.js ];then + if [ ! -f /home/bitcoin/c-lightning-REST/cl-rest.js ]; then cd /home/bitcoin || exit 1 sudo -u bitcoin git clone https://github.com/saubyk/c-lightning-REST cd c-lightning-REST || exit 1 sudo -u bitcoin git reset --hard $CLRESTVERSION sudo -u bitcoin /home/admin/config.scripts/blitz.git-verify.sh \ - "${PGPsigner}" "${PGPpubkeyLink}" "${PGPpubkeyFingerprint}" "${CLRESTVERSION}" || exit 1 + "${PGPsigner}" "${PGPpubkeyLink}" "${PGPpubkeyFingerprint}" "${CLRESTVERSION}" || exit 1 sudo -u bitcoin npm install fi @@ -163,10 +163,10 @@ if [ "$1" = on ]; then \"RPCCOMMANDS\": [\"*\"] }" | sudo -u bitcoin tee ./${CLNETWORK}/cl-rest-config.json - # copy clrest to a CLNETWORK subdor to make parallel networks possible + # copy clrest to a CLNETWORK subdir to make parallel networks possible sudo -u bitcoin mkdir /home/bitcoin/c-lightning-REST/${CLNETWORK} sudo -u bitcoin cp -r /home/bitcoin/c-lightning-REST/* \ - /home/bitcoin/c-lightning-REST/${CLNETWORK} + /home/bitcoin/c-lightning-REST/${CLNETWORK} echo " # systemd unit for c-lightning-REST for ${CHAIN} @@ -209,7 +209,7 @@ WantedBy=multi-user.target echo fi -if [ "$1" = off ];then +if [ "$1" = off ]; then echo "# Removing c-lightning-REST for ${CHAIN}" sudo systemctl stop ${netprefix}clrest sudo systemctl disable ${netprefix}clrest @@ -217,7 +217,7 @@ if [ "$1" = off ];then echo "# Deny port ${portprefix}6100 through the firewall" sudo ufw deny "${portprefix}6100" /home/admin/config.scripts/tor.onion-service.sh off ${netprefix}clrest - if [ "$(echo "$@" | grep -c purge)" -gt 0 ];then + if [ "$(echo "$@" | grep -c purge)" -gt 0 ]; then echo "# Removing the source code and binaries" sudo rm -rf /home/bitcoin/c-lightning-REST fi