raspiblitz/home.admin/setup.scripts/dialogBlockchainLightning.sh

80 lines
2 KiB
Bash
Raw Normal View History

2021-05-21 20:23:26 -05:00
#!/bin/bash
# get basic system information
# these are the same set of infos the WebGUI dialog/controler has
source /home/admin/raspiblitz.info
# SETUPFILE
# this key/value file contains the state during the setup process
SETUPFILE="/var/cache/raspiblitz/temp/raspiblitz.setup"
source $SETUPFILE
# values to determine by dialogs
network=""
lightning=""
# chose blockchain
OPTIONS=()
OPTIONS+=(BITCOIN "Setup BITCOIN Blockchain (BitcoinCore)")
2021-05-21 20:50:00 -05:00
OPTIONS+=(LITECOIN "Setup LITECOIN Blockchain")
2021-05-21 20:23:26 -05:00
CHOICE=$(dialog --clear \
--backtitle "RaspiBlitz ${codeVersion} - Setup" \
--title "⚡ Blockchain ⚡" \
--menu "\nChoose which Blockchain to run: \n " \
2021-05-21 20:52:35 -05:00
11 64 5 \
2021-05-21 20:23:26 -05:00
"${OPTIONS[@]}" \
2>&1 >/dev/tty)
clear
case $CHOICE in
BITCOIN)
# bitcoin core
network="bitcoin"
;;
LITECOIN)
# litecoin
network="litecoin"
# can only work with LND
lightning="lnd"
;;
*)
clear
echo "User Cancel"
exit 1
esac
if [ "${network}" == "bitcoin" ]; then
# choose lightning client
OPTIONS=()
OPTIONS+=(LND "LND - Lightning Network Daemon (DEFAULT)")
OPTIONS+=(CLN "c-lightning by blockstream (fewer Apps)")
OPTIONS+=(NONE "Run without Lightning")
CHOICE=$(dialog --clear \
--backtitle "RaspiBlitz ${codeVersion} - Setup" \
--title "⚡ Lightning ⚡" \
--menu "\nChoose your Lightning Client: \n " \
13 64 7 \
"${OPTIONS[@]}" \
2>&1 >/dev/tty)
clear
case $CHOICE in
LND)
lightning="lnd"
;;
CLN)
lightning="cln"
;;
NONE)
lightning=""
;;
*)
clear
echo "User Cancel"
exit 1
esac
# write results to setup sate
echo "lightning=${lightning}" >> $SETUPFILE
echo "network=${network}" >> $SETUPFILE
exit 0