joininbox/scripts/menu.config.sh

99 lines
2.4 KiB
Bash
Raw Normal View History

#!/bin/bash
source /home/joinmarket/joinin.conf
source /home/joinmarket/_functions.sh
2021-03-02 10:23:13 +00:00
if [ "${runningEnv}" = standalone ]; then
source /home/joinmarket/standalone/_functions.standalone.sh
network=mainnet
elif [ "${runningEnv}" = raspiblitz ];then
source /mnt/hdd/raspiblitz.conf
if [ $network = bitcoin ];then
network=${chain}net
else
network=unsupported
fi
fi
# BASIC MENU INFO
2021-03-02 10:23:13 +00:00
HEIGHT=12
WIDTH=64
CHOICE_HEIGHT=20
2021-02-10 21:03:24 +00:00
TITLE="Configuration options"
MENU=""
OPTIONS=()
BACKTITLE="JoininBox GUI"
# Basic Options
2021-02-15 11:31:41 +00:00
OPTIONS+=(
JMCONF "Edit the joinmarket.cfg manually"
CONNECT "Connect to a remote bitcoin node on mainnet"
2021-03-02 10:23:13 +00:00
SIGNET "Switch to signet with a local Bitcoin Core")
if [ "${runningEnv}" = standalone ]; then
OPTIONS+=(PRUNED "Start a pruned node locally from prunednode.today")
fi
if [ -f /home/bitcoin/.bitcoin/bitcoin.conf ];then
OPTIONS+=(LOCAL "Connect to the local Bitcoin Core on $network")
fi
OPTIONS+=(RESET "Reset the joinmarket.cfg to the defaults")
CHOICE=$(dialog --clear \
--backtitle "$BACKTITLE" \
--title "$TITLE" \
--ok-label "Select" \
--cancel-label "Back" \
--menu "$MENU" \
$HEIGHT $WIDTH $CHOICE_HEIGHT \
"${OPTIONS[@]}" \
2>&1 >/dev/tty)
case $CHOICE in
JMCONF)
/home/joinmarket/install.joinmarket.sh config
echo "Returning to the menu..."
sleep 1
/home/joinmarket/menu.sh
;;
RESET)
echo "# Removing the joinmarket.cfg"
2021-03-02 10:23:13 +00:00
rm -f $JMcfgPath
generateJMconfig
echo
echo "Press ENTER to return to the menu..."
read key
;;
CONNECT)
2021-02-13 13:56:33 +00:00
/home/joinmarket/install.bitcoincore.sh signetOff
/home/joinmarket/menu.bitcoinrpc.sh
echo
echo "Press ENTER to return to the menu..."
read key
;;
SIGNET)
2021-02-13 13:56:33 +00:00
/home/joinmarket/install.bitcoincore.sh signetOn
echo
echo "Press ENTER to return to the menu..."
read key
;;
2021-03-02 10:23:13 +00:00
PRUNED)
/home/joinmarket/install.bitcoincore.sh signetOff
installBitcoinCoreStandalone
echo
downloadSnapShot
installMainnet
connectLocalNode
showBitcoinLogs
echo
echo "Press ENTER to return to the menu..."
read key
;;
LOCAL)
connectLocalNode $network
2021-03-02 14:53:57 +00:00
sudo systemctl start bitcoind
showBitcoinLogs
2021-03-02 10:23:13 +00:00
echo
echo "Press ENTER to return to the menu..."
read key
;;
esac