2018-07-17 13:12:03 +02:00
#!/bin/bash
2020-07-18 12:36:43 +02:00
2018-12-10 22:45:44 +01:00
echo "Starting the main menu ..."
2018-07-17 13:12:03 +02:00
2019-04-16 18:55:25 +01:00
# MAIN MENU AFTER SETUP
2021-12-14 23:34:35 +01:00
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
2020-07-23 11:41:11 +02:00
# FUNCTIONS
confirmation( )
{
local text = $1
local yesButtonText = $2
local noButtonText = $3
local defaultno = $4
local height = $5
local width = $6
local answer = -100
if [ $defaultno ] ; then
whiptail --title " Confirmation " --defaultno --yes-button " $yesButtonText " --no-button " $noButtonText " --yesno " $text
" $height $width
else
whiptail --title " Confirmation " --yes-button " $yesButtonText " --no-button " $noButtonText " --yesno " $text
" $height $width
fi
answer = $?
return $answer
}
2018-12-10 20:05:58 +01:00
2020-10-13 20:03:27 +02:00
# get the local network IP to be displayed on the LCD
2021-12-14 23:34:35 +01:00
source <( /home/admin/_cache.sh get internet_localip)
2019-04-17 03:31:51 +01:00
2021-08-04 00:18:30 +02:00
if [ ${ chain } = test ] ; then
netprefix = "t"
elif [ ${ chain } = sig ] ; then
netprefix = "s"
elif [ ${ chain } = main ] ; then
netprefix = ""
fi
2019-04-16 19:07:13 +01:00
# BASIC MENU INFO
2021-08-30 23:57:44 +02:00
WIDTH = 66
2019-04-16 19:07:13 +01:00
BACKTITLE = "RaspiBlitz"
TITLE = ""
MENU = "Choose one of the following options:"
OPTIONS = ( )
2019-04-16 18:55:25 +01:00
plus = ""
if [ " ${ runBehindTor } " = "on" ] ; then
2021-09-06 19:38:17 +02:00
plus = "/ tor"
2018-12-10 20:05:58 +01:00
fi
2019-04-16 18:55:25 +01:00
if [ ${# dynDomain } -gt 0 ] ; then
2021-08-30 20:59:52 +02:00
plus = " / ${ dynDomain } ${ plus } "
2019-04-15 22:37:03 +01:00
fi
2021-08-30 20:59:52 +02:00
if [ ${# lightning } -gt 0 ] ; then
plus = " / ${ lightning } ${ plus } "
fi
2021-12-14 23:34:35 +01:00
BACKTITLE = " ${ internet_localip } / ${ hostname } / ${ network } ${ plus } "
2019-04-16 19:05:23 +01:00
2021-08-31 13:30:57 +02:00
# Basic Options
OPTIONS += ( INFO "RaspiBlitz Status Screen" )
2021-10-01 12:16:18 +02:00
# if LND is active
if [ " ${ lightning } " = = "lnd" ] || [ " ${ lnd } " = = "on" ] ; then
OPTIONS += ( LND "LND Wallet Options" )
fi
# if C-Lightning is active
if [ " ${ lightning } " = = "cl" ] || [ " ${ cl } " = = "on" ] ; then
OPTIONS += ( CL "C-lightning Wallet Options" )
fi
2021-08-31 13:30:57 +02:00
# Activated Apps/Services
2021-08-30 23:57:44 +02:00
if [ " ${ rtlWebinterface } " = = "on" ] ; then
OPTIONS += ( LRTL "LND RTL Webinterface" )
fi
if [ " ${ crtlWebinterface } " = = "on" ] ; then
OPTIONS += ( CRTL "C-Lightning RTL Webinterface" )
2020-01-26 23:35:02 +01:00
fi
2020-01-27 02:00:38 +01:00
if [ " ${ BTCPayServer } " = = "on" ] ; then
2020-06-14 15:46:11 +02:00
OPTIONS += ( BTCPAY "BTCPay Server Info" )
2020-01-27 02:00:38 +01:00
fi
2021-03-18 22:46:58 +01:00
if [ " ${ lit } " = = "on" ] ; then
OPTIONS += ( LIT "LIT (loop, pool, faraday)" )
2021-08-04 00:18:30 +02:00
fi
if [ " ${ sparko } " = = "on" ] ; then
OPTIONS += ( SPARKO "Sparko Webwallet" )
2021-03-18 22:46:58 +01:00
fi
2021-10-01 12:14:42 +01:00
if [ " ${ spark } " = = "on" ] ; then
OPTIONS += ( SPARK "Spark Wallet" )
fi
2020-01-26 21:37:41 +01:00
if [ " ${ ElectRS } " = = "on" ] ; then
2020-06-14 15:46:11 +02:00
OPTIONS += ( ELECTRS "Electrum Rust Server" )
2020-01-26 21:37:41 +01:00
fi
2020-01-27 02:20:18 +01:00
if [ " ${ BTCRPCexplorer } " = = "on" ] ; then
2020-06-14 15:46:11 +02:00
OPTIONS += ( EXPLORE "BTC RPC Explorer" )
2020-01-27 02:20:18 +01:00
fi
2020-04-23 23:10:30 +02:00
if [ " ${ LNBits } " = = "on" ] ; then
2021-12-16 20:10:03 +01:00
if [ " ${ LNBitsFunding } " = = "lnd" ] || [ " ${ LNBitsFunding } " = = "tlnd" ] || [ " ${ LNBitsFunding } " = = "slnd" ] || [ " ${ LNBitsFunding } " = = "" ] ; then
OPTIONS += ( LNBITS "LNbits on LND" )
elif [ " ${ LNBitsFunding } " = = "cl" ] || [ " ${ LNBitsFunding } " = = "tcl" ] || [ " ${ LNBitsFunding } " = = "scl" ] ; then
OPTIONS += ( LNBITS "LNbits on c-lightning" )
fi
2020-02-10 20:44:41 +01:00
fi
2020-01-26 22:30:26 +01:00
if [ " ${ lndmanage } " = = "on" ] ; then
2020-06-14 15:46:11 +02:00
OPTIONS += ( LNDMANAGE "LND Manage Script" )
2020-01-26 23:06:03 +01:00
fi
2020-02-10 20:44:41 +01:00
if [ " ${ loop } " = = "on" ] ; then
2020-06-14 15:46:11 +02:00
OPTIONS += ( LOOP "Loop In/Out Service" )
2020-01-26 22:30:26 +01:00
fi
2020-10-07 22:21:19 +02:00
if [ " ${ mempoolExplorer } " = = "on" ] ; then
2020-10-07 11:10:19 +00:00
OPTIONS += ( MEMPOOL "Mempool Space" )
fi
2020-03-16 15:11:39 +01:00
if [ " ${ specter } " = = "on" ] ; then
2021-08-23 17:23:01 +01:00
OPTIONS += ( SPECTER "Specter Desktop" )
2020-03-16 15:11:39 +01:00
fi
2020-03-24 21:16:46 -07:00
if [ " ${ joinmarket } " = = "on" ] ; then
2021-10-01 19:39:44 +01:00
OPTIONS += ( JM "JoinMarket with JoininBox" )
2020-03-24 21:16:46 -07:00
fi
2020-05-15 19:33:05 +02:00
if [ " ${ faraday } " = = "on" ] ; then
OPTIONS += ( FARADAY "Faraday Channel Management" )
fi
2020-05-18 15:25:39 +01:00
if [ " ${ bos } " = = "on" ] ; then
OPTIONS += ( BOS "Balance of Satoshis" )
fi
2020-10-18 13:29:17 +00:00
if [ " ${ pyblock } " = = "on" ] ; then
OPTIONS += ( PYBLOCK "PyBlock" )
fi
2020-06-01 11:52:40 +01:00
if [ " ${ thunderhub } " = = "on" ] ; then
OPTIONS += ( THUB "ThunderHub" )
fi
2020-06-14 15:46:11 +02:00
if [ " ${ zerotier } " = = "on" ] ; then
OPTIONS += ( ZEROTIER "ZeroTier" )
fi
2020-11-06 18:13:06 +01:00
if [ " ${ pool } " = = "on" ] ; then
OPTIONS += ( POOL "Lightning Pool" )
fi
2020-11-15 22:07:53 +01:00
if [ " ${ sphinxrelay } " = = "on" ] ; then
OPTIONS += ( SPHINX "Sphinx Chat Relay" )
fi
2022-02-19 09:45:02 -05:00
if [ " ${ helipad } " = = "on" ] ; then
OPTIONS += ( HELIPAD "Helipad Boostagram reader" )
fi
2021-03-23 20:15:39 +01:00
if [ " ${ chantools } " = = "on" ] ; then
OPTIONS += ( CHANTOOLS "ChannelTools (Fund Rescue)" )
fi
2021-03-24 23:41:40 +01:00
if [ " ${ circuitbreaker } " = = "on" ] ; then
OPTIONS += ( CIRCUIT "Circuitbreaker (LND firewall)" )
2021-08-04 00:18:30 +02:00
fi
2022-01-26 00:42:54 +01:00
if [ " ${ tallycoinConnect } " = = "on" ] ; then
OPTIONS += ( TALLY "Tallycoin Connect" )
fi
2021-08-31 13:27:35 +02:00
# dont offer to switch to "testnet view for now" - so no wswitch back to mainnet needed
#if [ ${chain} != "main" ]; then
# OPTIONS+=(MAINNET "Mainnet Service Options")
#fi
2021-08-31 13:30:57 +02:00
if [ " ${ testnet } " = = "on" ] ; then
OPTIONS += ( TESTNETS "Testnet/Signet Options" )
fi
2020-06-18 00:18:42 +02:00
OPTIONS += ( SETTINGS "Node Settings & Options" )
OPTIONS += ( SERVICES "Additional Apps & Services" )
2021-04-07 23:24:55 +01:00
OPTIONS += ( SYSTEM "Monitoring & Configuration" )
OPTIONS += ( CONNECT "Connect Apps & Show Credentials" )
2021-08-30 21:23:58 +02:00
if [ " ${ lightning } " = = "lnd" ] || [ " ${ lnd } " = = "on" ] ; then
OPTIONS += ( SUBSCRIBE "Manage Subscriptions" )
fi
2020-02-17 22:27:12 +01:00
OPTIONS += ( PASSWORD "Change Passwords" )
2020-01-26 17:23:22 +01:00
if [ " ${ touchscreen } " = = "1" ] ; then
2020-06-14 15:46:11 +02:00
OPTIONS += ( SCREEN "Touchscreen Calibration" )
2020-01-26 17:23:22 +01:00
fi
2019-04-16 18:55:25 +01:00
# final Options
2019-06-19 00:13:03 +02:00
OPTIONS += ( REPAIR "Repair Options" )
2019-04-16 18:55:25 +01:00
OPTIONS += ( UPDATE "Check/Prepare RaspiBlitz Update" )
2020-04-26 18:17:06 +02:00
OPTIONS += ( REBOOT "Reboot RaspiBlitz" )
2019-04-16 18:55:25 +01:00
OPTIONS += ( OFF "PowerOff RaspiBlitz" )
2018-07-17 13:12:03 +02:00
2021-08-16 16:41:23 +02:00
CHOICE_HEIGHT = $(( " ${# OPTIONS [@] } /2+1 " ))
2021-08-04 00:18:30 +02:00
HEIGHT = $(( CHOICE_HEIGHT+6))
2018-07-17 13:12:03 +02:00
CHOICE = $( dialog --clear \
--backtitle " $BACKTITLE " \
--title " $TITLE " \
2021-04-07 23:24:55 +01:00
--ok-label "Select" \
--cancel-label "Exit" \
2018-07-17 13:12:03 +02:00
--menu " $MENU " \
$HEIGHT $WIDTH $CHOICE_HEIGHT \
" ${ OPTIONS [@] } " \
2>& 1 >/dev/tty)
case $CHOICE in
INFO)
2020-02-17 14:30:40 +01:00
echo "Gathering Information (please wait) ..."
2021-08-26 16:21:54 +02:00
while :
do
2020-09-21 15:38:00 +02:00
2021-08-26 16:21:54 +02:00
# show the same info as on LCD screen
2022-01-30 14:52:50 +01:00
/home/admin/00infoBlitz.sh ${ chain } net ${ lightning }
2020-09-21 15:38:00 +02:00
2021-08-26 16:21:54 +02:00
# 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
2020-10-14 23:25:39 +02:00
echo ""
2021-08-26 16:21:54 +02:00
echo "Returning to menu ....."
sleep 4
break
fi
done
2018-07-27 11:17:59 +02:00
; ;
2021-08-04 00:18:30 +02:00
LND)
/home/admin/99lndMenu.sh
; ;
2021-09-26 10:30:09 +01:00
CL)
/home/admin/99clMenu.sh ${ chain } net
2021-04-07 23:24:55 +01:00
; ;
CONNECT)
/home/admin/99connectMenu.sh
; ;
SYSTEM)
2021-08-04 00:18:30 +02:00
/home/admin/99systemMenu.sh ${ chain } net
2018-08-21 12:30:43 +02:00
; ;
2020-01-26 17:22:00 +01:00
SCREEN)
dialog --title 'Touchscreen Calibration' --msgbox 'Choose OK and then follow the instructions on touchscreen for calibration.\n\nBest is to use a stylus for accurate touchscreen interaction.' 9 48
2020-01-26 17:24:41 +01:00
/home/admin/config.scripts/blitz.touchscreen.sh calibrate
2020-01-26 21:30:51 +01:00
; ;
2021-08-30 23:57:44 +02:00
LRTL)
2021-09-01 01:07:11 +02:00
/home/admin/config.scripts/bonus.rtl.sh menu lnd mainnet
2021-08-30 23:57:44 +02:00
; ;
CRTL)
2021-09-26 10:30:09 +01:00
/home/admin/config.scripts/bonus.rtl.sh menu cl mainnet
2020-01-26 23:35:02 +01:00
; ;
2020-01-27 02:01:37 +01:00
BTCPAY)
2020-01-27 02:00:38 +01:00
/home/admin/config.scripts/bonus.btcpayserver.sh menu
; ;
2020-01-27 02:20:18 +01:00
EXPLORE)
/home/admin/config.scripts/bonus.btc-rpc-explorer.sh menu
; ;
2020-01-26 21:30:51 +01:00
ELECTRS)
/home/admin/config.scripts/bonus.electrs.sh menu
2020-01-26 17:22:00 +01:00
; ;
2021-03-18 22:46:58 +01:00
LIT)
/home/admin/config.scripts/bonus.lit.sh menu
; ;
2021-08-04 00:18:30 +02:00
SPARKO)
2021-09-26 10:30:09 +01:00
/home/admin/config.scripts/cl-plugin.sparko.sh menu mainnet
2021-08-04 00:18:30 +02:00
; ;
2021-10-01 12:14:42 +01:00
SPARK)
/home/admin/config.scripts/cl.spark.sh menu mainnet
; ;
2020-02-10 20:44:41 +01:00
LNBITS)
/home/admin/config.scripts/bonus.lnbits.sh menu
; ;
2020-01-26 23:06:03 +01:00
LNDMANAGE)
2020-01-26 22:30:26 +01:00
/home/admin/config.scripts/bonus.lndmanage.sh menu
; ;
2020-01-26 23:06:03 +01:00
LOOP)
/home/admin/config.scripts/bonus.loop.sh menu
; ;
2020-10-07 11:10:19 +00:00
MEMPOOL)
/home/admin/config.scripts/bonus.mempool.sh menu
; ;
2020-03-16 15:11:39 +01:00
SPECTER)
2021-08-23 17:23:01 +01:00
/home/admin/config.scripts/bonus.specter.sh menu
2020-03-16 15:11:39 +01:00
; ;
2021-10-01 19:39:44 +01:00
JM)
2022-01-05 10:37:25 +00:00
/home/admin/config.scripts/bonus.joinmarket.sh menu
2020-03-24 21:16:46 -07:00
; ;
2020-05-15 19:33:05 +02:00
FARADAY)
sudo /home/admin/config.scripts/bonus.faraday.sh menu
2020-05-23 09:36:34 +01:00
; ;
2020-05-18 15:25:39 +01:00
BOS)
sudo /home/admin/config.scripts/bonus.bos.sh menu
2020-10-18 13:29:17 +00:00
; ;
2020-11-06 18:13:06 +01:00
PYBLOCK)
2020-10-18 13:29:17 +00:00
sudo /home/admin/config.scripts/bonus.pyblock.sh menu
2020-05-15 19:33:05 +02:00
; ;
2020-06-01 11:52:40 +01:00
THUB)
sudo /home/admin/config.scripts/bonus.thunderhub.sh menu
; ;
2022-01-26 00:42:54 +01:00
TALLY)
sudo /home/admin/config.scripts/bonus.tallycoin-connect.sh menu
; ;
2020-06-14 15:46:11 +02:00
ZEROTIER)
sudo /home/admin/config.scripts/bonus.zerotier.sh menu
; ;
2020-11-06 18:13:06 +01:00
POOL)
sudo /home/admin/config.scripts/bonus.pool.sh menu
; ;
2020-11-15 22:07:53 +01:00
SPHINX)
sudo /home/admin/config.scripts/bonus.sphinxrelay.sh menu
; ;
2022-02-19 09:45:02 -05:00
HELIPAD)
sudo /home/admin/config.scripts/bonus.helipad.sh menu
; ;
2021-03-23 20:15:39 +01:00
CHANTOOLS)
sudo /home/admin/config.scripts/bonus.chantools.sh menu
; ;
2021-03-24 23:41:40 +01:00
CIRCUIT)
sudo /home/admin/config.scripts/bonus.circuitbreaker.sh menu
2021-08-04 00:18:30 +02:00
; ;
2021-08-31 13:27:35 +02:00
TESTNETS)
/home/admin/00parallelChainsMenu.sh
; ;
2020-05-27 00:36:11 +02:00
SUBSCRIBE)
/home/admin/config.scripts/blitz.subscriptions.py
; ;
2018-10-15 23:36:40 +02:00
SERVICES)
2020-02-17 14:29:43 +01:00
/home/admin/00settingsMenuServices.sh
2018-12-03 18:43:19 +01:00
; ;
2020-06-18 00:36:53 +02:00
SETTINGS)
/home/admin/00settingsMenuBasics.sh
; ;
2019-06-19 00:13:03 +02:00
REPAIR)
2020-02-17 14:29:43 +01:00
/home/admin/98repairMenu.sh
2019-04-10 14:58:47 +01:00
; ;
2019-01-14 17:59:18 +01:00
PASSWORD)
2019-01-14 18:19:48 +01:00
sudo /home/admin/config.scripts/blitz.setpassword.sh
2019-01-14 17:59:18 +01:00
; ;
2020-02-17 14:22:33 +01:00
UPDATE)
2020-04-26 15:39:10 +02:00
/home/admin/99updateMenu.sh
2020-06-14 15:46:11 +02:00
; ;
2020-04-26 18:17:06 +02:00
REBOOT)
2021-08-04 00:18:30 +02:00
clear
confirmation "Are you sure?" "Reboot" "Cancel" true 7 40
confirmationReboot = $?
if [ $confirmationReboot -eq 0 ] ; then
2020-07-18 12:36:43 +02:00
clear
echo ""
2021-08-04 00:18:30 +02:00
sudo /home/admin/config.scripts/blitz.shutdown.sh reboot
exit 1
fi
2020-04-26 18:17:06 +02:00
; ;
2018-10-18 23:38:44 +02:00
OFF)
2021-08-04 00:18:30 +02:00
clear
confirmation "Are you sure?" "PowerOff" "Cancel" true 7 40
confirmationShutdown = $?
if [ $confirmationShutdown -eq 0 ] ; then
2020-07-18 12:36:43 +02:00
clear
echo ""
2021-08-04 00:18:30 +02:00
sudo /home/admin/config.scripts/blitz.shutdown.sh
exit 1
fi
2018-12-03 18:43:19 +01:00
; ;
2018-12-03 18:36:11 +01:00
DELETE)
2020-02-17 14:29:43 +01:00
sudo /home/admin/XXcleanHDD.sh
2021-08-04 00:18:30 +02:00
sudo /home/admin/config.scripts/blitz.shutdown.sh reboot
exit 1
2020-02-17 14:22:33 +01:00
; ;
2021-04-07 23:24:55 +01:00
*)
2020-02-17 14:22:33 +01:00
clear
2021-08-04 00:18:30 +02:00
exit 1
2020-02-17 14:22:33 +01:00
esac
2020-02-17 14:29:43 +01:00
2021-08-04 00:18:30 +02:00
# forward exit code of submenu to outside loop
# 0 = continue loop / everything else = break loop and exit to terminal
exitCodeOfSubmenu = $?
if [ " ${ exitCodeOfSubmenu } " != "0" ] ; then
echo " # submenu signaled exit code ' ${ exitCodeOfSubmenu } ' --> forward to outside loop "
fi
exit ${ exitCodeOfSubmenu }