add menu options for parallel testnet

This commit is contained in:
openoms 2021-05-22 11:30:56 +01:00
parent 1d2cd60c38
commit 42ed268056
No known key found for this signature in database
GPG Key ID: 5BFB77609B081B65
5 changed files with 473 additions and 19 deletions

199
home.admin/00chainMenu.sh Normal file
View File

@ -0,0 +1,199 @@
#!/bin/bash
# Usage:
# 00chainMenu.sh <testnet|mainnets|ignet> <lnd|cln>
source /home/admin/raspiblitz.info
# add default value to raspi config if needed
if ! grep -Eq "^testnet=" /mnt/hdd/raspiblitz.conf; then
echo "testnet=off" >> /mnt/hdd/raspiblitz.conf
fi
if ! grep -Eq "^LNdefault=" /mnt/hdd/raspiblitz.conf; then
echo "LNdefault=lnd" >> /mnt/hdd/raspiblitz.conf
fi
source /mnt/hdd/raspiblitz.conf
# CHAIN is signet | testnet | mainnet
if [ $# -gt 0 ] && [ $1 != ${chain}net ];then
nonDefaultChain=1
CHAIN=$1
else
nonDefaultChain=0
CHAIN=${chain}net
fi
# prefix for parallel services
if [ ${CHAIN} = testnet ];then
chainprefix="t"
portprefix=1
elif [ ${CHAIN} = signet ];then
chainprefix="s"
portprefix=3
elif [ ${CHAIN} = mainnet ];then
chainprefix=""
portprefix=""
fi
# LNTYPE is lnd | cln
if [ $# -gt 1 ]&&[ $2 != $LNdefault ];then
nonDefaultLNtype=1
LNTYPE=$2
else
nonDefaultLNtype=0
LNTYPE=$LNdefault
fi
if [ ${LNTYPE} != lnd ]&&[ ${LNTYPE} != cln ];then
echo "# ${LNTYPE} is not a supported LNTYPE"
exit 1
fi
# get the local network IP to be displayed on the LCD
source <(/home/admin/config.scripts/internet.sh status local)
# BASIC MENU INFO
HEIGHT=10
WIDTH=64
CHOICE_HEIGHT=3
BACKTITLE="${CHAIN} options"
TITLE=""
MENU="Choose one of the following options:"
OPTIONS=()
plus=""
if [ "${runBehindTor}" = "on" ]; then
plus=" / TOR"
fi
if [ ${#dynDomain} -gt 0 ]; then
plus="${plus} / ${dynDomain}"
fi
BACKTITLE="${localip} / ${hostname} / ${network} / ${chain}${plus}"
# Put Activated Apps on top
if [ "${chainprefix}rtlWebinterface}" == "on" ]; then
OPTIONS+=(RTL "RTL Web Node Manager for LND ${CHAIN}")
HEIGHT=$((HEIGHT+1))
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
fi
if [ "${chainprefix}lnd" == "on" ]; then
#TODO OPTIONS+=(LND "LND options for ${CHAIN}")
HEIGHT=$((HEIGHT+1))
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
fi
if [ "${chainprefix}crtlWebinterface}" == "on" ]; then
OPTIONS+=(cRTL "RTL Web Node Manager for C-lightning ${CHAIN}")
HEIGHT=$((HEIGHT+1))
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
fi
if [ "${chainprefix}cln" == "on" ]; then
#TODO OPTIONS+=(CLN "C-lightning options for ${CHAIN}")
HEIGHT=$((HEIGHT+1))
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
fi
OPTIONS+=(INFO "RaspiBlitz Status Screen for ${CHAIN}")
if [ "$testnet" == "on" ]; then
OPTIONS+=(SERVICES "Additional Apps & Services on testnet")
HEIGHT=$((HEIGHT+1))
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
fi
#TODO OPTIONS+=(SYSTEM "Monitoring & Configuration")
#TODO OPTIONS+=(CONNECT "Connect Apps & Show Credentials")
if [ $nonDefaultLNtype = 1 ];then
OPTIONS+=(SWITCHLN "Make ${LNTYPE} the default lightning wallet")
HEIGHT=$((HEIGHT+1))
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
fi
if [ $nonDefaultChain = 1 ];then
OPTIONS+=(MKDEFAULT "Make ${CHAIN} the default chain")
HEIGHT=$((HEIGHT+1))
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
fi
CHOICE=$(dialog --clear \
--backtitle "$BACKTITLE" \
--title "$TITLE" \
--ok-label "Select" \
--cancel-label "Back" \
--menu "$MENU" \
$HEIGHT $WIDTH $CHOICE_HEIGHT \
"${OPTIONS[@]}" \
2>&1 >/dev/tty)
case $CHOICE in
INFO)
# #TODO
# echo "Gathering Information (please wait) ..."
# walletLocked=$(lncli getinfo 2>&1 | grep -c "Wallet is encrypted")
# if [ ${walletLocked} -eq 0 ]; then
# while :
# do
# # show the same info as on LCD screen
# /home/admin/00infoBlitz.sh
# # wait 6 seconds for user exiting loop
# echo ""
# echo -en "Screen is updating in a loop .... press 'x' now to get back to menu."
# read -n 1 -t 6 keyPressed
# echo -en "\rGathering information to update info ... please wait. \n"
# # check if user wants to abort session
# if [ "${keyPressed}" = "x" ]; then
# echo ""
# echo "Returning to menu ....."
# sleep 4
# break
# fi
# done
# else
# /home/admin/00raspiblitz.sh
# exit 0
# fi
/home/admin/00infoBlitz.sh $CHAIN
;;
RTL)
/home/admin/config.scripts/bonus.rtl.sh menu lnd $CHAIN
;;
cRTL)
/home/admin/config.scripts/bonus.rtl.sh menu cln $CHAIN
;;
LND)
/home/admin/99lightningMenu.sh $CHAIN
# TODO
;;
CLN)
/home/admin/99CLNmenu.sh $CHAIN
# TODO
;;
SERVICES)
/home/admin/00testnetServices.sh $CHAIN
# TODO
;;
SYSTEM)
/home/admin/99systemMenu.sh $CHAIN
# TODO
;;
CONNECT)
/home/admin/99connectMenu.sh $CHAIN
# TODO
;;
SWITCHLN)
# setting value in raspi blitz config
sudo sed -i "s/^LNdefault=.*/LNdefault=$LNTYPE/g" /mnt/hdd/raspiblitz.conf
echo "# OK - Set LNdefault=$LNTYPE in /mnt/hdd/raspiblitz.conf"
echo
echo "Press ENTER to return to main menu."
;;
MKDEFAULT)
# setting value in raspi blitz config
newchain=${CHAIN::-3}
sudo sed -i "s/^chain=.*/chain=${newchain}/g" /mnt/hdd/raspiblitz.conf
echo "# OK - Set chain=${newchain} in /mnt/hdd/raspiblitz.conf"
echo
echo "Press ENTER to return to main menu."
read key
;;
esac

