2021-02-09 17:05:39 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
source /home/joinmarket/joinin.conf
|
|
|
|
|
source /home/joinmarket/_functions.sh
|
|
|
|
|
|
2021-11-30 19:37:02 +00:00
|
|
|
if [ ${#network} -eq 0 ] || [ "${network}" = "unknown" ] ;then
|
|
|
|
|
if [ "${runningEnv}" = standalone ]; then
|
|
|
|
|
source /home/joinmarket/standalone/_functions.standalone.sh
|
|
|
|
|
network=mainnet
|
|
|
|
|
elif [ "${runningEnv}" = mynode ];then
|
|
|
|
|
network=mainnet
|
|
|
|
|
elif [ "${runningEnv}" = raspiblitz ];then
|
|
|
|
|
source /mnt/hdd/raspiblitz.conf
|
|
|
|
|
if [ $network = bitcoin ];then
|
|
|
|
|
network=${chain}net
|
|
|
|
|
else
|
|
|
|
|
network=unsupported
|
|
|
|
|
fi
|
2021-03-02 10:23:13 +00:00
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
2022-03-02 22:09:50 +03:00
|
|
|
if [ "$runningEnv" = "standalone" ] && [ "$setupStep" -lt 100 ]; then
|
2021-03-21 00:31:58 +00:00
|
|
|
echo "# Open the startup menu on the first start"
|
|
|
|
|
sudo sed -i "s#setupStep=.*#setupStep=100#g" $joininConfPath
|
2021-02-09 17:05:39 +00:00
|
|
|
|
2021-03-21 00:31:58 +00:00
|
|
|
# BASIC MENU INFO
|
2021-03-22 12:11:27 +00:00
|
|
|
HEIGHT=16
|
2023-06-15 20:32:41 +00:00
|
|
|
WIDTH=68
|
2021-03-21 16:36:30 +00:00
|
|
|
CHOICE_HEIGHT=24
|
2021-03-21 00:31:58 +00:00
|
|
|
TITLE="Startup options"
|
|
|
|
|
MENU="
|
2021-03-22 12:11:27 +00:00
|
|
|
Welcome to JoininBox $currentJBcommit
|
2021-03-21 16:36:30 +00:00
|
|
|
Choose from the options:"
|
2021-03-21 00:31:58 +00:00
|
|
|
OPTIONS=()
|
|
|
|
|
BACKTITLE="JoininBox GUI"
|
2021-03-21 16:36:30 +00:00
|
|
|
CANCELLABEL="Main menu"
|
2021-03-21 00:31:58 +00:00
|
|
|
|
|
|
|
|
OPTIONS+=(
|
|
|
|
|
CONNECT "Connect to a remote bitcoin node on mainnet"
|
|
|
|
|
SIGNET "Start on signet with a local Bitcoin Core"
|
2023-06-15 20:32:41 +00:00
|
|
|
PRUNED "Start a pruned node from pruned.host4coins.net/blocks")
|
2021-03-21 00:31:58 +00:00
|
|
|
if [ -f /home/bitcoin/.bitcoin/bitcoin.conf ];then
|
|
|
|
|
OPTIONS+=(
|
2021-11-30 19:37:02 +00:00
|
|
|
LOCAL "Connect to the local Bitcoin Core on mainnet")
|
2021-03-21 00:31:58 +00:00
|
|
|
HEIGHT=$((HEIGHT+1))
|
|
|
|
|
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
|
|
|
|
|
fi
|
|
|
|
|
OPTIONS+=(
|
|
|
|
|
"" ""
|
|
|
|
|
JMCONF "Edit the joinmarket.cfg manually"
|
|
|
|
|
"" ""
|
|
|
|
|
UPDATE "Update JoininBox or JoinMarket")
|
2021-03-02 10:23:13 +00:00
|
|
|
|
2021-03-21 00:31:58 +00:00
|
|
|
else
|
|
|
|
|
# BASIC MENU INFO
|
|
|
|
|
HEIGHT=12
|
2023-06-15 20:32:41 +00:00
|
|
|
WIDTH=68
|
2021-03-21 00:31:58 +00:00
|
|
|
CHOICE_HEIGHT=20
|
|
|
|
|
TITLE="Configuration options"
|
|
|
|
|
MENU=""
|
|
|
|
|
OPTIONS=()
|
|
|
|
|
BACKTITLE="JoininBox GUI"
|
2021-03-21 16:36:30 +00:00
|
|
|
CANCELLABEL="Back"
|
2021-03-21 00:31:58 +00:00
|
|
|
|
|
|
|
|
# Basic Options
|
|
|
|
|
OPTIONS+=(
|
|
|
|
|
JMCONF "Edit the joinmarket.cfg manually"
|
|
|
|
|
"" ""
|
|
|
|
|
CONNECT "Connect to a remote bitcoin node on mainnet"
|
|
|
|
|
SIGNET "Switch to signet with a local Bitcoin Core")
|
|
|
|
|
if [ "${runningEnv}" = standalone ]; then
|
|
|
|
|
OPTIONS+=(
|
2023-06-15 20:32:41 +00:00
|
|
|
PRUNED "Start a pruned node from pruned.host4coins.net/blocks")
|
2021-03-21 00:31:58 +00:00
|
|
|
HEIGHT=$((HEIGHT+1))
|
|
|
|
|
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
|
|
|
|
|
fi
|
|
|
|
|
if [ -f /home/bitcoin/.bitcoin/bitcoin.conf ];then
|
|
|
|
|
OPTIONS+=(
|
2021-12-02 09:27:59 +00:00
|
|
|
LOCAL "Connect to the local Bitcoin Core on mainnet"
|
2021-03-21 00:31:58 +00:00
|
|
|
"" ""
|
|
|
|
|
BTCCONF "Edit the local bitcoin.conf")
|
|
|
|
|
HEIGHT=$((HEIGHT+3))
|
|
|
|
|
CHOICE_HEIGHT=$((CHOICE_HEIGHT+3))
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
OPTIONS+=(
|
|
|
|
|
"" ""
|
|
|
|
|
RESET "Reset the joinmarket.cfg to the defaults")
|
|
|
|
|
fi
|
2021-02-09 17:05:39 +00:00
|
|
|
|
|
|
|
|
CHOICE=$(dialog --clear \
|
|
|
|
|
--backtitle "$BACKTITLE" \
|
|
|
|
|
--title "$TITLE" \
|
2021-03-04 11:21:57 +00:00
|
|
|
--ok-label "Select" \
|
2021-03-21 16:36:30 +00:00
|
|
|
--cancel-label "$CANCELLABEL" \
|
2021-02-09 17:05:39 +00:00
|
|
|
--menu "$MENU" \
|
|
|
|
|
$HEIGHT $WIDTH $CHOICE_HEIGHT \
|
|
|
|
|
"${OPTIONS[@]}" \
|
|
|
|
|
2>&1 >/dev/tty)
|
|
|
|
|
|
|
|
|
|
case $CHOICE in
|
|
|
|
|
JMCONF)
|
2022-04-10 09:16:43 +01:00
|
|
|
/home/joinmarket/install.joinmarket.sh -i config
|
2021-02-09 17:05:39 +00:00
|
|
|
echo "Returning to the menu..."
|
|
|
|
|
sleep 1
|
2021-03-21 00:31:58 +00:00
|
|
|
/home/joinmarket/menu.sh;;
|
2021-02-09 18:33:24 +00:00
|
|
|
RESET)
|
|
|
|
|
echo "# Removing the joinmarket.cfg"
|
2021-03-02 10:23:13 +00:00
|
|
|
rm -f $JMcfgPath
|
2021-02-09 18:33:24 +00:00
|
|
|
generateJMconfig
|
2022-03-02 18:36:01 +03:00
|
|
|
echo
|
2021-02-09 18:36:30 +00:00
|
|
|
echo "Press ENTER to return to the menu..."
|
2021-03-21 00:31:58 +00:00
|
|
|
read key;;
|
2021-02-09 17:05:39 +00:00
|
|
|
CONNECT)
|
2021-02-13 13:56:33 +00:00
|
|
|
/home/joinmarket/install.bitcoincore.sh signetOff
|
2021-02-09 17:05:39 +00:00
|
|
|
/home/joinmarket/menu.bitcoinrpc.sh
|
2022-08-15 16:54:33 +01:00
|
|
|
# set joinin.conf value
|
|
|
|
|
/home/joinmarket/set.value.sh set network mainnet ${joininConfPath}
|
2022-03-02 18:36:01 +03:00
|
|
|
echo
|
2021-02-09 17:05:39 +00:00
|
|
|
echo "Press ENTER to return to the menu..."
|
2021-03-21 00:31:58 +00:00
|
|
|
read key;;
|
2021-02-09 17:05:39 +00:00
|
|
|
SIGNET)
|
2022-08-15 16:54:33 +01:00
|
|
|
/home/joinmarket/install.bitcoincore.sh signetOn
|
2022-03-02 18:36:01 +03:00
|
|
|
echo
|
2021-02-09 17:05:39 +00:00
|
|
|
echo "Press ENTER to return to the menu..."
|
2021-03-21 00:31:58 +00:00
|
|
|
read key;;
|
2021-03-02 10:23:13 +00:00
|
|
|
PRUNED)
|
|
|
|
|
installBitcoinCoreStandalone
|
|
|
|
|
echo
|
|
|
|
|
downloadSnapShot
|
|
|
|
|
installMainnet
|
|
|
|
|
connectLocalNode
|
|
|
|
|
showBitcoinLogs
|
2022-03-02 18:36:01 +03:00
|
|
|
echo
|
2021-03-02 10:23:13 +00:00
|
|
|
echo "Press ENTER to return to the menu..."
|
2021-03-21 00:31:58 +00:00
|
|
|
read key;;
|
2021-03-02 10:23:13 +00:00
|
|
|
LOCAL)
|
2021-11-30 19:37:02 +00:00
|
|
|
connectLocalNode mainnet
|
2021-03-02 14:53:57 +00:00
|
|
|
sudo systemctl start bitcoind
|
|
|
|
|
showBitcoinLogs
|
2022-03-02 18:36:01 +03:00
|
|
|
echo
|
2021-03-02 10:23:13 +00:00
|
|
|
echo "Press ENTER to return to the menu..."
|
2021-03-21 00:31:58 +00:00
|
|
|
read key;;
|
|
|
|
|
BTCCONF)
|
2022-08-15 16:54:33 +01:00
|
|
|
if [ ${#network} -eq 0 ] || [ ${network} = "mainnet" ] || [ "${runningEnv}" = "raspiblitz" ]; then
|
|
|
|
|
bitcoinUser="bitcoin"
|
|
|
|
|
elif [ ${network} = "signet" ]; then
|
|
|
|
|
bitcoinUser="joinmarket"
|
|
|
|
|
fi
|
|
|
|
|
if /home/joinmarket/set.conf.sh "/home/${bitcoinUser}/.bitcoin/bitcoin.conf" "${bitcoinUser}"
|
2021-03-21 00:31:58 +00:00
|
|
|
then
|
|
|
|
|
echo "# Restarting bitcoind"
|
|
|
|
|
sudo systemctl restart bitcoind
|
|
|
|
|
showBitcoinLogs
|
|
|
|
|
else
|
|
|
|
|
echo "# No change made"
|
|
|
|
|
fi;;
|
|
|
|
|
UPDATE)
|
|
|
|
|
/home/joinmarket/menu.update.sh
|
2022-03-02 18:36:01 +03:00
|
|
|
/home/joinmarket/menu.sh;;
|
2021-02-09 17:05:39 +00:00
|
|
|
esac
|