raspiblitz/home.admin/00mainMenu.sh

394 lines
11 KiB
Bash
Raw Normal View History

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}
# 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
# get the local network IP to be displayed on the LCD
2020-11-01 19:58:50 +01:00
source <(/home/admin/config.scripts/internet.sh status local)
2019-04-17 03:31:51 +01:00
2021-05-22 15:51:22 +01: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
HEIGHT=19
2019-04-16 19:07:13 +01:00
WIDTH=64
CHOICE_HEIGHT=12
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")
HEIGHT=$((HEIGHT+1))
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
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")
HEIGHT=$((HEIGHT+1))
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
2020-01-27 02:00:38 +01:00
fi
if [ "${lit}" == "on" ]; then
OPTIONS+=(LIT "LIT (loop, pool, faraday)")
HEIGHT=$((HEIGHT+1))
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
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")
HEIGHT=$((HEIGHT+1))
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
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")
HEIGHT=$((HEIGHT+1))
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
2020-01-27 02:20:18 +01:00
fi
2020-04-23 23:10:30 +02:00
if [ "${LNBits}" == "on" ]; then
OPTIONS+=(LNBITS "LNbits Server")
HEIGHT=$((HEIGHT+1))
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
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")
HEIGHT=$((HEIGHT+1))
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
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")
HEIGHT=$((HEIGHT+1))
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
2020-01-26 22:30:26 +01:00
fi
if [ "${mempoolExplorer}" == "on" ]; then
OPTIONS+=(MEMPOOL "Mempool Space")
HEIGHT=$((HEIGHT+1))
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
fi
2020-03-16 15:11:39 +01:00
if [ "${specter}" == "on" ]; then
OPTIONS+=(SPECTER "Cryptoadvance Specter")
HEIGHT=$((HEIGHT+1))
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
2020-03-16 15:11:39 +01:00
fi
2020-03-24 21:16:46 -07:00
if [ "${joinmarket}" == "on" ]; then
OPTIONS+=(JMARKET "JoinMarket")
HEIGHT=$((HEIGHT+1))
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
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")
HEIGHT=$((HEIGHT+1))
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
2020-05-15 19:33:05 +02:00
fi
2020-05-18 15:25:39 +01:00
if [ "${bos}" == "on" ]; then
OPTIONS+=(BOS "Balance of Satoshis")
HEIGHT=$((HEIGHT+1))
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
2020-05-18 15:25:39 +01:00
fi
2020-10-18 13:29:17 +00:00
if [ "${pyblock}" == "on" ]; then
OPTIONS+=(PYBLOCK "PyBlock")
HEIGHT=$((HEIGHT+1))
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
2020-10-18 13:29:17 +00:00
fi
2020-06-01 11:52:40 +01:00
if [ "${thunderhub}" == "on" ]; then
OPTIONS+=(THUB "ThunderHub")
HEIGHT=$((HEIGHT+1))
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
2020-06-01 11:52:40 +01:00
fi
2020-06-14 15:46:11 +02:00
if [ "${zerotier}" == "on" ]; then
OPTIONS+=(ZEROTIER "ZeroTier")
HEIGHT=$((HEIGHT+1))
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
2020-06-14 15:46:11 +02:00
fi
if [ "${pool}" == "on" ]; then
OPTIONS+=(POOL "Lightning Pool")
HEIGHT=$((HEIGHT+1))
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
fi
2020-11-15 22:07:53 +01:00
if [ "${sphinxrelay}" == "on" ]; then
OPTIONS+=(SPHINX "Sphinx Chat Relay")
HEIGHT=$((HEIGHT+1))
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
2020-11-15 22:07:53 +01:00
fi
if [ "${chantools}" == "on" ]; then
OPTIONS+=(CHANTOOLS "ChannelTools (Fund Rescue)")
HEIGHT=$((HEIGHT+1))
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
fi
if [ "${circuitbreaker}" == "on" ]; then
OPTIONS+=(CIRCUIT "Circuitbreaker (LND firewall)")
HEIGHT=$((HEIGHT+1))
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
fi
2020-06-01 11:52:40 +01:00
2021-05-22 18:28:14 +01:00
if [ "${testnet}" == "on" ]&&[ ${chain} != test ];then
2021-05-22 11:30:56 +01:00
OPTIONS+=(TESTNET "Testnet Service Options")
HEIGHT=$((HEIGHT+1))
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
fi
2021-05-23 11:44:35 +01:00
if [ ${chain} != main ];then
2021-05-22 18:28:14 +01:00
OPTIONS+=(MAINNET "Mainnet Service Options")
HEIGHT=$((HEIGHT+1))
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
fi
2020-01-26 21:37:41 +01:00
# Basic Options
OPTIONS+=(INFO "RaspiBlitz Status Screen")
2021-05-22 15:51:22 +01:00
OPTIONS+=(LND "LND Wallet Options")
2021-05-22 18:28:14 +01:00
if [ "$cln" == "on" ]||[ $chain = test ]&&[ "$tcln" == "on" ]; then
2021-05-22 15:51:22 +01:00
OPTIONS+=(CLN "C-lightning Wallet Options")
HEIGHT=$((HEIGHT+1))
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
fi
2021-05-22 18:28:14 +01:00
2020-06-18 00:18:42 +02:00
OPTIONS+=(SETTINGS "Node Settings & Options")
OPTIONS+=(SERVICES "Additional Apps & Services")
OPTIONS+=(SYSTEM "Monitoring & Configuration")
OPTIONS+=(CONNECT "Connect Apps & Show Credentials")
2020-05-27 00:36:11 +02:00
OPTIONS+=(SUBSCRIBE "Manage Subscriptions")
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")
HEIGHT=$((HEIGHT+1))
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
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
CHOICE=$(dialog --clear \
--backtitle "$BACKTITLE" \
--title "$TITLE" \
--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) ..."
2019-04-25 02:42:45 +02:00
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
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
;;
2021-05-22 15:51:22 +01:00
LND)
/home/admin/99lndMenu.sh
;;
CLN)
/home/admin/99clnMenu.sh ${chain}net
;;
CONNECT)
/home/admin/99connectMenu.sh
;;
SYSTEM)
2021-07-18 20:07:07 +01:00
/home/admin/99systemMenu.sh ${chain}net
2018-08-21 12:30:43 +02: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
;;
LIT)
/home/admin/config.scripts/bonus.lit.sh menu
;;
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
;;
MEMPOOL)
/home/admin/config.scripts/bonus.mempool.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-10-18 13:29:17 +00: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
;;
2020-06-14 15:46:11 +02:00
ZEROTIER)
sudo /home/admin/config.scripts/bonus.zerotier.sh menu
;;
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
;;
CHANTOOLS)
sudo /home/admin/config.scripts/bonus.chantools.sh menu
;;
CIRCUIT)
sudo /home/admin/config.scripts/bonus.circuitbreaker.sh menu
2021-05-22 11:30:56 +01:00
;;
TESTNET)
2021-05-23 18:09:13 +01:00
/home/admin/00parallelChainsMenu.sh testnet
;;
2021-05-22 18:28:14 +01:00
MAINNET)
2021-05-23 18:09:13 +01:00
/home/admin/00parallelChainsMenu.sh mainnet
2021-05-22 18:28:14 +01:00
;;
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-05-05 01:16:46 +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 ""
sudo /home/admin/config.scripts/blitz.shutdown.sh reboot
2021-05-05 01:16:46 +02:00
exit 1
fi
2020-04-26 18:17:06 +02:00
;;
2018-10-18 23:38:44 +02:00
OFF)
2021-05-05 01:16:46 +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 ""
sudo /home/admin/config.scripts/blitz.shutdown.sh
2021-05-05 01:16:46 +02:00
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
sudo /home/admin/config.scripts/blitz.shutdown.sh reboot
2021-05-05 01:16:46 +02:00
exit 1
2020-02-17 14:22:33 +01:00
;;
*)
2020-02-17 14:22:33 +01:00
clear
2021-05-05 01:16:46 +02:00
exit 1
2020-02-17 14:22:33 +01:00
esac
2020-02-17 14:29:43 +01:00
2021-05-05 01:01:11 +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}