rename 00parallel* menu scripts

This commit is contained in:
openoms 2021-05-23 18:09:13 +01:00
parent ab279c7d10
commit 5c5cccefc8
No known key found for this signature in database
GPG key ID: 5BFB77609B081B65
4 changed files with 168 additions and 27 deletions

View file

@ -330,10 +330,10 @@ case $CHOICE in
sudo /home/admin/config.scripts/bonus.circuitbreaker.sh menu
;;
TESTNET)
/home/admin/00chainMenu.sh testnet
/home/admin/00parallelChainsMenu.sh testnet
;;
MAINNET)
/home/admin/00chainMenu.sh mainnet
/home/admin/00parallelChainsMenu.sh mainnet
;;
SUBSCRIBE)
/home/admin/config.scripts/blitz.subscriptions.py

View file

@ -1,7 +1,7 @@
#!/bin/bash
# Usage:
# 00testnetMenu.sh <testnet|signet|mainnet> <lnd|cln>
# 00parallelChainsMenu.sh <testnet|signet|mainnet> <lnd|cln>
source /home/admin/raspiblitz.info
# add default value to raspi config if needed
@ -159,7 +159,11 @@ case $CHOICE in
/home/admin/99clnMenu.sh $CHAIN
;;
SERVICES)
/home/admin/00testnetServices.sh $CHAIN
if [ $CHAIN = testnet ];then
/home/admin/00parallelTestnetServices.sh
elif [ $CHAIN = mainnet ];then
/home/admin/00parallelMainnetServices.sh $CHAIN
fi
;;
SYSTEM)
/home/admin/99systemMenu.sh $CHAIN
@ -179,6 +183,7 @@ case $CHOICE in
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"
sudo /home/admin/config.scripts/lnd.credentials.sh sync
echo
echo "Press ENTER to return to main menu."
read key

View file

@ -0,0 +1,155 @@
#!/bin/bash
# get raspiblitz config
echo "get raspiblitz config"
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
CHAIN=mainnet
# for testnet
echo "services default values"
if [ ${#rtlWebinterface} -eq 0 ]; then rtlWebinterface="off"; fi
if [ ${#lnd} -eq 0 ]; then lnd="off"; fi
if [ ${#crtlWebinterface} -eq 0 ]; then crtlWebinterface="off"; fi
if [ ${#cln} -eq 0 ]; then cln="off"; fi
# show select dialog
echo "run dialog ..."
OPTIONS=()
OPTIONS+=(l "LND on $CHAIN" ${lnd})
OPTIONS+=(r "RTL for LND $CHAIN" ${rtlWebinterface})
OPTIONS+=(c "C-lightning on $CHAIN" ${cln})
OPTIONS+=(t "RTL for CLN on $CHAIN" ${crtlWebinterface})
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
# lnd process choice
choice="off"; check=$(echo "${CHOICES}" | grep -c "l")
if [ ${check} -eq 1 ]; then choice="on"; fi
if [ "${lnd}" != "${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
# cln process choice
choice="off"; check=$(echo "${CHOICES}" | grep -c "c")
if [ ${check} -eq 1 ]; then choice="on"; fi
if [ "${cln}" != "${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 [ "${rtlWebinterface}" != "${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 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 [ "${crtlWebinterface}" != "${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 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

View file

@ -5,25 +5,7 @@ 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
CHAIN=testnet
# for testnet
echo "services default values"
@ -32,7 +14,6 @@ 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 ..."
@ -117,7 +98,7 @@ if [ "${trtlWebinterface}" != "${choice}" ]; then
errorOnInstall=$?
if [ "${choice}" = "on" ]; then
if [ ${errorOnInstall} -eq 0 ]; then
sudo systemctl start ${chainprefix}RTL
sudo systemctl start tRTL
echo "# waiting 10 secs .."
sleep 10
/home/admin/config.scripts/bonus.rtl.sh menu lnd $CHAIN
@ -135,14 +116,14 @@ fi
# ctRTL process choice
choice="off"; check=$(echo "${CHOICES}" | grep -c "t")
if [ ${check} -eq 1 ]; then choice="on"; fi
if [ "${ctrtlWebinterface}" != "${choice}" ]; then
if [ "${tcrtlWebinterface}" != "${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
sudo systemctl start tcRTL
echo "waiting 10 secs .."
sleep 10
/home/admin/config.scripts/bonus.rtl.sh menu lnd $CHAIN