View File

@ -14,6 +14,24 @@ color_gray='\033[0;37m'
source /home/admin/raspiblitz.info 2>/dev/null
source /mnt/hdd/raspiblitz.conf 2>/dev/null
if [ $# -gt 0 ];then
CHAIN=$1
chain=${CHAIN::-3}
fi
if [ ${chain} = test ];then
L1rpcportmod=1
L2rpcportmod=1
elif [ ${chain} = sig ];then
L1rpcportmod=3
L2rpcportmod=3
elif [ ${chain} = main ];then
L1rpcportmod=""
L2rpcportmod=0
fi
shopt -s expand_aliases
alias lnclialias="sudo -u bitcoin /usr/local/bin/lncli -n=${chain}net --rpcserver localhost:1${L2rpcportmod}009"
alias bitcoin-cli="/usr/local/bin/${network}-cli -rpcport=${L1rpcportmod}8332"
## get HDD/SSD info
source <(sudo /home/admin/config.scripts/blitz.datadrive.sh status)
hdd="${hddUsedInfo}"
@ -88,16 +106,16 @@ else
fi
# Bitcoin blockchain
btc_path=$(command -v ${network}-cli)
btc_path=$(command -v bitcoin-cli)
blockInfo="-"
if [ -n ${btc_path} ]; then
if [ -n "${btc_path}" ]; then
btc_title=$network
blockchaininfo="$(${network}-cli -datadir=${bitcoin_dir} getblockchaininfo 2>/dev/null)"
blockchaininfo="$(bitcoin-cli -datadir=${bitcoin_dir} getblockchaininfo 2>/dev/null)"
if [ ${#blockchaininfo} -gt 0 ]; then
btc_title="${btc_title} (${chain}net)"
# get sync status
block_chain="$(${network}-cli -datadir=${bitcoin_dir} getblockcount 2>/dev/null)"
block_chain="$(bitcoin-cli -datadir=${bitcoin_dir} getblockcount 2>/dev/null)"
block_verified="$(echo "${blockchaininfo}" | jq -r '.blocks')"
block_diff=$(expr ${block_chain} - ${block_verified})
blockInfo="${block_verified}/${block_chain}"
@ -124,13 +142,13 @@ if [ -n ${btc_path} ]; then
fi
# get last known block
last_block="$(${network}-cli -datadir=${bitcoin_dir} getblockcount 2>/dev/null)"
last_block="$(bitcoin-cli -datadir=${bitcoin_dir} getblockcount 2>/dev/null)"
if [ ! -z "${last_block}" ]; then
btc_line2="${btc_line2} ${color_gray}(block ${last_block})"
fi
# get mem pool transactions
mempool="$(${network}-cli -datadir=${bitcoin_dir} getmempoolinfo 2>/dev/null | jq -r '.size')"
mempool="$(bitcoin-cli -datadir=${bitcoin_dir} getmempoolinfo 2>/dev/null | jq -r '.size')"
else
btc_line2="${color_red}NOT RUNNING\t\t"
@ -138,7 +156,7 @@ if [ -n ${btc_path} ]; then
fi
# get IP address & port
networkInfo=$(${network}-cli -datadir=${bitcoin_dir} getnetworkinfo 2>/dev/null)
networkInfo=$(bitcoin-cli -datadir=${bitcoin_dir} getnetworkinfo 2>/dev/null)
local_ip="${localip}" # from internet.sh
public_ip="${cleanip}"
public_port="$(echo ${networkInfo} | jq -r '.localaddresses [0] .port')"
@ -162,9 +180,9 @@ public_addr_pre="Public "
public_addr="??"
torInfo=""
# Version
networkVersion=$(${network}-cli -datadir=${bitcoin_dir} -version 2>/dev/null | cut -d ' ' -f6)
networkVersion=$(bitcoin-cli -datadir=${bitcoin_dir} -version 2>/dev/null | cut -d ' ' -f6)
# TOR or IP
networkInfo=$(${network}-cli -datadir=${bitcoin_dir} getnetworkinfo)
networkInfo=$(bitcoin-cli -datadir=${bitcoin_dir} getnetworkinfo)
networkConnections=$(echo ${networkInfo} | jq -r '.connections')
networkConnectionsInfo="${color_green}${networkConnections} ${color_gray}connections"
@ -238,7 +256,7 @@ if [ "$wallet_unlocked" -gt 0 ] ; then
alias_color="${color_red}"
ln_alias="Wallet Locked"
else
ln_getInfo=$(sudo -u bitcoin /usr/local/bin/lncli --macaroonpath=${lnd_macaroon_dir}/readonly.macaroon --tlscertpath=${lnd_dir}/tls.cert getinfo 2>/dev/null)
ln_getInfo=$(lnclialias --macaroonpath=${lnd_macaroon_dir}/readonly.macaroon --tlscertpath=${lnd_dir}/tls.cert getinfo 2>/dev/null)
ln_external=$(echo "${ln_getInfo}" | grep "uris" -A 1 | tr -d '\n' | cut -d '"' -f4)
ln_tor=$(echo "${ln_external}" | grep -c ".onion")
if [ ${ln_tor} -eq 1 ]; then
@ -262,23 +280,23 @@ else
ln_baseInfo="${color_amber} Waiting for Chain Sync"
fi
else
ln_walletbalance="$(sudo -u bitcoin /usr/local/bin/lncli --macaroonpath=${lnd_macaroon_dir}/readonly.macaroon --tlscertpath=${lnd_dir}/tls.cert walletbalance | jq -r '.confirmed_balance')" 2>/dev/null
ln_walletbalance_wait="$(sudo -u bitcoin /usr/local/bin/lncli --macaroonpath=${lnd_macaroon_dir}/readonly.macaroon --tlscertpath=${lnd_dir}/tls.cert walletbalance | jq -r '.unconfirmed_balance')" 2>/dev/null
ln_walletbalance="$(lnclialias --macaroonpath=${lnd_macaroon_dir}/readonly.macaroon --tlscertpath=${lnd_dir}/tls.cert walletbalance | jq -r '.confirmed_balance')" 2>/dev/null
ln_walletbalance_wait="$(lnclialias --macaroonpath=${lnd_macaroon_dir}/readonly.macaroon --tlscertpath=${lnd_dir}/tls.cert walletbalance | jq -r '.unconfirmed_balance')" 2>/dev/null
if [ "${ln_walletbalance_wait}" = "0" ]; then ln_walletbalance_wait=""; fi
if [ ${#ln_walletbalance_wait} -gt 0 ]; then ln_walletbalance_wait="(+${ln_walletbalance_wait})"; fi
ln_channelbalance="$(sudo -u bitcoin /usr/local/bin/lncli --macaroonpath=${lnd_macaroon_dir}/readonly.macaroon --tlscertpath=${lnd_dir}/tls.cert channelbalance | jq -r '.balance')" 2>/dev/null
ln_channelbalance_pending="$(sudo -u bitcoin /usr/local/bin/lncli --macaroonpath=${lnd_macaroon_dir}/readonly.macaroon --tlscertpath=${lnd_dir}/tls.cert channelbalance | jq -r '.pending_open_balance')" 2>/dev/null
ln_channelbalance="$(lnclialias --macaroonpath=${lnd_macaroon_dir}/readonly.macaroon --tlscertpath=${lnd_dir}/tls.cert channelbalance | jq -r '.balance')" 2>/dev/null
ln_channelbalance_pending="$(lnclialias --macaroonpath=${lnd_macaroon_dir}/readonly.macaroon --tlscertpath=${lnd_dir}/tls.cert channelbalance | jq -r '.pending_open_balance')" 2>/dev/null
if [ "${ln_channelbalance_pending}" = "0" ]; then ln_channelbalance_pending=""; fi
if [ ${#ln_channelbalance_pending} -gt 0 ]; then ln_channelbalance_pending=" (+${ln_channelbalance_pending})"; fi
ln_channels_online="$(echo "${ln_getInfo}" | jq -r '.num_active_channels')" 2>/dev/null
ln_channels_total="$(sudo -u bitcoin /usr/local/bin/lncli --macaroonpath=${lnd_macaroon_dir}/readonly.macaroon --tlscertpath=${lnd_dir}/tls.cert listchannels | jq '.[] | length')" 2>/dev/null
ln_channels_total="$(lnclialias --macaroonpath=${lnd_macaroon_dir}/readonly.macaroon --tlscertpath=${lnd_dir}/tls.cert listchannels | jq '.[] | length')" 2>/dev/null
ln_baseInfo="${color_gray}wallet ${ln_walletbalance} sat ${ln_walletbalance_wait}"
ln_peers="$(echo "${ln_getInfo}" | jq -r '.num_peers')" 2>/dev/null
ln_channelInfo="${ln_channels_online}/${ln_channels_total} Channels ${ln_channelbalance} sat${ln_channelbalance_pending}"
ln_peersInfo="${color_green}${ln_peers} ${color_gray}peers"
ln_dailyfees="$(sudo -u bitcoin /usr/local/bin/lncli --macaroonpath=${lnd_macaroon_dir}/readonly.macaroon --tlscertpath=${lnd_dir}/tls.cert feereport | jq -r '.day_fee_sum')" 2>/dev/null
ln_weeklyfees="$(sudo -u bitcoin /usr/local/bin/lncli --macaroonpath=${lnd_macaroon_dir}/readonly.macaroon --tlscertpath=${lnd_dir}/tls.cert feereport | jq -r '.week_fee_sum')" 2>/dev/null
ln_monthlyfees="$(sudo -u bitcoin /usr/local/bin/lncli --macaroonpath=${lnd_macaroon_dir}/readonly.macaroon --tlscertpath=${lnd_dir}/tls.cert feereport | jq -r '.month_fee_sum')" 2>/dev/null
ln_dailyfees="$(lnclialias --macaroonpath=${lnd_macaroon_dir}/readonly.macaroon --tlscertpath=${lnd_dir}/tls.cert feereport | jq -r '.day_fee_sum')" 2>/dev/null
ln_weeklyfees="$(lnclialias --macaroonpath=${lnd_macaroon_dir}/readonly.macaroon --tlscertpath=${lnd_dir}/tls.cert feereport | jq -r '.week_fee_sum')" 2>/dev/null
ln_monthlyfees="$(lnclialias --macaroonpath=${lnd_macaroon_dir}/readonly.macaroon --tlscertpath=${lnd_dir}/tls.cert feereport | jq -r '.month_fee_sum')" 2>/dev/null
ln_feeReport="Fee Report (D-W-M): ${color_green}${ln_dailyfees}-${ln_weeklyfees}-${ln_monthlyfees} ${color_gray}sat"
fi
fi

View File

@ -163,6 +163,12 @@ if [ "${circuitbreaker}" == "on" ]; then
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
fi
if [ "${testnet}" == "on" ]; then
OPTIONS+=(TESTNET "Testnet Service Options")
HEIGHT=$((HEIGHT+1))
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
fi
# Basic Options
OPTIONS+=(INFO "RaspiBlitz Status Screen")
OPTIONS+=(LIGHTNING "LND Wallet Options")
@ -298,6 +304,9 @@ case $CHOICE in
;;
CIRCUIT)
sudo /home/admin/config.scripts/bonus.circuitbreaker.sh menu
;;
TESTNET)
/home/admin/00chainMenu.sh testnet
;;
SUBSCRIBE)
/home/admin/config.scripts/blitz.subscriptions.py

View File

@ -22,6 +22,8 @@ if [ ${#sphinxrelay} -eq 0 ]; then sphinxrelay="off"; fi
if [ ${#lit} -eq 0 ]; then lit="off"; fi
if [ ${#whitepaper} -eq 0 ]; then whitepaper="off"; fi
if [ ${#chantools} -eq 0 ]; then chantools="off"; fi
if [ ${#testnet} -eq 0 ]; then testnet="off"; fi
if [ ${#cln} -eq 0 ]; then cln="off"; fi
# show select dialog
echo "run dialog ..."
@ -42,10 +44,12 @@ OPTIONS+=(x 'Sphinx-Relay' ${sphinxrelay})
OPTIONS+=(y 'PyBLOCK' ${pyblock})
OPTIONS+=(c 'ChannelTools (Fund Rescue)' ${chantools})
OPTIONS+=(w 'Download Bitcoin Whitepaper' ${whitepaper})
OPTIONS+=(n 'Parallel Testnet services' ${testnet})
OPTIONS+=(c 'C-lightning' ${cln})
CHOICES=$(dialog --title ' Additional Services ' \
--checklist ' use spacebar to activate/de-activate ' \
22 45 15 "${OPTIONS[@]}" 2>&1 >/dev/tty)
24 45 17 "${OPTIONS[@]}" 2>&1 >/dev/tty)
dialogcancel=$?
echo "done dialog"
@ -431,6 +435,56 @@ else
echo "Whitepaper setting unchanged."
fi
# testnet process choice
choice="off"; check=$(echo "${CHOICES}" | grep -c "n")
if [ ${check} -eq 1 ]; then choice="on"; fi
if [ "${testnet}" != "${choice}" ]; then
echo "# Testnet Setting changed .."
anychange=1
/home/admin/config.scripts/cln.install.sh ${choice} testnet
errorOnInstall=$?
if [ "${choice}" = "on" ]; then
if [ ${errorOnInstall} -eq 0 ]; then
echo "# Successfully installed Testnet"
echo
echo "# Press ENTER to continue ..."
read key
else
l1="# !!! FAIL on Testnet install !!!"
l2="# Try manual install on terminal after reboot with:"
l3="/home/admin/config.scripts/network.bitcoinchains.sh on testnet"
dialog --title 'FAIL' --msgbox "${l1}\n${l2}\n${l3}" 7 65
fi
fi
else
echo "# Testnet Setting unchanged."
fi
# cln process choice
choice="off"; check=$(echo "${CHOICES}" | grep -c "c")
if [ ${check} -eq 1 ]; then choice="on"; fi
if [ "${cln}" != "${choice}" ]; then
echo "# C-lightning Setting changed .."
anychange=1
/home/admin/config.scripts/cln.install.sh ${choice}
errorOnInstall=$?
if [ "${choice}" = "on" ]; then
if [ ${errorOnInstall} -eq 0 ]; then
echo "# Successfully installed C-lightning"
echo
echo "# Press ENTER to continue ..."
read key
else
l1="# !!! FAIL on C-lightning install !!!"
l2="# Try manual install on terminal after reboot with:"
l3="/home/admin/config.scripts/cln.install.sh on"
dialog --title 'FAIL' --msgbox "${l1}\n${l2}\n${l3}" 7 65
fi
fi
else
echo "# C-lightning Setting unchanged."
fi
if [ ${anychange} -eq 0 ]; then
dialog --msgbox "NOTHING CHANGED!\nUse Spacebar to check/uncheck services." 8 58
exit 0

View File

@ -0,0 +1,174 @@
#!/bin/bash
# get raspiblitz config
echo "get raspiblitz config"
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
# CHAIN is signet | testnet | mainnet
if [ $# -gt 0 ] && [ $1 != ${chain}net ];then
nonDefaultChain=1
CHAIN=$1
else
nonDefaultChain=0
CHAIN=${chain}net
fi
# prefix for parallel services
if [ ${CHAIN} = testnet ];then
chainprefix="t"
portprefix=1
elif [ ${CHAIN} = signet ];then
chainprefix="s"
portprefix=3
elif [ ${CHAIN} = mainnet ];then
chainprefix=""
portprefix=""
fi
# for testnet
echo "services default values"
if [ ${#trtlWebinterface} -eq 0 ]; then trtlWebinterface="off"; fi
if [ ${#tlnd} -eq 0 ]; then tlnd="off"; fi
if [ ${#tcrtlWebinterface} -eq 0 ]; then tcrtlWebinterface="off"; fi
if [ ${#tcln} -eq 0 ]; then tcln="off"; fi
# show select dialog
echo "run dialog ..."
OPTIONS=()
OPTIONS+=(l "LND on $CHAIN" ${tlnd})
OPTIONS+=(r "RTL for LND $CHAIN" ${trtlWebinterface})
OPTIONS+=(c "C-lightning on $CHAIN" ${tcln})
OPTIONS+=(t "RTL for CLN on $CHAIN" ${tcrtlWebinterface})
CHOICES=$(dialog --title ' Additional Services ' \
--checklist ' use spacebar to activate/de-activate ' \
11 45 4 "${OPTIONS[@]}" 2>&1 >/dev/tty)
dialogcancel=$?
echo "done dialog"
clear
# check if user canceled dialog
echo "dialogcancel(${dialogcancel})"
if [ ${dialogcancel} -eq 1 ]; then
echo "user canceled"
exit 1
elif [ ${dialogcancel} -eq 255 ]; then
echo "ESC pressed"
exit 1
fi
needsReboot=0
anychange=0
# tlnd process choice
choice="off"; check=$(echo "${CHOICES}" | grep -c "l")
if [ ${check} -eq 1 ]; then choice="on"; fi
if [ "${tlnd}" != "${choice}" ]; then
echo "# LND on $CHAIN Setting changed .."
anychange=1
/home/admin/config.scripts/lnd.chain.sh ${choice} $CHAIN
errorOnInstall=$?
if [ "${choice}" = "on" ]; then
if [ ${errorOnInstall} -eq 0 ]; then
echo "# Successfully installed LND on $CHAIN"
else
l1="# !!! FAIL on LND on $CHAIN install !!!"
l2="# Try manual install on terminal after reboot with:"
l3="/home/admin/config.scripts/lnd.chain.sh on $CHAIN"
dialog --title 'FAIL' --msgbox "${l1}\n${l2}\n${l3}" 7 65
fi
fi
else
echo "# LND on $CHAIN Setting unchanged."
fi
# tcln process choice
choice="off"; check=$(echo "${CHOICES}" | grep -c "c")
if [ ${check} -eq 1 ]; then choice="on"; fi
if [ "${tcln}" != "${choice}" ]; then
echo "# CLN on $CHAIN Setting changed .."
anychange=1
/home/admin/config.scripts/cln.install.sh ${choice} $CHAIN
errorOnInstall=$?
if [ "${choice}" = "on" ]; then
if [ ${errorOnInstall} -eq 0 ]; then
echo "# Successfully installed CLN on $CHAIN"
else
l1="# !!! FAIL on CLN on $CHAIN install !!!"
l2="# Try manual install on terminal after reboot with:"
l3="/home/admin/config.scripts/cln.install.sh on $CHAIN"
dialog --title 'FAIL' --msgbox "${l1}\n${l2}\n${l3}" 7 65
fi
fi
else
echo "# CLN on $CHAIN Setting unchanged."
fi
# tRTL process choice
choice="off"; check=$(echo "${CHOICES}" | grep -c "r")
if [ ${check} -eq 1 ]; then choice="on"; fi
if [ "${trtlWebinterface}" != "${choice}" ]; then
echo "# RTL for LND $CHAIN Setting changed .."
anychange=1
/home/admin/config.scripts/bonus.rtl.sh ${choice} lnd $CHAIN
errorOnInstall=$?
if [ "${choice}" = "on" ]; then
if [ ${errorOnInstall} -eq 0 ]; then
sudo systemctl start ${chainprefix}RTL
echo "# waiting 10 secs .."
sleep 10
/home/admin/config.scripts/bonus.rtl.sh menu lnd $CHAIN
else
l1="# !!! FAIL on RTL for LND $CHAIN install !!!"
l2="# Try manual install on terminal after reboot with:"
l3="/home/admin/config.scripts/bonus.rtl.sh on lnd $CHAIN"
dialog --title 'FAIL' --msgbox "${l1}\n${l2}\n${l3}" 7 65
fi
fi
else
echo "# RTL for LND $CHAIN Setting unchanged."
fi
# ctRTL process choice
choice="off"; check=$(echo "${CHOICES}" | grep -c "t")
if [ ${check} -eq 1 ]; then choice="on"; fi
if [ "${ctrtlWebinterface}" != "${choice}" ]; then
echo "RTL for CLN $CHAIN Setting changed .."
anychange=1
/home/admin/config.scripts/bonus.rtl.sh ${choice} cln $CHAIN
errorOnInstall=$?
if [ "${choice}" = "on" ]; then
if [ ${errorOnInstall} -eq 0 ]; then
sudo systemctl start ${chainprefix}cRTL
echo "waiting 10 secs .."
sleep 10
/home/admin/config.scripts/bonus.rtl.sh menu lnd $CHAIN
else
l1="!!! FAIL on RTL for CLN $CHAIN install !!!"
l2="Try manual install on terminal after reboot with:"
l3="/home/admin/config.scripts/bonus.rtl.sh on cln $CHAIN"
dialog --title 'FAIL' --msgbox "${l1}\n${l2}\n${l3}" 7 65
fi
fi
else
echo "RTL for CLN $CHAIN Setting unchanged."
fi
if [ ${anychange} -eq 0 ]; then
dialog --msgbox "NOTHING CHANGED!\nUse Spacebar to check/uncheck services." 8 58
exit 0
fi
if [ ${needsReboot} -eq 1 ]; then
sleep 2
dialog --pause "OK. System will reboot to activate changes." 8 58 8
clear
echo "rebooting .. (please wait)"
# stop bitcoind
sudo -u bitcoin ${network}-cli stop
sleep 4
sudo /home/admin/XXshutdown.sh reboot
fi