You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

105 lines
2.7 KiB

6 years ago
#!/bin/bash
## default menu settings
HEIGHT=11
6 years ago
WIDTH=64
CHOICE_HEIGHT=4
BACKTITLE="RaspiBlitz"
TITLE=""
MENU="Choose one of the following options:"
OPTIONS=()
## get actual setup state
setupState=0;
if [ -f "/home/admin/.setup" ]; then
setupState=$( cat /home/admin/.setup )
fi
if [ ${setupState} -eq 0 ]; then
# start setup
BACKTITLE="RaspiBlitz - Setup"
6 years ago
TITLE="⚡ Welcome to your RaspiBlitz ⚡"
MENU="\nYou need to setup and init Bitcoin and Lightning services: \n "
OPTIONS+=(1 "Start the Setup of your RaspiBlitz")
6 years ago
HEIGHT=10
elif [ ${setupState} -lt 100 ]; then
# continue setup
BACKTITLE="RaspiBlitz - Setup"
6 years ago
TITLE="⚡ Welcome to your RaspiBlitz ⚡"
MENU="\nContinue setup and init of Bitcoin and Lightning services: \n "
OPTIONS+=(1 "Continue Setup of your RaspiBlitz")
6 years ago
HEIGHT=10
else
# make sure to have a init pause aufter fresh boot
uptimesecs=$(awk '{print $1}' /proc/uptime | awk '{print int($1)}')
waittimesecs=$(expr 150 - $uptimesecs)
if [ ${waittimesecs} -gt 0 ]; then
dialog --pause " Waiting for Bitcoin to startup and init ..." 8 58 ${waittimesecs}
fi
# MAIN MENU AFTER SETUP
chain=$(bitcoin-cli -datadir=/home/bitcoin/.bitcoin getblockchaininfo | jq -r '.chain')
locked=$(sudo tail -n 1 /mnt/hdd/lnd/logs/bitcoin/${chain}net/lnd.log | grep -c unlock)
if [ ${locked} -gt 0 ]; then
# LOCK SCREEN
MENU="!!! YOUR WALLET IS LOCKED !!!"
OPTIONS+=(X "Unlock your Lightning Wallet with 'lncli unlock'")
else
# REGULAR MENU
OPTIONS+=(INFO "RaspiBlitz Status Screen" \
lnbalance "Detailed Wallet Balances" \
lnchannels "Lightning Channel List")
6 years ago
fi
fi
CHOICE=$(dialog --clear \
--backtitle "$BACKTITLE" \
--title "$TITLE" \
--menu "$MENU" \
$HEIGHT $WIDTH $CHOICE_HEIGHT \
"${OPTIONS[@]}" \
2>&1 >/dev/tty)
clear
case $CHOICE in
CLOSE)
exit 1;
;;
1) # SETUP
./10setupBlitz.sh
exit 1;
;;
INFO)
./00infoBlitz.sh
echo "Screen is not updating ... press ENTER to continue."
read key
./00mainMenu.sh
;;
lnbalance)
lnbalance
echo "Press ENTER to return to main menu."
read key
./00mainMenu.sh
;;
lnchannels)
lnchannels
echo "Press ENTER to return to main menu."
read key
./00mainMenu.sh
6 years ago
;;
X) # unlock
./AAunlockLND.sh
./00mainMenu.sh
6 years ago
;;
esac