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
2018-12-10 20:05:58 +01:00
# CONFIGFILE - configuration of RaspiBlitz
configFile = "/mnt/hdd/raspiblitz.conf"
# INFOFILE - state data from bootstrap
infoFile = "/home/admin/raspiblitz.info"
2019-04-16 18:55:25 +01:00
# MAIN MENU AFTER SETUP
2018-12-10 20:05:58 +01:00
source ${ infoFile }
2019-04-16 18:55:25 +01:00
source ${ configFile }
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
2019-04-17 03:31:51 +01:00
# get the local network IP to be displayed on the lCD
2020-07-16 16:04:57 +02:00
localip = $( ip addr | grep 'state UP' -A2 | egrep -v 'docker0' | grep 'eth0\|wlan0' | tail -n1 | awk '{print $2}' | cut -f1 -d'/' )
2019-04-17 03:31:51 +01:00
2019-04-16 19:07:13 +01:00
# BASIC MENU INFO
2020-02-18 12:15:05 +01:00
HEIGHT = 17
2019-04-16 19:07:13 +01:00
WIDTH = 64
2020-02-18 12:16:58 +01:00
CHOICE_HEIGHT = 10
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
plus = " / TOR"
2018-12-10 20:05:58 +01:00
fi
2019-04-16 18:55:25 +01:00
if [ ${# dynDomain } -gt 0 ] ; then
plus = " ${ plus } / ${ dynDomain } "
2019-04-15 22:37:03 +01:00
fi
2019-04-16 18:55:25 +01:00
BACKTITLE = " ${ localip } / ${ hostname } / ${ network } / ${ chain } ${ plus } "
2019-04-16 19:05:23 +01:00
if [ " ${ rtlWebinterface } " = = "on" ] ; then
2019-04-16 18:55:25 +01:00
TITLE = " Webinterface: http:// ${ localip } :3000 "
2019-04-15 22:37:03 +01:00
fi
2019-01-30 09:48:25 +00:00
2020-01-26 21:37:41 +01:00
# Put Activated Apps on top
2020-01-26 23:35:02 +01:00
if [ " ${ rtlWebinterface } " = = "on" ] ; then
2020-06-14 15:46:11 +02:00
OPTIONS += ( RTL "RTL Web Node Manager" )
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
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
2020-04-22 20:57:32 +02:00
OPTIONS += ( LNBITS "LNbits Server" )
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-03-16 15:11:39 +01:00
if [ " ${ specter } " = = "on" ] ; then
OPTIONS += ( SPECTER "Cryptoadvance Specter" )
fi
2020-03-24 21:16:46 -07:00
if [ " ${ joinmarket } " = = "on" ] ; then
2020-03-31 11:36:22 +01:00
OPTIONS += ( JMARKET "JoinMarket" )
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-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-06-01 11:52:40 +01:00
2020-01-26 21:37:41 +01:00
# Basic Options
OPTIONS += ( INFO "RaspiBlitz Status Screen" )
2020-01-26 21:52:00 +01:00
OPTIONS += ( FUNDING "Fund your LND Wallet" )
2020-01-26 21:37:41 +01:00
OPTIONS += ( CONNECT "Connect to a Peer" )
OPTIONS += ( CHANNEL "Open a Channel with Peer" )
OPTIONS += ( SEND "Pay an Invoice/PaymentRequest" )
OPTIONS += ( RECEIVE "Create Invoice/PaymentRequest" )
2019-03-17 16:29:59 +01:00
2019-04-16 18:55:25 +01:00
openChannels = $( sudo -u bitcoin /usr/local/bin/lncli --chain= ${ network } --network= ${ chain } net listchannels 2>/dev/null | jq '.[] | length' )
2019-04-16 19:05:23 +01:00
if [ ${# openChannels } -gt 0 ] && [ ${ openChannels } -gt 0 ] ; then
2020-06-14 15:46:11 +02:00
OPTIONS += ( CLOSEALL "Close all open Channels" )
2018-12-10 20:05:58 +01:00
fi
2018-07-17 13:12:03 +02:00
2020-02-17 22:07:29 +01:00
OPTIONS += ( CASHOUT "Remove Funds from LND" )
2020-02-17 22:27:12 +01:00
if [ " ${ chain } " = "main" ] ; then
OPTIONS += ( lnbalance "Detailed Wallet Balances" )
OPTIONS += ( lnchannels "Lightning Channel List" )
2020-06-14 15:46:11 +02:00
OPTIONS += ( lnfwdreport "Lightning Forwarding Events Report" )
2020-02-17 22:27:12 +01:00
fi
2020-06-18 00:18:42 +02:00
OPTIONS += ( SETTINGS "Node Settings & Options" )
OPTIONS += ( SERVICES "Additional Apps & Services" )
2020-05-27 00:36:11 +02:00
OPTIONS += ( SUBSCRIBE "Manage Subscriptions" )
2020-02-17 22:27:12 +01:00
OPTIONS += ( MOBILE "Connect Mobile Wallet" )
2020-05-02 11:59:04 +02:00
OPTIONS += ( LNDCREDS "Manage LND Credentials" )
2020-02-17 22:27:12 +01:00
OPTIONS += ( NAME "Change Name/Alias of Node" )
OPTIONS += ( PASSWORD "Change Passwords" )
2020-01-26 21:30:51 +01:00
if [ " ${ runBehindTor } " = = "on" ] ; then
2020-06-14 15:46:11 +02:00
OPTIONS += ( TOR "Monitor TOR Service" )
2020-01-26 21:30:51 +01:00
fi
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" )
OPTIONS += ( X "Console / Terminal" )
2018-07-17 13:12:03 +02:00
CHOICE = $( dialog --clear \
--backtitle " $BACKTITLE " \
--title " $TITLE " \
--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) ..."
2019-04-25 02:42:45 +02:00
walletLocked = $( lncli getinfo 2>& 1 | grep -c "Wallet is encrypted" )
if [ ${ walletLocked } -eq 0 ] ; then
2020-09-21 15:38:00 +02:00
while :
do
# show the same info as on LCD screen
/home/admin/00infoBlitz.sh
# wait 2 seconds for key input
echo "Screen is updating in loop .... keep 'x' pressed to exit to menu."
read -n 1 -t 2 keyPressed
# check if user wants to abort session
if [ " ${ keyPressed } " = "x" ] ; then
echo ""
echo "Returning to menu ....."
sleep 4
break
fi
done
2020-02-17 14:29:43 +01:00
else
/home/admin/00raspiblitz.sh
exit 0
2019-04-25 02:42:45 +02:00
fi
2018-07-27 11:17:59 +02:00
; ;
2019-12-04 08:13:21 +00:00
TOR)
2020-09-28 21:26:04 +02:00
sudo -u debian-tor nyx
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
; ;
2020-01-26 23:35:02 +01:00
RTL)
/home/admin/config.scripts/bonus.rtl.sh menu
; ;
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
; ;
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-03-16 15:11:39 +01:00
SPECTER)
/home/admin/config.scripts/bonus.cryptoadvance-specter.sh menu
; ;
2020-03-24 21:16:46 -07:00
JMARKET)
sudo /home/admin/config.scripts/bonus.joinmarket.sh menu
; ;
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-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
; ;
2020-06-14 15:46:11 +02:00
ZEROTIER)
sudo /home/admin/config.scripts/bonus.zerotier.sh menu
; ;
2020-05-27 00:36:11 +02:00
SUBSCRIBE)
/home/admin/config.scripts/blitz.subscriptions.py
; ;
2020-02-17 14:49:03 +01:00
lnbalance)
clear
echo "*** YOUR SATOSHI BALANCES ***"
lnbalance ${ network }
echo "Press ENTER to return to main menu."
read key
; ;
2018-07-27 11:17:59 +02:00
lnchannels)
2020-02-17 14:49:03 +01:00
clear
echo "*** YOUR LIGHTNING CHANNELS ***"
2018-09-21 22:28:34 -07:00
lnchannels ${ network }
2018-07-27 11:17:59 +02:00
echo "Press ENTER to return to main menu."
read key
2018-07-17 13:12:03 +02:00
; ;
2020-01-26 02:20:01 +00:00
lnfwdreport)
2020-06-14 15:46:11 +02:00
./XXlnfwdreport.sh
2020-01-26 02:20:01 +00:00
echo "Press ENTER to return to main menu."
read key
./00mainMenu.sh
; ;
2018-08-02 03:50:31 +02:00
CONNECT)
2020-02-17 14:29:43 +01:00
/home/admin/BBconnectPeer.sh
2018-12-03 18:43:19 +01:00
; ;
2018-08-02 03:50:31 +02:00
FUNDING)
2020-02-17 14:29:43 +01:00
/home/admin/BBfundWallet.sh
2018-12-03 18:43:19 +01:00
; ;
2018-08-23 17:59:35 +02:00
CASHOUT)
2020-02-17 14:29:43 +01:00
/home/admin/BBcashoutWallet.sh
2018-08-23 17:59:35 +02:00
; ;
2018-08-09 01:27:29 +02:00
CHANNEL)
2020-02-17 14:29:43 +01:00
/home/admin/BBopenChannel.sh
2018-12-03 18:43:19 +01:00
; ;
2018-08-09 14:44:45 +02:00
SEND)
2020-02-17 14:29:43 +01:00
/home/admin/BBpayInvoice.sh
2018-12-03 18:43:19 +01:00
; ;
2018-08-09 14:44:45 +02:00
RECEIVE)
2020-02-17 14:29:43 +01:00
/home/admin/BBcreateInvoice.sh
2018-12-03 18:43:19 +01:00
; ;
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
; ;
2018-08-09 13:26:44 +02:00
CLOSEALL)
2020-02-17 14:29:43 +01:00
/home/admin/BBcloseAllChannels.sh
2018-08-09 13:26:44 +02:00
echo "Press ENTER to return to main menu."
read key
2018-12-03 18:43:19 +01:00
; ;
2018-08-23 03:51:40 +02:00
MOBILE)
2020-02-17 14:29:43 +01:00
/home/admin/97addMobileWallet.sh
2018-12-03 18:43:19 +01:00
; ;
2020-05-02 11:59:04 +02:00
LNDCREDS)
sudo /home/admin/config.scripts/lnd.credentials.sh
2019-01-15 22:53:42 +01:00
; ;
2019-01-14 13:45:24 +01:00
NAME)
sudo /home/admin/config.scripts/lnd.setname.sh
2019-01-30 09:48:25 +00:00
noreboot = $?
if [ " ${ noreboot } " = "0" ] ; then
sudo -u bitcoin ${ network } -cli stop
echo "Press ENTER to Reboot."
read key
2019-12-11 14:03:52 +01:00
sudo /home/admin/XXshutdown.sh reboot
2020-02-17 14:29:43 +01:00
exit 0
2019-01-30 09:48:25 +00:00
fi
2019-01-14 13:45:24 +01:00
; ;
2019-06-19 00:13:03 +02:00
REPAIR)
2020-02-17 14:29:43 +01:00
/home/admin/98repairMenu.sh
2020-03-29 22:04:33 +02:00
if [ $? -eq 99 ] ; then
exit 1
fi
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
noreboot = $?
if [ " ${ noreboot } " = "0" ] ; then
echo "Press ENTER to Reboot .."
read key
2019-12-11 14:03:52 +01:00
sudo /home/admin/XXshutdown.sh reboot
2020-02-17 14:29:43 +01:00
exit 0
2019-01-14 18:19:48 +01:00
fi
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)
2020-07-18 12:36:43 +02:00
clear
2020-07-19 23:45:23 +02:00
confirmation "Are you sure?" "Reboot" "Cancel" true 7 40
2020-07-18 12:36:43 +02:00
confirmationReboot = $?
if [ $confirmationReboot -eq 0 ] ; then
clear
echo ""
sudo /home/admin/XXshutdown.sh reboot
exit 0
fi
2020-04-26 18:17:06 +02:00
; ;
2018-10-18 23:38:44 +02:00
OFF)
2020-07-18 12:36:43 +02:00
clear
2020-07-19 23:45:23 +02:00
confirmation "Are you sure?" "PowerOff" "Cancel" true 7 40
2020-07-18 12:36:43 +02:00
confirmationShutdown = $?
if [ $confirmationShutdown -eq 0 ] ; then
clear
echo ""
sudo /home/admin/XXshutdown.sh
exit 0
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
2019-12-11 14:03:52 +01:00
sudo /home/admin/XXshutdown.sh reboot
2018-12-03 18:36:11 +01:00
exit 0
2020-02-17 14:22:33 +01:00
; ;
X)
clear
echo "***********************************"
echo "* RaspiBlitz Commandline"
echo "* Here be dragons .. have fun :)"
echo "***********************************"
echo "LND command line options: lncli -h"
echo "Back to main menu use command: raspiblitz"
echo
exit 0
; ;
*)
clear
echo "To return to main menu use command: raspiblitz"
2019-04-16 18:31:36 +01:00
exit 0
2020-02-17 14:22:33 +01:00
esac
2020-02-17 14:29:43 +01:00
# go into loop - start script from beginning to load config/sate fresh
/home/admin/00mainMenu.sh