2018-10-15 14:43:09 +02:00
#!/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
2018-10-15 14:43:09 +02:00
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 [ ${# autoPilot } -eq 0 ] ; then autoPilot = "off" ; fi
2019-12-14 02:26:10 +01:00
if [ ${# loop } -eq 0 ] ; then loop = "off" ; fi
2018-12-22 16:44:15 +01:00
if [ ${# autoUnlock } -eq 0 ] ; then autoUnlock = "off" ; fi
2018-12-02 23:08:20 +01:00
if [ ${# runBehindTor } -eq 0 ] ; then runBehindTor = "off" ; fi
if [ ${# rtlWebinterface } -eq 0 ] ; then rtlWebinterface = "off" ; fi
2019-11-24 14:12:55 +01:00
if [ ${# BTCRPCexplorer } -eq 0 ] ; then BTCRPCexplorer = "off" ; fi
2018-12-02 23:08:20 +01:00
if [ ${# chain } -eq 0 ] ; then chain = "main" ; fi
2019-06-13 16:50:06 +02:00
if [ ${# autoNatDiscovery } -eq 0 ] ; then autoNatDiscovery = "off" ; fi
2019-06-13 18:03:17 +02:00
if [ ${# networkUPnP } -eq 0 ] ; then networkUPnP = "off" ; fi
2019-07-03 04:17:31 +02:00
if [ ${# touchscreen } -eq 0 ] ; then touchscreen = 0; fi
2019-07-29 00:45:35 +02:00
if [ ${# lcdrotate } -eq 0 ] ; then lcdrotate = 0; fi
2019-12-04 09:13:21 +01:00
if [ ${# BTCPayServer } -eq 0 ] ; then BTCPayServer = "off" ; fi
2019-12-04 12:18:56 +01:00
if [ ${# ElectRS } -eq 0 ] ; then ElectRS = "off" ; fi
2019-12-17 19:33:18 +01:00
if [ ${# lndmanage } -eq 0 ] ; then lndmanage = "off" ; fi
2018-12-02 23:08:20 +01:00
2019-01-18 23:38:36 +01:00
echo "map chain to on/off"
2018-12-02 23:08:20 +01:00
chainValue = "off"
if [ " ${ chain } " = "test" ] ; then chainValue = "on" ; fi
2018-10-15 14:43:09 +02:00
2019-01-18 23:38:36 +01:00
echo "map domain to on/off"
2018-12-20 14:13:42 +01:00
domainValue = "off"
2018-12-21 01:28:42 +01:00
dynDomainMenu = 'DynamicDNS'
2018-12-21 00:47:46 +01:00
if [ ${# dynDomain } -gt 0 ] ; then
domainValue = "on"
2018-12-21 00:50:01 +01:00
dynDomainMenu = " ${ dynDomain } "
2018-12-21 00:47:46 +01:00
fi
2018-12-20 14:13:42 +01:00
2019-07-29 00:59:51 +02:00
echo "map lcdrotate to on/off"
lcdrotateMenu = 'off'
if [ ${ lcdrotate } -gt 0 ] ; then
lcdrotateMenu = 'on'
fi
2019-07-03 04:03:40 +02:00
echo "map touchscreen to on/off"
2020-01-16 15:50:58 +01:00
touchscreenMenu = 'off'
2019-07-03 04:25:18 +02:00
if [ ${ touchscreen } -gt 0 ] ; then
2020-01-16 15:50:58 +01:00
touchscreenMenu = 'on'
2019-07-03 04:03:40 +02:00
fi
2019-01-21 21:47:16 +01:00
echo "check autopilot by lnd.conf"
lndAutoPilotOn = $( sudo cat /mnt/hdd/lnd/lnd.conf | grep -c 'autopilot.active=1' )
if [ ${ lndAutoPilotOn } -eq 1 ] ; then
autoPilot = "on"
else
autoPilot = "off"
fi
2018-10-15 14:43:09 +02:00
# show select dialog
2019-01-18 23:38:36 +01:00
echo "run dialog ..."
2019-06-14 00:25:49 +02:00
if [ " ${ runBehindTor } " = "on" ] ; then
2019-12-17 19:33:18 +01:00
CHOICES = $( dialog --title ' Additional Services ' --checklist ' use spacebar to activate/de-activate ' 21 45 13 \
2019-06-14 00:25:49 +02:00
1 'Channel Autopilot' ${ autoPilot } \
2019-12-14 02:26:10 +01:00
l 'Lightning Loop' ${ loop } \
2019-06-14 00:25:49 +02:00
2 'Testnet' ${ chainValue } \
3 ${ dynDomainMenu } ${ domainValue } \
4 'Run behind TOR' ${ runBehindTor } \
5 'RTL Webinterface' ${ rtlWebinterface } \
2019-11-24 14:12:55 +01:00
b 'BTC-RPC-Explorer' ${ BTCRPCexplorer } \
2019-06-14 00:25:49 +02:00
6 'LND Auto-Unlock' ${ autoUnlock } \
2020-01-16 15:50:58 +01:00
9 'Touchscreen' ${ touchscreenMenu } \
2019-07-29 00:59:51 +02:00
r 'LCD Rotate' ${ lcdrotateMenu } \
2019-12-04 12:18:56 +01:00
e 'Electrum Rust Server' ${ ElectRS } \
2019-12-04 09:13:21 +01:00
p 'BTCPayServer' ${ BTCPayServer } \
2019-12-17 19:33:18 +01:00
m 'lndmanage' ${ lndmanage } \
2019-06-14 00:25:49 +02:00
2>& 1 >/dev/tty)
else
2019-12-17 19:33:18 +01:00
CHOICES = $( dialog --title ' Additional Services ' --checklist ' use spacebar to activate/de-activate ' 22 45 14 \
2019-06-14 00:25:49 +02:00
1 'Channel Autopilot' ${ autoPilot } \
2019-12-14 02:26:10 +01:00
l 'Lightning Loop' ${ loop } \
2018-12-20 22:52:54 +01:00
2 'Testnet' ${ chainValue } \
2019-01-10 18:17:03 +01:00
3 ${ dynDomainMenu } ${ domainValue } \
4 'Run behind TOR' ${ runBehindTor } \
5 'RTL Webinterface' ${ rtlWebinterface } \
2019-11-24 14:12:55 +01:00
b 'BTC-RPC-Explorer' ${ BTCRPCexplorer } \
2019-01-10 18:17:03 +01:00
6 'LND Auto-Unlock' ${ autoUnlock } \
2019-06-14 00:33:46 +02:00
7 'BTC UPnP (AutoNAT)' ${ networkUPnP } \
8 'LND UPnP (AutoNAT)' ${ autoNatDiscovery } \
2020-01-16 15:50:58 +01:00
9 'Touchscreen' ${ touchscreenMenu } \
2019-07-29 00:59:51 +02:00
r 'LCD Rotate' ${ lcdrotateMenu } \
2019-12-04 12:18:56 +01:00
e 'Electrum Rust Server' ${ ElectRS } \
2019-12-04 09:13:21 +01:00
p 'BTCPayServer' ${ BTCPayServer } \
2019-12-17 19:33:18 +01:00
m 'lndmanage' ${ lndmanage } \
2019-06-14 00:25:49 +02:00
2>& 1 >/dev/tty)
2019-06-14 00:22:27 +02:00
fi
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"
2018-10-15 14:43:09 +02:00
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
2018-10-15 14:43:09 +02:00
echo "user canceled"
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
2020-01-23 11:15:46 +01:00
# TESTNET process choice - KEEP FIRST IN ORDER
2018-12-01 20:25:33 +01:00
choice = "main" ; check = $( echo " ${ CHOICES } " | grep -c "2" )
if [ ${ check } -eq 1 ] ; then choice = "test" ; fi
if [ " ${ chain } " != " ${ choice } " ] ; then
if [ " ${ network } " = "litecoin" ] && [ " ${ choice } " = "test" ] ; then
dialog --title 'FAIL' --msgbox 'Litecoin-Testnet not available.' 5 25
2020-01-23 11:15:46 +01:00
elif [ " ${ BTCRPCexplorer } " = "on" ] ; then
dialog --title 'NOTICE' --msgbox 'Please turn off BTC-RPC-Explorer\nbefore changing testnet.' 6 37
exit 1
2018-12-01 20:25:33 +01:00
else
2018-12-02 19:52:01 +01:00
echo "Testnet Setting changed .."
2019-02-11 19:59:09 +01:00
anychange = 1
2018-12-01 20:25:33 +01:00
sudo /home/admin/config.scripts/network.chain.sh ${ choice } net
2018-12-04 22:24:28 +01:00
walletExists = $( sudo ls /mnt/hdd/lnd/data/chain/${ network } /${ choice } net/wallet.db 2>/dev/null | grep -c 'wallet.db' )
2018-12-04 20:59:36 +01:00
if [ ${ walletExists } -eq 0 ] ; then
2018-12-05 01:49:34 +01:00
echo "Need to creating a new wallet ... wait 20secs"
2018-12-04 20:59:36 +01:00
sudo systemctl start lnd
2018-12-05 01:49:34 +01:00
sleep 20
2018-12-04 20:59:36 +01:00
tryAgain = 1
while [ ${ tryAgain } -eq 1 ]
do
echo "****************************************************************************"
echo " Creating a new LND Wallet for ${ network } / ${ choice } net "
echo "****************************************************************************"
echo "A) For 'Wallet Password' use your PASSWORD C --> !! minimum 8 characters !!"
echo "B) Answere 'n' because you dont have a 'cipher seed mnemonic' (24 words) yet"
echo "C) For 'passphrase' to encrypt your 'cipher seed' use PASSWORD D (optional)"
echo "****************************************************************************"
2018-12-20 20:11:02 +01:00
sudo -u bitcoin /usr/local/bin/lncli --chain= ${ network } --network= ${ chain } net create 2>error.out
2018-12-04 20:59:36 +01:00
error = ` sudo cat error.out`
if [ ${# error } -eq 0 ] ; then
2018-12-05 01:12:45 +01:00
sleep 2
2018-12-05 01:53:28 +01:00
# WIN
tryAgain = 0
echo "!!! Make sure to write down the 24 words (cipher seed mnemonic) !!!"
echo "If you are ready. Press ENTER."
2018-12-04 20:59:36 +01:00
else
# FAIL
tryAgain = 1
echo "!!! FAIL ---> SOMETHING WENT WRONG !!!"
echo " ${ error } "
echo "Press ENTER to retry ... or CTRL-c to EXIT"
fi
read key
done
2018-12-05 11:18:18 +01:00
echo "Check for Macaroon .. (10sec)"
sleep 10
2018-12-05 01:48:37 +01:00
macaroonExists = $( sudo ls /home/bitcoin/.lnd/data/chain/${ network } /${ choice } net/admin.macaroon | grep -c 'admin.macaroon' )
if [ ${ macaroonExists } -eq 0 ] ; then
echo "*** PLEASE UNLOCK your wallet with PASSWORD C to create macaroon"
2018-12-05 11:18:18 +01:00
lncli unlock 2>/dev/null
2018-12-05 01:48:37 +01:00
sleep 6
fi
macaroonExists = $( sudo ls /home/bitcoin/.lnd/data/chain/${ network } /${ choice } net/admin.macaroon | grep -c 'admin.macaroon' )
if [ ${ macaroonExists } -eq 0 ] ; then
echo "FAIL --> Was not able to create macaroon"
echo "Please report problem."
exit 1
fi
2018-12-05 00:58:44 +01:00
echo "stopping lnd again"
sleep 5
2018-12-04 20:59:36 +01:00
sudo systemctl stop lnd
fi
2018-12-05 01:48:37 +01:00
2018-12-04 20:59:36 +01:00
echo "Update Admin Macaroon"
2018-12-05 01:12:45 +01:00
sudo rm -r /home/admin/.lnd/data/chain/${ network } /${ choice } net 2>/dev/null
2018-12-04 20:59:36 +01:00
sudo mkdir /home/admin/.lnd/data/chain/${ network } /${ choice } net
sudo cp /home/bitcoin/.lnd/data/chain/${ network } /${ choice } net/admin.macaroon /home/admin/.lnd/data/chain/${ network } /${ choice } net
sudo chown -R admin:admin /home/admin/.lnd/
2018-12-05 01:48:37 +01:00
2018-12-01 20:25:33 +01:00
needsReboot = 1
fi
else
echo "Testnet Setting unchanged."
fi
2020-01-23 11:15:46 +01:00
# AUTOPILOT process choice
choice = "off" ; check = $( echo " ${ CHOICES } " | grep -c "1" )
if [ ${ check } -eq 1 ] ; then choice = "on" ; fi
if [ " ${ autoPilot } " != " ${ choice } " ] ; then
echo "Autopilot Setting changed .."
anychange = 1
sudo /home/admin/config.scripts/lnd.autopilot.sh ${ choice }
needsReboot = 1
else
echo "Autopilot Setting unchanged."
fi
# LOOP process choice
choice = "off" ; check = $( echo " ${ CHOICES } " | grep -c "l" )
if [ ${ check } -eq 1 ] ; then choice = "on" ; fi
if [ " ${ loop } " != " ${ choice } " ] ; then
echo "Loop Setting changed .."
anychange = 1
/home/admin/config.scripts/bonus.loop.sh ${ choice }
errorOnInstall = $?
if [ " ${ choice } " = "on" ] ; then
if [ ${ errorOnInstall } -eq 0 ] ; then
sudo systemctl start loopd
if [ ${# GOPATH } -eq 0 ] ; then
whiptail --title " Installed the Lightning Loop Service (loopd) " --msgbox " \
Usage and examples: https://github.com/lightninglabs/loop#loop-out-swaps\n
Start from the command line after the reboot.
Use the command 'loop' to see the options.
" 11 56
needsReboot = 1
else
whiptail --title " Installed the Lightning Loop Service (loopd) " --msgbox " \
Usage and examples: https://github.com/lightninglabs/loop#loop-out-swaps\n
Use the command 'loop' to see the options.
" 10 56
needsReboot = 0
fi
else
l1 = "FAILED to install Lightning LOOP"
l2 = "Try manual install in the terminal with:"
l3 = "/home/admin/config.scripts/bonus.loop.sh on"
dialog --title 'FAIL' --msgbox " ${ l1 } \n ${ l2 } \n ${ l3 } " 7 65
fi
fi
else
echo "Loop Setting unchanged."
fi
2018-12-20 14:13:42 +01:00
# Dynamic Domain
2019-01-10 18:17:03 +01:00
choice = "off" ; check = $( echo " ${ CHOICES } " | grep -c "3" )
2018-12-02 19:52:01 +01:00
if [ ${ check } -eq 1 ] ; then choice = "on" ; fi
2018-12-20 14:13:42 +01:00
if [ " ${ domainValue } " != " ${ choice } " ] ; then
echo "Dynamic Domain changed .."
2019-02-11 19:59:09 +01:00
anychange = 1
2018-12-20 22:52:54 +01:00
sudo /home/admin/config.scripts/internet.dyndomain.sh ${ choice }
needsReboot = 1
2018-12-20 14:13:42 +01:00
else
echo "Dynamic Domain unchanged."
fi
2019-06-14 00:03:44 +02:00
# UPnP
choice = "off" ; check = $( echo " ${ CHOICES } " | grep -c "7" )
if [ ${ check } -eq 1 ] ; then choice = "on" ; fi
if [ " ${ networkUPnP } " != " ${ choice } " ] ; then
echo "BTC UPnP Setting changed .."
anychange = 1
if [ " ${ choice } " = "on" ] ; then
echo "Starting BTC UPNP ..."
/home/admin/config.scripts/network.upnp.sh on
networkUPnP = "on"
needsReboot = 1
else
echo "Stopping BTC UPNP ..."
/home/admin/config.scripts/network.upnp.sh off
networkUPnP = "off"
needsReboot = 1
fi
else
echo "BTC UPnP Setting unchanged."
fi
# AutoNAT
choice = "off" ; check = $( echo " ${ CHOICES } " | grep -c "8" )
if [ ${ check } -eq 1 ] ; then choice = "on" ; fi
if [ " ${ autoNatDiscovery } " != " ${ choice } " ] ; then
echo "AUTO NAT Setting changed .."
anychange = 1
if [ " ${ choice } " = "on" ] ; then
echo "Starting autoNAT ..."
/home/admin/config.scripts/lnd.autonat.sh on
autoNatDiscovery = "on"
needsReboot = 1
else
echo "Stopping autoNAT ..."
/home/admin/config.scripts/lnd.autonat.sh off
autoNatDiscovery = "off"
needsReboot = 1
fi
else
echo "LND AUTONAT Setting unchanged."
fi
2018-12-20 14:13:42 +01:00
# TOR process choice
2019-01-10 18:17:03 +01:00
choice = "off" ; check = $( echo " ${ CHOICES } " | grep -c "4" )
2018-12-20 14:13:42 +01:00
if [ ${ check } -eq 1 ] ; then choice = "on" ; fi
2018-12-02 19:52:01 +01:00
if [ " ${ runBehindTor } " != " ${ choice } " ] ; then
echo "TOR Setting changed .."
2019-06-14 00:03:44 +02:00
2019-08-07 15:01:48 +02:00
# special actions if TOR is turned on
if [ " ${ choice } " = "on" ] ; then
# inform user about privacy risk
whiptail --title " PRIVACY NOTICE " --msgbox "
2019-08-07 14:53:48 +02:00
RaspiBlitz will now install/activate TOR & after reboot run behind it.
Please keep in mind that thru your LND node id & your previous IP history with your internet provider your lightning node could still be linked to your personal id even when running behind TOR. To unlink you from that IP history its recommended that after the switch/reboot to TOR you also use the REPAIR > RESET-LND option to create a fresh LND wallet. That might involve closing all channels & move your funds out of RaspiBlitz before that RESET-LND.
" 16 76
2019-08-07 15:01:48 +02:00
# make sure AutoNAT & UPnP is off
/home/admin/config.scripts/lnd.autonat.sh off
/home/admin/config.scripts/network.upnp.sh off
fi
2019-06-14 00:03:44 +02:00
# change TOR
2019-02-11 19:59:09 +01:00
anychange = 1
2018-12-02 19:52:01 +01:00
sudo /home/admin/config.scripts/internet.tor.sh ${ choice }
needsReboot = 1
2019-06-14 00:03:44 +02:00
2018-12-02 19:52:01 +01:00
else
echo "TOR Setting unchanged."
fi
# RTL process choice
2019-01-10 18:17:03 +01:00
choice = "off" ; check = $( echo " ${ CHOICES } " | grep -c "5" )
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
2019-11-24 14:12:55 +01:00
/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
2019-12-25 01:41:31 +01:00
sudo systemctl start RTL
2019-03-13 18:13:49 +01:00
localip = $( ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/' )
2019-11-24 14:12:55 +01:00
if [ " ${ runBehindTor } " = "on" ] ; then
TOR_ADDRESS = $( sudo cat /mnt/hdd/tor/RTL/hostname)
2019-12-04 12:18:56 +01:00
whiptail --title " Installed RTL " --msgbox " \
Open the following URL in your local web browser and login with your PASSWORD B.\n
---> http://${ localip } :3000 \n
The Hidden Service address to be used in the Tor Browser is:\n
${ TOR_ADDRESS }
" 14 66
2019-11-24 14:12:55 +01:00
else
l1 = "Open the following URL in your local web browser"
l2 = "and login with your PASSWORD B."
l3 = " ---> http:// ${ localip } :3000 "
dialog --title 'OK' --msgbox " ${ l1 } \n ${ l2 } \n ${ l3 } \n ${ l4 } " 7 65
fi
2019-03-13 18:13:49 +01:00
else
l1 = "!!! FAIL on RTL install !!!"
2019-11-24 14:12:55 +01:00
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
2019-11-24 14:12:55 +01:00
# 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
2019-12-25 01:41:31 +01:00
sudo sytemctl start btc-rpc-explorer
2019-11-24 14:12:55 +01:00
localip = $( ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/' )
if [ " ${ runBehindTor } " = "on" ] ; then
TOR_ADDRESS = $( sudo cat /mnt/hdd/tor/btc-rpc-explorer/hostname)
2019-12-04 12:18:56 +01:00
whiptail --title " Installed BTC-RPC-Explorer " --msgbox " \
2020-01-23 11:20:43 +01:00
The txindex may need to be created before BTC-RPC-Explorer can be active.
2019-12-19 12:10:48 +01:00
Takes ~7 hours on a RPi4 with SSD.
Monitor the progress on the LCD or with 'INFO' in main menu.\n
2019-12-04 12:18:56 +01:00
BTC-RPC-Explorer will be available on the following URL in your local web browser:\n
---> http://${ localip } :3002\n
The Hidden Service address to be used in the Tor Browser is:\n
${ TOR_ADDRESS }
" 18 75
2019-11-24 14:12:55 +01:00
else
2019-12-04 12:18:56 +01:00
whiptail --title " Installed BTC-RPC-Explorer " --msgbox " \
2020-01-23 11:20:43 +01:00
The txindex may need to be created before BTC-RPC-Explorer can be active.
2019-12-19 12:10:48 +01:00
Takes ~7 hours on a RPi4 with SSD.
Monitor the progress on the LCD or with 'INFO' in main menu.\n
2019-12-04 12:18:56 +01:00
BTC-RPC-Explorer will be available on the following URL in your local web browser:\n
---> http://${ localip } :3002
" 14 75
2019-11-24 14:12:55 +01:00
fi
2020-01-23 11:20:43 +01:00
needsReboot = 1
2019-11-24 14:12:55 +01:00
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
2018-12-22 16:44:15 +01:00
# LND Auto-Unlock
2019-01-10 18:17:03 +01:00
choice = "off" ; check = $( echo " ${ CHOICES } " | grep -c "6" )
2018-12-22 16:44:15 +01:00
if [ ${ check } -eq 1 ] ; then choice = "on" ; fi
if [ " ${ autoUnlock } " != " ${ choice } " ] ; then
echo "LND Autounlock Setting changed .."
2019-02-11 19:59:09 +01:00
anychange = 1
2018-12-22 16:44:15 +01:00
sudo /home/admin/config.scripts/lnd.autounlock.sh ${ choice }
2019-01-18 03:34:20 +01:00
l1 = "AUTO-UNLOCK IS NOW OFF"
2019-01-18 03:12:26 +01:00
if [ " ${ choice } " = "on" ] ; then
2019-01-18 03:34:20 +01:00
l1 = "AUTO-UNLOCK IS NOW ACTIVE"
fi
l2 = "-------------------------"
l3 = "mobile/external wallets may need reconnect"
l4 = "possible change in macaroon / TLS cert"
dialog --title 'OK' --msgbox " ${ l1 } \n ${ l2 } \n ${ l3 } \n ${ l4 } " 11 60
2018-12-22 16:44:15 +01:00
needsReboot = 1
else
echo "LND Autounlock Setting unchanged."
fi
2019-07-03 03:53:08 +02:00
# touchscreen
choice = "0" ; check = $( echo " ${ CHOICES } " | grep -c "9" )
if [ ${ check } -eq 1 ] ; then choice = "1" ; fi
if [ " ${ touchscreen } " != " ${ choice } " ] ; then
echo "Touchscreen Setting changed .."
anychange = 1
sudo /home/admin/config.scripts/blitz.touchscreen.sh ${ choice }
needsReboot = 1
else
echo "Touchscreen Setting unchanged."
fi
2019-07-29 01:02:34 +02:00
# lcd rotate
2019-07-29 00:45:35 +02:00
choice = "0" ; check = $( echo " ${ CHOICES } " | grep -c "r" )
if [ ${ check } -eq 1 ] ; then choice = "1" ; fi
2019-07-29 01:02:34 +02:00
if [ " ${ lcdrotate } " != " ${ choice } " ] ; then
2019-07-29 00:45:35 +02:00
echo "LCD Rotate Setting changed .."
anychange = 1
sudo /home/admin/config.scripts/blitz.lcdrotate.sh ${ choice }
needsReboot = 1
else
2019-07-29 01:02:34 +02:00
echo "LCD Rotate Setting unchanged."
2019-07-29 00:45:35 +02:00
fi
2019-12-04 12:18:56 +01:00
# 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
/home/admin/config.scripts/bonus.electrs.sh ${ choice }
errorOnInstall = $?
if [ " ${ choice } " = "on" ] ; then
if [ ${ errorOnInstall } -eq 0 ] ; then
2019-12-25 01:41:31 +01:00
sudo systemctl start electrs
2019-12-04 12:18:56 +01:00
localip = $( ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/' )
if [ " ${ runBehindTor } " = "on" ] ; then
TOR_ADDRESS = $( sudo cat /mnt/hdd/tor/electrs/hostname)
echo " Electrs now starts indexing the transaction data in the background.
This process takes days on an RPi3 and still many hours on a RPi4 with SSD.
See more more info about how to monitor the process:
https://github.com/openoms/bitcoin-tutorials/tree/master/electrs#monitor-electrs"
echo ""
echo "The Tor Hidden Service address for electrs is:"
echo " $TOR_ADDRESS "
echo ""
echo "To connect the Electrum wallet through Tor open the Tor Browser and start Electrum with the options:"
echo " \`electrum --oneserver --server= $TOR_ADDRESS :50002:s --proxy socks5:127.0.0.1:9150\` "
echo ""
echo "See the docs for more detailed instructions to connect Electrum on Windows/Mac/Linux:"
echo "https://github.com/openoms/bitcoin-tutorials/tree/master/electrs#connect-the-electrum-wallet-to-electrs"
echo ""
echo "scan the QR to use the Tor address in Electrum on mobile:"
qrencode -t ANSI256 $TOR_ADDRESS
echo "Press ENTER to return to the menu"
read key
else
echo " Electrs now starts indexing the transaction data in the background.
This process takes days on an RPi3 and still many hours on a RPi4 with SSD.
See more more info about how to monitor the process:
https://github.com/openoms/bitcoin-tutorials/tree/master/electrs#monitor-electrs"
echo ""
echo "To connect through the Electrum wallet to your own Electrum Rust Server:"
echo " Start the wallet with the options \`electrum --oneserver --server $localip :50002:s\` "
echo ""
echo "See the docs for more detailed instructions to connect Electrum on Windows/Mac/Linux:"
echo "https://github.com/openoms/bitcoin-tutorials/tree/master/electrs#connect-the-electrum-wallet-to-electrs"
echo ""
echo "Press ENTER to return to the menu"
read key
fi
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
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 .."
anychange = 1
/home/admin/config.scripts/bonus.btcpayserver.sh ${ choice }
errorOnInstall = $?
if [ " ${ choice } " = "on" ] ; then
if [ ${ errorOnInstall } -eq 0 ] ; then
source /home/btcpay/.btcpayserver/Main/settings.config
2020-01-20 23:12:55 +01:00
if [ " ${ externalurl } " = "https://localhost" ] ; then
2019-12-05 16:31:07 +01:00
localip = $( ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/' )
externalurl = " https:// $localip \n
Will need to accept the self-signed certificate in the \
browser to be able to connect from the outside of the Tor Network."
fi
2019-12-04 09:13:21 +01:00
if [ " ${ runBehindTor } " = "on" ] ; then
TOR_ADDRESS = $( sudo cat /mnt/hdd/tor/btcpay/hostname)
2019-12-04 12:18:56 +01:00
whiptail --title " Installed BTCPAY Server " --msgbox " \
Open the following URL in your local web browser
and register your admin account:\n
---> ${ externalurl } \n
The Hidden Service address to be used in the Tor Browser:\n
${ TOR_ADDRESS }
2019-12-05 16:31:07 +01:00
" 17 75
2019-12-04 09:13:21 +01:00
else
l1 = "Open the following URL in your local web browser"
l2 = "and register your admin account: "
l3 = " ---> ${ externalurl } "
dialog --title 'OK' --msgbox " ${ l1 } \n ${ l2 } \n ${ l3 } \n ${ l4 } " 7 65
fi
else
2019-12-05 17:45:27 +01:00
l1 = "BTCPayServer installation is cancelled"
l2 = "Try again from the menu or install from the terminal with:"
2019-12-04 09:13:21 +01:00
l3 = "/home/admin/config.scripts/bonus.btcpayserver.sh on"
dialog --title 'FAIL' --msgbox " ${ l1 } \n ${ l2 } \n ${ l3 } " 7 65
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 }
2019-12-17 20:28:03 +01:00
if [ " ${ choice } " = "on" ] ; then
whiptail --title " Installed lndmanage " --msgbox " \
2020-01-22 00:07:03 +01:00
Usage: https://github.com/bitromortac/lndmanage/blob/master/README.md
Have at least one channel active to run it without error.
2020-01-13 22:52:43 +01:00
To start type: 'manage' in the command line.
" 9 75
2019-12-17 20:28:03 +01:00
fi
2019-12-17 19:33:18 +01:00
else
echo "lndmanage 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