raspiblitz/home.admin/00settingsMenuServices.sh

447 lines
15 KiB
Bash
Raw Normal View History

#!/bin/bash
# get raspiblitz config
2019-01-18 23:38:36 +01:00
echo "get raspiblitz config"
2019-02-02 23:49:04 +01:00
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
2019-02-02 23:49:04 +01:00
2019-01-18 23:38:36 +01:00
echo "services default values"
2018-12-02 23:08:20 +01:00
if [ ${#rtlWebinterface} -eq 0 ]; then rtlWebinterface="off"; fi
if [ ${#BTCRPCexplorer} -eq 0 ]; then BTCRPCexplorer="off"; fi
2020-03-16 15:11:39 +01:00
if [ ${#specter} -eq 0 ]; then specter="off"; fi
2019-12-04 09:13:21 +01:00
if [ ${#BTCPayServer} -eq 0 ]; then BTCPayServer="off"; fi
if [ ${#ElectRS} -eq 0 ]; then ElectRS="off"; fi
2019-12-17 19:33:18 +01:00
if [ ${#lndmanage} -eq 0 ]; then lndmanage="off"; fi
2020-03-24 15:31:25 +01:00
if [ ${#joinmarket} -eq 0 ]; then joinmarket="off"; fi
2020-04-23 23:13:09 +02:00
if [ ${#LNBits} -eq 0 ]; then LNBits="off"; fi
if [ ${#mempoolExplorer} -eq 0 ]; then mempoolExplorer="off"; fi
2020-05-18 16:25:39 +02:00
if [ ${#bos} -eq 0 ]; then bos="off"; fi
2020-10-18 15:29:17 +02:00
if [ ${#pyblock} -eq 0 ]; then pyblock="off"; fi
2020-06-01 12:52:40 +02:00
if [ ${#thunderhub} -eq 0 ]; then thunderhub="off"; fi
2020-11-15 22:07:53 +01:00
if [ ${#sphinxrelay} -eq 0 ]; then sphinxrelay="off"; fi
if [ ${#lit} -eq 0 ]; then lit="off"; fi
if [ ${#whitepaper} -eq 0 ]; then whitepaper="off"; fi
if [ ${#chantools} -eq 0 ]; then chantools="off"; fi
2020-03-22 07:26:45 +01:00
# show select dialog
2019-01-18 23:38:36 +01:00
echo "run dialog ..."
2019-06-14 00:25:49 +02:00
2020-06-18 00:18:42 +02:00
OPTIONS=()
OPTIONS+=(e 'Electrum Rust Server' ${ElectRS})
OPTIONS+=(r 'RTL Webinterface' ${rtlWebinterface})
2020-06-18 00:18:42 +02:00
OPTIONS+=(t 'ThunderHub' ${thunderhub})
OPTIONS+=(l 'LIT (loop, pool, faraday)' ${lit})
OPTIONS+=(p 'BTCPayServer' ${BTCPayServer})
2020-06-18 00:18:42 +02:00
OPTIONS+=(i 'LNbits' ${LNBits})
OPTIONS+=(b 'BTC-RPC-Explorer' ${BTCRPCexplorer})
OPTIONS+=(s 'Cryptoadvance Specter' ${specter})
2021-01-12 02:22:29 +01:00
OPTIONS+=(a 'Mempool Space' ${mempoolExplorer})
2020-06-18 00:18:42 +02:00
OPTIONS+=(j 'JoinMarket' ${joinmarket})
OPTIONS+=(o 'Balance of Satoshis' ${bos})
2020-11-15 22:07:53 +01:00
OPTIONS+=(x 'Sphinx-Relay' ${sphinxrelay})
OPTIONS+=(y 'PyBLOCK' ${pyblock})
OPTIONS+=(c 'ChannelTools (Fund Rescue)' ${chantools})
OPTIONS+=(w 'Download Bitcoin Whitepaper' ${whitepaper})
2020-06-18 00:18:42 +02:00
CHOICES=$(dialog --title ' Additional Services ' \
--checklist ' use spacebar to activate/de-activate ' \
22 45 15 "${OPTIONS[@]}" 2>&1 >/dev/tty)
2019-06-14 00:25:49 +02:00
2018-10-16 00:04:20 +02:00
dialogcancel=$?
2019-01-18 23:38:36 +01:00
echo "done dialog"
clear
# check if user canceled dialog
2019-01-18 23:38:36 +01:00
echo "dialogcancel(${dialogcancel})"
2018-10-16 00:04:20 +02:00
if [ ${dialogcancel} -eq 1 ]; then
echo "user canceled"
exit 1
elif [ ${dialogcancel} -eq 255 ]; then
echo "ESC pressed"
exit 1
fi
2018-12-01 20:25:33 +01:00
needsReboot=0
2019-02-11 19:59:09 +01:00
anychange=0
2018-12-01 20:25:33 +01:00
2018-12-02 19:52:01 +01:00
# RTL process choice
2020-06-18 00:43:39 +02:00
choice="off"; check=$(echo "${CHOICES}" | grep -c "r")
2018-12-02 19:52:01 +01:00
if [ ${check} -eq 1 ]; then choice="on"; fi
if [ "${rtlWebinterface}" != "${choice}" ]; then
echo "RTL Webinterface Setting changed .."
2019-02-18 11:32:27 +01:00
anychange=1
/home/admin/config.scripts/bonus.rtl.sh ${choice}
2019-03-13 18:13:49 +01:00
errorOnInstall=$?
2018-12-03 23:25:55 +01:00
if [ "${choice}" = "on" ]; then
2019-03-13 18:13:49 +01:00
if [ ${errorOnInstall} -eq 0 ]; then
sudo systemctl start RTL
2020-01-26 23:41:28 +01:00
echo "waiting 10 secs .."
sleep 10
2020-01-26 23:35:02 +01:00
/home/admin/config.scripts/bonus.rtl.sh menu
2019-03-13 18:13:49 +01:00
else
l1="!!! FAIL on RTL install !!!"
l2="Try manual install on terminal after reboot with:"
l3="/home/admin/config.scripts/bonus.rtl.sh on"
dialog --title 'FAIL' --msgbox "${l1}\n${l2}\n${l3}" 7 65
2019-03-13 18:13:49 +01:00
fi
2018-12-02 19:52:01 +01:00
fi
2018-12-02 23:50:14 +01:00
else
2018-12-02 19:52:01 +01:00
echo "RTL Webinterface Setting unchanged."
2018-12-01 22:24:32 +01:00
fi
# BTC-RPC-Explorer process choice
choice="off"; check=$(echo "${CHOICES}" | grep -c "b")
if [ ${check} -eq 1 ]; then choice="on"; fi
if [ "${BTCRPCexplorer}" != "${choice}" ]; then
echo "RTL Webinterface Setting changed .."
anychange=1
/home/admin/config.scripts/bonus.btc-rpc-explorer.sh ${choice}
errorOnInstall=$?
if [ "${choice}" = "on" ]; then
if [ ${errorOnInstall} -eq 0 ]; then
sudo sytemctl start btc-rpc-explorer
2020-01-27 02:26:45 +01:00
whiptail --title " Installed BTC-RPC-Explorer " --msgbox "\
The txindex may need to be created before BTC-RPC-Explorer can be active.\n
This can take ~7 hours on a RPi4 with SSD. Monitor the progress on the LCD.\n
When finished use the new 'EXPLORE' entry in Main Menu for more info.\n
" 14 50
2020-01-23 11:20:43 +01:00
needsReboot=1
else
l1="!!! FAIL on BTC-RPC-Explorer install !!!"
l2="Try manual install on terminal after reboot with:"
l3="/home/admin/config.scripts/bonus.btc-rpc-explorer.sh on"
dialog --title 'FAIL' --msgbox "${l1}\n${l2}\n${l3}" 7 65
fi
fi
else
echo "BTC-RPC-Explorer Setting unchanged."
fi
2020-03-16 15:11:39 +01:00
# cryptoadvance Specter process choice
choice="off"; check=$(echo "${CHOICES}" | grep -c "s")
if [ ${check} -eq 1 ]; then choice="on"; fi
if [ "${specter}" != "${choice}" ]; then
echo "Cryptoadvance Specter Setting changed .."
anychange=1
/home/admin/config.scripts/bonus.cryptoadvance-specter.sh ${choice}
errorOnInstall=$?
if [ "${choice}" = "on" ]; then
if [ ${errorOnInstall} -eq 0 ]; then
sudo systemctl start cryptoadvance-specter
2020-03-16 15:11:39 +01:00
/home/admin/config.scripts/bonus.cryptoadvance-specter.sh menu
else
l1="!!! FAIL on Cryptoadvance Specter install !!!"
l2="Try manual install on terminal after reboot with:"
l3="/home/admin/config.scripts/bonus.cryptoadvance-specter.sh on"
dialog --title 'FAIL' --msgbox "${l1}\n${l2}\n${l3}" 7 65
fi
fi
else
echo "Cryptoadvance Specter Setting unchanged."
fi
# ElectRS process choice
choice="off"; check=$(echo "${CHOICES}" | grep -c "e")
if [ ${check} -eq 1 ]; then choice="on"; fi
if [ "${ElectRS}" != "${choice}" ]; then
echo "ElectRS Setting changed .."
anychange=1
2020-01-27 23:55:12 +01:00
extraparameter=""
if [ "${choice}" = "on" ]; then
# check on HDD size
source <(sudo /home/admin/config.scripts/blitz.datadrive.sh status)
if [ ${hddGigaBytes} -lt 800 ]; then
whiptail --title " HDD/SSD TOO SMALL " --msgbox "\
Since v1.5 we recommend at least a 1TB HDD/SSD if you want to run ElectRS.\n
This is due to the eletcrum index that will grow over time and needs space.\n
To migrate to a bigger HDD/SSD check RaspiBlitz README on 'migration'.\n
" 14 50
else
/home/admin/config.scripts/bonus.electrs.sh on ${extraparameter}
errorOnInstall=$?
if [ ${errorOnInstall} -eq 0 ]; then
sudo systemctl start electrs
whiptail --title " Installed ElectRS Server " --msgbox "\
The index database needs to be created before Electrum Server can be used.\n
This can take hours/days depending on your RaspiBlitz. Monitor the progress on the LCD.\n
When finished use the new 'ELECTRS' entry in Main Menu for more info.\n
" 14 50
2020-11-25 14:49:50 +01:00
needsReboot=1
else
l1="!!! FAIL on ElectRS install !!!"
l2="Try manual install on terminal after reboot with:"
l3="/home/admin/config.scripts/bonus.electrs.sh on"
dialog --title 'FAIL' --msgbox "${l1}\n${l2}\n${l3}" 7 65
fi
fi
fi
2020-01-27 23:55:12 +01:00
if [ "${choice}" = "off" ]; then
whiptail --title "Delete Electrum Index?" \
--yes-button "Keep Index" \
--no-button "Delete Index" \
--yesno "ElectRS is getting uninstalled. Do you also want to delete the Electrum Index? It contains no important data, but can take multiple hours to rebuild if needed again." 10 60
if [ $? -eq 1 ]; then
extraparameter="deleteindex"
fi
/home/admin/config.scripts/bonus.electrs.sh off ${extraparameter}
fi
else
echo "ElectRS Setting unchanged."
fi
2019-12-04 09:13:21 +01:00
# BTCPayServer process choice
choice="off"; check=$(echo "${CHOICES}" | grep -c "p")
if [ ${check} -eq 1 ]; then choice="on"; fi
if [ "${BTCPayServer}" != "${choice}" ]; then
echo "BTCPayServer setting changed .."
2020-03-23 06:47:36 +01:00
# check if TOR is installed
source /mnt/hdd/raspiblitz.conf
2020-03-23 07:34:26 +01:00
if [ "${choice}" = "on" ] && [ "${runBehindTor}" = "off" ]; then
2020-03-23 06:47:36 +01:00
whiptail --title " BTCPayServer needs TOR " --msgbox "\
At the moment the BTCPayServer on the RaspiBlitz needs TOR.\n
2020-03-23 07:36:57 +01:00
Please activate TOR in SERVICES first.\n
2020-03-23 07:15:27 +01:00
Then try activating BTCPayServer again in SERVICES.\n
2020-03-23 07:36:57 +01:00
" 13 42
2020-03-23 06:47:36 +01:00
else
anychange=1
/home/admin/config.scripts/bonus.btcpayserver.sh ${choice} tor
errorOnInstall=$?
if [ "${choice}" = "on" ]; then
if [ ${errorOnInstall} -eq 0 ]; then
source /home/btcpay/.btcpayserver/Main/settings.config
2020-03-23 07:34:26 +01:00
whiptail --title " Installed BTCPay Server " --msgbox "\
2020-01-27 06:44:10 +01:00
BTCPay server was installed.\n
Use the new 'BTCPay' entry in Main Menu for more info.\n
" 10 35
2020-03-23 06:47:36 +01:00
else
l1="BTCPayServer installation is cancelled"
l2="Try again from the menu or install from the terminal with:"
l3="/home/admin/config.scripts/bonus.btcpayserver.sh on"
dialog --title 'FAIL' --msgbox "${l1}\n${l2}\n${l3}" 7 65
fi
2019-12-04 09:13:21 +01:00
fi
fi
else
echo "BTCPayServer setting not changed."
fi
2019-12-17 19:33:18 +01:00
# LNDMANAGE process choice
choice="off"; check=$(echo "${CHOICES}" | grep -c "m")
if [ ${check} -eq 1 ]; then choice="on"; fi
if [ "${lndmanage}" != "${choice}" ]; then
echo "lndmanage Setting changed .."
anychange=1
2020-01-20 23:12:55 +01:00
sudo -u admin /home/admin/config.scripts/bonus.lndmanage.sh ${choice}
2020-02-19 17:05:07 +01:00
source /mnt/hdd/raspiblitz.conf
if [ "${lndmanage}" = "on" ]; then
2020-01-26 22:30:26 +01:00
sudo -u admin /home/admin/config.scripts/bonus.lndmanage.sh menu
fi
else
2019-12-17 19:33:18 +01:00
echo "lndmanage setting unchanged."
fi
# CHANTOOLS process choice
choice="off"; check=$(echo "${CHOICES}" | grep -c "c")
if [ ${check} -eq 1 ]; then choice="on"; fi
if [ "${chantools}" != "${choice}" ]; then
echo "chantools Setting changed .."
anychange=1
sudo -u admin /home/admin/config.scripts/bonus.chantools.sh ${choice}
source /mnt/hdd/raspiblitz.conf
if [ "${chantools}" = "on" ]; then
sudo -u admin /home/admin/config.scripts/bonus.chantools.sh menu
fi
else
echo "chantools setting unchanged."
fi
2020-05-18 16:25:39 +02:00
# Balance of Satoshis process choice
choice="off"; check=$(echo "${CHOICES}" | grep -c "o")
if [ ${check} -eq 1 ]; then choice="on"; fi
if [ "${bos}" != "${choice}" ]; then
echo "Balance of Satoshis Setting changed .."
anychange=1
sudo -u admin /home/admin/config.scripts/bonus.bos.sh ${choice}
source /mnt/hdd/raspiblitz.conf
if [ "${bos}" = "on" ]; then
2020-06-01 12:52:40 +02:00
sudo -u admin /home/admin/config.scripts/bonus.bos.sh menu
2020-05-18 16:25:39 +02:00
fi
else
2020-05-18 16:25:39 +02:00
echo "Balance of Satoshis setting unchanged."
fi
2020-10-18 15:29:17 +02:00
# PyBLOCK process choice
choice="off"; check=$(echo "${CHOICES}" | grep -c "y")
if [ ${check} -eq 1 ]; then choice="on"; fi
if [ "${pyblock}" != "${choice}" ]; then
echo "PyBLOCK Setting changed .."
anychange=1
sudo -u admin /home/admin/config.scripts/bonus.pyblock.sh ${choice}
source /mnt/hdd/raspiblitz.conf
if [ "${pyblock}" = "on" ]; then
sudo -u admin /home/admin/config.scripts/bonus.pyblock.sh menu
fi
else
echo "PyBLOCK setting unchanged."
fi
2020-06-01 12:52:40 +02:00
# thunderhub process choice
2020-06-02 19:18:57 +02:00
choice="off"; check=$(echo "${CHOICES}" | grep -c "t")
2020-06-01 12:52:40 +02:00
if [ ${check} -eq 1 ]; then choice="on"; fi
if [ "${thunderhub}" != "${choice}" ]; then
echo "ThunderHub Setting changed .."
2020-06-01 12:52:40 +02:00
anychange=1
/home/admin/config.scripts/bonus.thunderhub.sh ${choice}
errorOnInstall=$?
if [ "${choice}" = "on" ]; then
if [ ${errorOnInstall} -eq 0 ]; then
sudo systemctl start thunderhub
echo "waiting 10 secs .."
sleep 10
/home/admin/config.scripts/bonus.thunderhub.sh menu
else
l1="!!! FAIL on ThunderHub install !!!"
l2="Try manual install on terminal after reboot with:"
l3="/home/admin/config.scripts/bonus.thunderhub.sh on"
dialog --title 'FAIL' --msgbox "${l1}\n${l2}\n${l3}" 7 65
fi
2020-06-01 12:52:40 +02:00
fi
2020-06-14 16:03:16 +02:00
else
2020-06-01 12:52:40 +02:00
echo "ThunderHub setting unchanged."
fi
# LNbits process choice
2020-02-10 20:46:23 +01:00
choice="off"; check=$(echo "${CHOICES}" | grep -c "i")
2020-02-10 20:44:41 +01:00
if [ ${check} -eq 1 ]; then choice="on"; fi
2020-04-23 23:10:30 +02:00
if [ "${LNBits}" != "${choice}" ]; then
echo "LNbits Setting changed .."
2020-02-10 20:44:41 +01:00
anychange=1
sudo -u admin /home/admin/config.scripts/bonus.lnbits.sh ${choice}
if [ "${choice}" = "on" ]; then
2020-02-10 21:43:35 +01:00
sudo systemctl start lnbits
2020-02-10 20:44:41 +01:00
sudo -u admin /home/admin/config.scripts/bonus.lnbits.sh menu
fi
else
2020-04-28 09:45:14 +02:00
echo "LNbits setting unchanged."
2020-02-10 20:44:41 +01:00
fi
# LIT (Lightning Terminal)
choice="off"; check=$(echo "${CHOICES}" | grep -c "l")
if [ ${check} -eq 1 ]; then choice="on"; fi
if [ "${lit}" != "${choice}" ]; then
echo "LIT Setting changed .."
anychange=1
sudo -u admin /home/admin/config.scripts/bonus.lit.sh ${choice}
if [ "${choice}" = "on" ]; then
sudo systemctl start lnbits
sudo -u admin /home/admin/config.scripts/bonus.lit.sh menu
fi
else
echo "LIT setting unchanged."
fi
2020-11-15 22:07:53 +01:00
# Sphinx Relay
choice="off"; check=$(echo "${CHOICES}" | grep -c "x")
if [ ${check} -eq 1 ]; then choice="on"; fi
if [ "${sphinxrelay}" != "${choice}" ]; then
echo "Sphinx-Relay Setting changed .."
anychange=1
sudo -u admin /home/admin/config.scripts/bonus.sphinxrelay.sh ${choice}
if [ "${choice}" = "on" ]; then
2020-12-18 22:10:36 +01:00
whiptail --title " Installed Sphinx Server" --msgbox "\
Sphinx Server was installed.\n
Use the new 'SPHINX' entry in Main Menu for more info.\n
" 10 35
2020-11-15 22:07:53 +01:00
fi
else
echo "Sphinx Relay unchanged."
fi
2020-03-24 15:31:25 +01:00
# JoinMarket process choice
choice="off"; check=$(echo "${CHOICES}" | grep -c "j")
if [ ${check} -eq 1 ]; then choice="on"; fi
if [ "${joinmarket}" != "${choice}" ]; then
echo "JoinMarket setting changed .."
# check if TOR is installed
source /mnt/hdd/raspiblitz.conf
if [ "${choice}" = "on" ] && [ "${runBehindTor}" = "off" ]; then
whiptail --title " Use Tor with JoinMarket" --msgbox "\
It is highly recommended to use Tor with JoinMarket.\n
Please activate TOR in SERVICES first.\n
Then try activating JoinMarket again in SERVICES.\n
" 13 42
else
anychange=1
sudo /home/admin/config.scripts/bonus.joinmarket.sh ${choice}
errorOnInstall=$?
if [ "${choice}" = "on" ]; then
if [ ${errorOnInstall} -eq 0 ]; then
sudo /home/admin/config.scripts/bonus.joinmarket.sh menu
else
2020-03-25 05:05:15 +01:00
whiptail --title 'FAIL' --msgbox "JoinMarket installation is cancelled\nTry again from the menu or install from the terminal with:\nsudo /home/admin/config.scripts/bonus.joinmarket.sh on" 9 65
2020-03-24 15:31:25 +01:00
fi
fi
fi
else
echo "JoinMarket not changed."
fi
# Mempool process choice
choice="off"; check=$(echo "${CHOICES}" | grep -c "a")
if [ ${check} -eq 1 ]; then choice="on"; fi
if [ "${mempoolExplorer}" != "${choice}" ]; then
echo "Mempool Explorer settings changed .."
anychange=1
/home/admin/config.scripts/bonus.mempool.sh ${choice}
errorOnInstall=$?
if [ "${choice}" = "on" ]; then
if [ ${errorOnInstall} -eq 0 ]; then
sudo systemctl start mempool
whiptail --title " Installed Mempool Space " --msgbox "\
The txindex may need to be created before Mempool can be active.\n
This can take ~7 hours on a RPi4 with SSD. Monitor the progress on the LCD.\n
2020-10-30 13:29:26 +01:00
When finished use the new 'MEMPOOL' entry in Main Menu for more info.\n
" 14 50
else
l1="!!! FAIL on Mempool Explorer install !!!"
l2="Try manual install on terminal after reboot with:"
l3="/home/admin/config.scripts/bonus.mempool.sh on"
dialog --title 'FAIL' --msgbox "${l1}\n${l2}\n${l3}" 7 65
fi
fi
else
echo "Mempool Explorer Setting unchanged."
fi
# Whitepaper process choice
choice="off"; check=$(echo "${CHOICES}" | grep -c "w")
if [ ${check} -eq 1 ]; then choice="on"; fi
if [ "${whitepaper}" != "${choice}" ]; then
echo "Whitepaper setting changed .."
anychange=1
sudo -u admin /home/admin/config.scripts/bonus.whitepaper.sh ${choice}
source /mnt/hdd/raspiblitz.conf
if [ "${whitepaper}" = "on" ]; then
sudo -u admin /home/admin/config.scripts/bonus.whitepaper.sh menu
fi
else
echo "Whitepaper setting unchanged."
fi
2019-02-11 20:06:19 +01:00
if [ ${anychange} -eq 0 ]; then
2019-07-29 00:49:00 +02:00
dialog --msgbox "NOTHING CHANGED!\nUse Spacebar to check/uncheck services." 8 58
2019-02-11 20:06:19 +01:00
exit 0
2019-02-11 19:59:09 +01:00
fi
2018-12-01 20:25:33 +01:00
if [ ${needsReboot} -eq 1 ]; then
2018-12-02 19:52:01 +01:00
sleep 2
2018-12-24 14:57:47 +01:00
dialog --pause "OK. System will reboot to activate changes." 8 58 8
2019-01-17 23:12:30 +01:00
clear
2018-12-24 14:57:47 +01:00
echo "rebooting .. (please wait)"
2019-01-28 16:55:51 +01:00
# stop bitcoind
sudo -u bitcoin ${network}-cli stop
sleep 4
2019-12-11 14:03:52 +01:00
sudo /home/admin/XXshutdown.sh reboot
2019-03-28 03:51:46 +01:00
fi