Merge branch 'v1.5' into specter

This commit is contained in:
Kim Neunert 2020-04-04 17:39:55 +02:00 committed by GitHub
commit 0382552c5b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
42 changed files with 966 additions and 525 deletions

35
FAQ.md
View file

@ -1,5 +1,23 @@
# FAQ - Frequently Asked Questions # FAQ - Frequently Asked Questions
## Whats new in Version 1.5 of RaspiBlitz?
Beside many small improvements and changes, these are most important changes:
- Update: LND version 0.9.2-beta
- Update: bitcoin-core version 19.1-beta
- Update: Loop 0.5.1
- Update: RTL 0.7.0 (Loop In and Out integration)
- Shoppinglist: Replace Shimfan with passive RP4-Heatcase
- Fix: (Control-D) Give root password for maintenance [details](https://github.com/rootzoll/raspiblitz/issues/1053)
- Fix: Screen Rotate on update from v1.3
- New: Specter Desktop (connect DIY Specter-Wallet or ColdCard) [details](https://github.com/cryptoadvance/specter-desktop/blob/master/README.md)
- New: JoinMarket [details](https://github.com/JoinMarket-Org/joinmarket-clientserver)
- New: Activate 'Keysend' on LND by Service Menu [details](https://github.com/rootzoll/raspiblitz/issues/1000)
- New: Reset SSH cert if SSH login not working [details](FAQ.md#how-can-i-repair-my-ssh-login)
- New: Make it easier to Copy The Blockchain over Network from running Blitz[details](https://github.com/rootzoll/raspiblitz/issues/1081)
- Removed: Clone Blockchain from second HDD (use CopyStation script)
## Whats new in Version 1.4 of RaspiBlitz? ## Whats new in Version 1.4 of RaspiBlitz?
Beside many small improvements and changes, these are most important changes: Beside many small improvements and changes, these are most important changes:
@ -395,6 +413,8 @@ Some routers support a feature called UPnP where devices can automatically reque
On details how to set port forwarding manually on your router model see: https://portforward.com On details how to set port forwarding manually on your router model see: https://portforward.com
Also the selftesting of the RaspiBlitz if the port is forwarded or not might not work if your router is not supporting [Hairpinning](https://en.wikipedia.org/wiki/Hairpinning).
## Why is my node address on the display yellow (not green)? ## Why is my node address on the display yellow (not green)?
Yellow is OK. The RaspiBlitz can detect, that it can reach a service on the port 9735 of your public IP - this is in most cases the LND of your RaspiBlitz. But the RaspiBlitz cannot 100% for sure detect that this is its own LND service on that port - that's why it's just yellow, not green. Yellow is OK. The RaspiBlitz can detect, that it can reach a service on the port 9735 of your public IP - this is in most cases the LND of your RaspiBlitz. But the RaspiBlitz cannot 100% for sure detect that this is its own LND service on that port - that's why it's just yellow, not green.
@ -906,3 +926,18 @@ When the LCD display is telling you to do config check:
## How to fix my upside down LCD after update? ## How to fix my upside down LCD after update?
Some displays have a different orientation. To fix this activate/deactivate the LCD-ROTATION option in the MAINMENU > SERVICES and let it reboot. YOu might need to do this up to 3 times until your display got it right. Some displays have a different orientation. To fix this activate/deactivate the LCD-ROTATION option in the MAINMENU > SERVICES and let it reboot. YOu might need to do this up to 3 times until your display got it right.
## How can I repair my SSH login?
If you cannot login per SSH into your RaspiBlitz your SSH RaspiBlitz certs might be corrupted. To renew and reset those do the following (since version 1.5):
- shutdown the RaspiBlitz - if you dont have touchscreen activated, disconnect LAN cable, wait until HDD/SSD activity slows down (no constant blinking) and then cut the power
- take out the sd card and connect it to your laptop - it should appear as a `boot` drive
- in the root directory of that `boot` drive create a file called `ssh.reset`
- that file can be empty or just copy another file on that drive and rename it ()
- eject the drive from your laptop safely
- put sd card back into the RaspiBlitz (also make sure LAN cable is connected again)
- power up - the RaspiBlitz should boot up & reboot again
- then try again to SSH login
If you see a "REMOTE HOST IDENTIFICATION HAS CHANGED!" warning on login thats what we wanted - the SSH cert of your RaspiBlitz changed - thats good. We just need to remove the old one from our laptop first - on OSX you can use `rm ~/.ssh/known_hosts` (deletes all cached server certs) or remove the line with your RaspiBlitz IP manually from the `~/.ssh/known_hosts` file with a text editor.

View file

@ -2,7 +2,7 @@
*Build your own Lightning Node on a RaspberryPi with a nice Display.* *Build your own Lightning Node on a RaspberryPi with a nice Display.*
`Version 1.4 with lnd 0.9.0-beta and bitcoin 0.19.0.1 or litecoin 0.17.1.` `Version 1.5 with lnd 0.9.2-beta and bitcoin 0.19.1 or litecoin 0.17.1.`
![RaspiBlitz](pictures/raspiblitz.jpg) ![RaspiBlitz](pictures/raspiblitz.jpg)
@ -27,6 +27,7 @@ There are further Services that can be switched on:
* **BTCPayServer** (Cryptocurrency Payment Processor) [details](https://btcpayserver.org) * **BTCPayServer** (Cryptocurrency Payment Processor) [details](https://btcpayserver.org)
* **BTC-RPC-Explorer** (Bitcoin Blockchain Explorer) [details](https://github.com/janoside/btc-rpc-explorer) * **BTC-RPC-Explorer** (Bitcoin Blockchain Explorer) [details](https://github.com/janoside/btc-rpc-explorer)
* **LNBits** (Lightning wallet/accounts System) [details](https://github.com/arcbtc/lnbits) * **LNBits** (Lightning wallet/accounts System) [details](https://github.com/arcbtc/lnbits)
* **SpecterDesktop** (Multisig Trezor, Ledger, COLDCARDwallet & Specter-DIY) [details](https://twitter.com/CryptoAdvance/status/1233833767283941376?s=20)
* **LNDmanage** (Advanced Channel Management CLI) [details](https://github.com/bitromortac/lndmanage) * **LNDmanage** (Advanced Channel Management CLI) [details](https://github.com/bitromortac/lndmanage)
* **Loop** (Submarine Swaps Service) [details](https://github.com/lightninglabs/loop) * **Loop** (Submarine Swaps Service) [details](https://github.com/lightninglabs/loop)
@ -70,12 +71,11 @@ The cheapest way is to buy and assemble the single parts yourself. The new shopp
*The "Standard Package" is most tested and recommended if you can effort it. It aims to give you the best economic value to run all the RaspiBlitz features at a good performance and even allows you to self-validate your blockchain in under 3 days.* *The "Standard Package" is most tested and recommended if you can effort it. It aims to give you the best economic value to run all the RaspiBlitz features at a good performance and even allows you to self-validate your blockchain in under 3 days.*
* RaspBerry Pi 4 2GB + Power: [amazon](https://geni.us/raspiblitz-2gb-power) * RaspBerry Pi 4 2GB + Power: [amazon](https://geni.us/raspiblitz-2gb-power)
* ShimFan Cooling: [amazon](https://geni.us/raspiblitz-fanshim) * Heatsink-Case RP4: [amazon](https://geni.us/heatsink-raspi4)
* 500GB SSD: [amazon](https://geni.us/raspiblitz-500gb-ssd) * 500GB SSD: [amazon](https://geni.us/raspiblitz-500gb-ssd)
* SSD-Case: [amazon](https://geni.us/raspiblitz-ssd-case) * SSD-Case: [amazon](https://geni.us/raspiblitz-ssd-case)
* Micro SD-Card 32GB: [amazon](https://geni.us/raspiblitz-sc-card) * Micro SD-Card 32GB: [amazon](https://geni.us/raspiblitz-sc-card)
* LCD-Display: [amazon](https://geni.us/raspiblitz-touchscreen) * LCD-Display: [amazon](https://geni.us/raspiblitz-touchscreen)
* RaspberryPi-Case: [amazon](https://geni.us/raspiblitz-case)
#### Package: Minimal (around 180 USD) #### Package: Minimal (around 180 USD)
@ -88,25 +88,23 @@ Basic Parts for all minimal variants:
If you have already a used RaspberryPi 3 B+ you can reuse with the following parts: If you have already a used RaspberryPi 3 B+ you can reuse with the following parts:
* RaspBerry Pi 3: [amazon](https://geni.us/raspiblitz-rpi3) * RaspBerry Pi 3: [amazon](https://geni.us/raspiblitz-rpi3)
* Heatsink-Case RP3: [amazon](https://geni.us/raspiblitz-heatsink)
* Power >=3A: [amazon](https://geni.us/raspiblitz-3A-power) * Power >=3A: [amazon](https://geni.us/raspiblitz-3A-power)
* Heatsink-Case: [amazon](https://geni.us/raspiblitz-heatsink)
Or if you order new go with the RaspberryPi 4 2GB and the following parts: Or if you order new go with the RaspberryPi 4 2GB and the following parts:
* RaspBerry Pi 4 1GB + Power: [amazon](https://geni.us/raspiblitz-1gb-power) * RaspBerry Pi 4 2GB + Power: [amazon](https://geni.us/raspiblitz-2gb-power)
* ShimFan Cooling: [amazon](https://geni.us/raspiblitz-fanshim) * Heatsink-Case RP4: [amazon](https://geni.us/heatsink-raspi4)
* RaspberryPi-Case: [amazon](https://geni.us/raspiblitz-case)
#### Package: Maximal #### Package: Maximal
*The maximal package is still in the works ... if you want to prepare for it, take the standard package as a base and choose the RaspberryPi4 with 4GB and a high quality 1TB SSD instead of 500GB.* *The maximal package is still in the works ... if you want to prepare for it, take the standard package as a base and choose the RaspberryPi4 with 4GB and a high quality 1TB SSD instead of 500GB.*
* 1000GB SSD: [amazon](https://geni.us/raspiblitz-1000gb-san)
* RaspBerry Pi 4 4GB: [amazon](https://geni.us/raspiblitz-4-4gb-power) * RaspBerry Pi 4 4GB: [amazon](https://geni.us/raspiblitz-4-4gb-power)
* SSD-Case: [amazon](https://geni.us/raspiblitz-ssd-case) * Heatsink-Case RP4: [amazon](https://geni.us/heatsink-raspi4)
* Micro SD-Card 32GB: [amazon](https://geni.us/raspiblitz-sc-card)
* LCD-Display: [amazon](https://geni.us/raspiblitz-touchscreen) * LCD-Display: [amazon](https://geni.us/raspiblitz-touchscreen)
* ShimFan Cooling: [amazon](https://geni.us/raspiblitz-fanshim) * Micro SD-Card 32GB: [amazon](https://geni.us/raspiblitz-sc-card)
* RaspberryPi-Case: [amazon](https://geni.us/raspiblitz-case) * 1000GB SSD: [amazon](https://geni.us/raspiblitz-1000gb-san)
* SSD-Case: [amazon](https://geni.us/raspiblitz-ssd-case)
*You can even pay your RaspiBlitz Amazon Shopping with Bitcoin & Lightning through [Bitrefill](https://blog.bitrefill.com/its-here-buy-amazon-vouchers-with-bitcoin-on-bitrefill-bb2a4449724a).* *You can even pay your RaspiBlitz Amazon Shopping with Bitcoin & Lightning through [Bitrefill](https://blog.bitrefill.com/its-here-buy-amazon-vouchers-with-bitcoin-on-bitrefill-bb2a4449724a).*
@ -114,29 +112,30 @@ Or if you order new go with the RaspberryPi 4 2GB and the following parts:
## Assemble your RaspiBlitz ## Assemble your RaspiBlitz
If you are going with the Standard/Maximal-RaspberryPi4 Setup you need to: When you have all parts you need to:
- Assemble the Shim-Fan and connect it to the GPIO pins: [detail instructions](https://learn.pimoroni.com/tutorial/sandyj/getting-started-with-fan-shim) - Assemble the Heatsink-Case on the RaspberryPi (follow the intructions in package).
- Fit the RaspberryPi to the PiBow case: [detail instructions](https://www.youtube.com/watch?v=utk3cjzCLog) - Put the SSD/Hdd into the Case and connect it per USB to the RaspberryPi
- Put the SSD into the HDD USB & may get some rubber bands - Add the display on top with the pins like in picture below.
- PlugIn the network cable.
Add the display on top with the pins like in picture below. PlugIn the network cable. In the end your RaspiBlitz should look like this: In the end your RaspiBlitz should look like this:
![HardwareSetup](pictures/hardwaresetup.jpg) ![HardwareSetup](pictures/hardwaresetup.jpg)
*If you are going with the Minimal-RaspberryPi3 Setup just apply the Geekworm Heatsink-Case and connect everything- [detail instructions](https://www.youtube.com/watch?v=2QDlbAorJKw).*
## Installing the Software ## Installing the Software
Your SD-card needs to contain the RaspiBlitz software. You can take the long road by [building the SD-card image yourself](#build-the-sd-card-image) or use the already prepared SD-Card image: Your SD-card needs to contain the RaspiBlitz software. You can take the long road by [building the SD-card image yourself](#build-the-sd-card-image) or use the already prepared SD-Card image:
**Download SD-Card image - Version 1.4:** **Download SD-Card image - Version 1.5:**
Browser: [https://raspiblitz.com/raspiblitz-v1.4-2020-02-20.img.gz](https://raspiblitz.com/raspiblitz-v1.4-2020-02-20.img.gz) *IMPORTANT: This is just a Release Candidate - not the final release. Please just use if you feel reckless and like to help on testing. If you have serious funds on your node please wait for the final release before updating.*
Torrent: https://github.com/rootzoll/raspiblitz/raw/v1.4/home.admin/assets/raspiblitz-v1.4-2020-02-20.img.gz.torrent Browser: https://raspiblitz.com/raspiblitz-v1.5RC1-2020-03-31.img.gz
SHA-256: 55b1989a45e99ecc56b74febddfa98f52271799105cc80900b09cc67e73df078 or [SIGNATURE](https://raspiblitz.com/raspiblitz-v1.4-2020-02-20.img.gz.sig) Torrent: TODO just for final release
SHA-256: 0463dbad63b25ec3f2565fe555fd97e64cbe1c981a16dab07f1c9074c4dae5c2 or [SIGNATURE](TODO just for final release)
**Write the SD-Card image to your SD Card** **Write the SD-Card image to your SD Card**

View file

@ -1,16 +1,16 @@
#!/bin/bash #!/bin/bash
######################################################################### #########################################################################
# Build your SD card image based on: # Build your SD card image based on:
# Raspbian Buster Desktop (2019-09-26) # Raspbian Buster Desktop (2020-02-13)
# https://www.raspberrypi.org/downloads/raspbian/ # https://www.raspberrypi.org/downloads/raspbian/
# SHA256: 2c4067d59acf891b7aa1683cb1918da78d76d2552c02749148d175fa7f766842 # SHA256: a82ed4139dfad31c3167e60e943bcbe28c404d1858f4713efe5530c08a419f50
########################################################################## ##########################################################################
# setup fresh SD card with image above - login per SSH and run this script: # setup fresh SD card with image above - login per SSH and run this script:
########################################################################## ##########################################################################
echo "" echo ""
echo "*****************************************" echo "*****************************************"
echo "* RASPIBLITZ SD CARD IMAGE SETUP v1.4 *" echo "* RASPIBLITZ SD CARD IMAGE SETUP v1.5 *"
echo "*****************************************" echo "*****************************************"
echo "" echo ""
@ -139,6 +139,8 @@ if [ "${baseImage}" = "raspbian" ]; then
# see: https://github.com/rootzoll/raspiblitz/issues/782#issuecomment-564981630 # see: https://github.com/rootzoll/raspiblitz/issues/782#issuecomment-564981630
# use command to check last fsck check: sudo tune2fs -l /dev/mmcblk0p2 # use command to check last fsck check: sudo tune2fs -l /dev/mmcblk0p2
sudo tune2fs -c 1 /dev/mmcblk0p2 sudo tune2fs -c 1 /dev/mmcblk0p2
# see https://github.com/rootzoll/raspiblitz/issues/1053#issuecomment-600878695
sudo sed -i 's/^/fsck.mode=force fsck.repair=yes /g' /boot/cmdline.txt
fi fi
# special prepare when Ubuntu or Armbian # special prepare when Ubuntu or Armbian
@ -258,7 +260,7 @@ echo "*** SOFTWARE UPDATE ***"
# based on https://github.com/Stadicus/guides/blob/master/raspibolt/raspibolt_20_pi.md#software-update # based on https://github.com/Stadicus/guides/blob/master/raspibolt/raspibolt_20_pi.md#software-update
# installs like on RaspiBolt # installs like on RaspiBolt
sudo apt-get install -y htop git curl bash-completion vim jq dphys-swapfile sudo apt-get install -y htop git curl bash-completion vim jq dphys-swapfile bsdmainutils
# installs bandwidth monitoring for future statistics # installs bandwidth monitoring for future statistics
sudo apt-get install -y vnstat sudo apt-get install -y vnstat
@ -349,7 +351,7 @@ echo "*** PREPARING BITCOIN & Co ***"
# set version (change if update is available) # set version (change if update is available)
# https://bitcoincore.org/en/download/ # https://bitcoincore.org/en/download/
bitcoinVersion="0.19.0.1" bitcoinVersion="0.19.1"
# needed to check code signing # needed to check code signing
laanwjPGP="01EA5486DE18A882D4C2684590C8019E36C2E964" laanwjPGP="01EA5486DE18A882D4C2684590C8019E36C2E964"
@ -450,7 +452,7 @@ fi
# "*** LND ***" # "*** LND ***"
## based on https://github.com/Stadicus/guides/blob/master/raspibolt/raspibolt_40_lnd.md#lightning-lnd ## based on https://github.com/Stadicus/guides/blob/master/raspibolt/raspibolt_40_lnd.md#lightning-lnd
## see LND releases: https://github.com/lightningnetwork/lnd/releases ## see LND releases: https://github.com/lightningnetwork/lnd/releases
lndVersion="0.9.0-beta" lndVersion="0.9.2-beta"
# olaoluwa # olaoluwa
PGPpkeys="https://keybase.io/roasbeef/pgp_keys.asc" PGPpkeys="https://keybase.io/roasbeef/pgp_keys.asc"
@ -633,18 +635,6 @@ if [ "${baseImage}" = "raspbian" ] || [ "${baseImage}" = "armbian" ] || [ "${bas
sudo bash -c 'echo "# replace shell with script => logout when exiting script" >> /home/pi/.bashrc' sudo bash -c 'echo "# replace shell with script => logout when exiting script" >> /home/pi/.bashrc'
sudo bash -c 'echo "exec \$SCRIPT" >> /home/pi/.bashrc' sudo bash -c 'echo "exec \$SCRIPT" >> /home/pi/.bashrc'
fi fi
if [ "${baseImage}" = "raspbian" ]; then
# create /home/admin/setup.sh - which will get executed after reboot by autologin pi user
cat > /tmp/setup.sh <<EOF
# make LCD screen rotation correct
sudo sed --in-place -i "57s/.*/dtoverlay=tft35a:rotate=270/" /boot/config.txt
EOF
sudo cp /tmp/setup.sh /home/admin/setup.sh
sudo chown admin.admin /home/admin/setup.sh
sudo chmod +x /home/admin/setup.sh
fi
if [ "${baseImage}" = "dietpi" ]; then if [ "${baseImage}" = "dietpi" ]; then
# bash autostart for dietpi # bash autostart for dietpi
@ -707,8 +697,9 @@ sudo -u admin git clone https://github.com/goodtft/LCD-show.git
sudo -u admin chmod -R 755 LCD-show sudo -u admin chmod -R 755 LCD-show
sudo -u admin chown -R admin:admin LCD-show sudo -u admin chown -R admin:admin LCD-show
cd LCD-show/ cd LCD-show/
# set comit hard to a8de38f (7 Nov 2019) for security # set comit hard to old version - that seemed to run better
sudo -u admin git reset --hard a8de38f41586e153a8e03adcf7708c8b5974ffc8 #
sudo -u admin git reset --hard ce52014
# install xinput calibrator package # install xinput calibrator package
echo "--> install xinput calibrator package" echo "--> install xinput calibrator package"
@ -751,6 +742,7 @@ echo ""
# activate LCD and trigger reboot # activate LCD and trigger reboot
# dont do this on dietpi to allow for automatic build # dont do this on dietpi to allow for automatic build
if [ "${baseImage}" != "dietpi" ]; then if [ "${baseImage}" != "dietpi" ]; then
sudo chmod +x -R /home/admin/LCD-show
cd /home/admin/LCD-show/ cd /home/admin/LCD-show/
sudo apt-mark hold raspberrypi-bootloader sudo apt-mark hold raspberrypi-bootloader
sudo ./LCD35-show sudo ./LCD35-show

View file

@ -176,7 +176,7 @@ while :
l3="Use password: raspiblitz\n" l3="Use password: raspiblitz\n"
if [ "${state}" = "recovering" ]; then if [ "${state}" = "recovering" ]; then
l1="Recovering please wait - for debug:\n" l1="Recovering please wait ..\n"
fi fi
boxwidth=$((${#localip} + 24)) boxwidth=$((${#localip} + 24))

View file

@ -60,6 +60,9 @@ fi
if [ "${specter}" == "on" ]; then if [ "${specter}" == "on" ]; then
OPTIONS+=(SPECTER "Cryptoadvance Specter") OPTIONS+=(SPECTER "Cryptoadvance Specter")
fi fi
if [ "${joinmarket}" == "on" ]; then
OPTIONS+=(JMARKET "JoinMarket")
fi
# Basic Options # Basic Options
OPTIONS+=(INFO "RaspiBlitz Status Screen") OPTIONS+=(INFO "RaspiBlitz Status Screen")
@ -79,6 +82,7 @@ OPTIONS+=(CASHOUT "Remove Funds from LND")
if [ "${chain}" = "main" ]; then if [ "${chain}" = "main" ]; then
OPTIONS+=(lnbalance "Detailed Wallet Balances") OPTIONS+=(lnbalance "Detailed Wallet Balances")
OPTIONS+=(lnchannels "Lightning Channel List") OPTIONS+=(lnchannels "Lightning Channel List")
OPTIONS+=(lnfwdreport "Lightning Forwarding Events Report")
fi fi
OPTIONS+=(SERVICES "Activate/Deactivate Services") OPTIONS+=(SERVICES "Activate/Deactivate Services")
@ -153,6 +157,9 @@ case $CHOICE in
SPECTER) SPECTER)
/home/admin/config.scripts/bonus.cryptoadvance-specter.sh menu /home/admin/config.scripts/bonus.cryptoadvance-specter.sh menu
;; ;;
JMARKET)
sudo /home/admin/config.scripts/bonus.joinmarket.sh menu
;;
lnbalance) lnbalance)
clear clear
echo "*** YOUR SATOSHI BALANCES ***" echo "*** YOUR SATOSHI BALANCES ***"
@ -167,6 +174,12 @@ case $CHOICE in
echo "Press ENTER to return to main menu." echo "Press ENTER to return to main menu."
read key read key
;; ;;
lnfwdreport)
./XXlnfwdreport.sh
echo "Press ENTER to return to main menu."
read key
./00mainMenu.sh
;;
CONNECT) CONNECT)
/home/admin/BBconnectPeer.sh /home/admin/BBconnectPeer.sh
;; ;;
@ -212,6 +225,9 @@ case $CHOICE in
;; ;;
REPAIR) REPAIR)
/home/admin/98repairMenu.sh /home/admin/98repairMenu.sh
if [ $? -eq 99 ]; then
exit 1
fi
;; ;;
PASSWORD) PASSWORD)
sudo /home/admin/config.scripts/blitz.setpassword.sh sudo /home/admin/config.scripts/blitz.setpassword.sh

View file

@ -22,6 +22,11 @@ if [ ${#BTCPayServer} -eq 0 ]; then BTCPayServer="off"; fi
if [ ${#ElectRS} -eq 0 ]; then ElectRS="off"; fi if [ ${#ElectRS} -eq 0 ]; then ElectRS="off"; fi
if [ ${#lndmanage} -eq 0 ]; then lndmanage="off"; fi if [ ${#lndmanage} -eq 0 ]; then lndmanage="off"; fi
if [ ${#LNBits} -eq 0 ]; then LNBits="off"; fi if [ ${#LNBits} -eq 0 ]; then LNBits="off"; fi
if [ ${#joinmarket} -eq 0 ]; then joinmarket="off"; fi
echo "map dropboxbackup to on/off"
DropboxBackup="off";
if [ ${#dropboxBackupTarget} -gt 0 ]; then DropboxBackup="on"; fi
echo "map chain to on/off" echo "map chain to on/off"
chainValue="off" chainValue="off"
@ -55,12 +60,20 @@ else
autoPilot="off" autoPilot="off"
fi fi
echo "map keysend to on/off"
keysend="on"
source <(sudo /home/admin/config.scripts/lnd.keysend.sh status)
if [ ${keysendOn} -eq 0 ]; then
keysend="off"
fi
# show select dialog # show select dialog
echo "run dialog ..." echo "run dialog ..."
if [ "${runBehindTor}" = "on" ]; then if [ "${runBehindTor}" = "on" ]; then
CHOICES=$(dialog --title ' Additional Services ' --checklist ' use spacebar to activate/de-activate ' 20 45 12 \ CHOICES=$(dialog --title ' Additional Services ' --checklist ' use spacebar to activate/de-activate ' 20 45 12 \
1 'Channel Autopilot' ${autoPilot} \ 1 'Channel Autopilot' ${autoPilot} \
k 'Accept Keysend' ${keysend} \
l 'Lightning Loop' ${loop} \ l 'Lightning Loop' ${loop} \
2 'Testnet' ${chainValue} \ 2 'Testnet' ${chainValue} \
3 ${dynDomainMenu} ${domainValue} \ 3 ${dynDomainMenu} ${domainValue} \
@ -75,10 +88,13 @@ e 'Electrum Rust Server' ${ElectRS} \
p 'BTCPayServer' ${BTCPayServer} \ p 'BTCPayServer' ${BTCPayServer} \
m 'lndmanage' ${lndmanage} \ m 'lndmanage' ${lndmanage} \
i 'LNBits' ${LNBits} \ i 'LNBits' ${LNBits} \
d 'StaticChannelBackup on DropBox' ${DropboxBackup} \
j 'JoinMarket' ${joinmarket} \
2>&1 >/dev/tty) 2>&1 >/dev/tty)
else else
CHOICES=$(dialog --title ' Additional Services ' --checklist ' use spacebar to activate/de-activate ' 20 45 12 \ CHOICES=$(dialog --title ' Additional Services ' --checklist ' use spacebar to activate/de-activate ' 20 45 12 \
1 'Channel Autopilot' ${autoPilot} \ 1 'Channel Autopilot' ${autoPilot} \
k 'Accept Keysend' ${keysend} \
l 'Lightning Loop' ${loop} \ l 'Lightning Loop' ${loop} \
2 'Testnet' ${chainValue} \ 2 'Testnet' ${chainValue} \
3 ${dynDomainMenu} ${domainValue} \ 3 ${dynDomainMenu} ${domainValue} \
@ -95,6 +111,8 @@ e 'Electrum Rust Server' ${ElectRS} \
p 'BTCPayServer' ${BTCPayServer} \ p 'BTCPayServer' ${BTCPayServer} \
m 'lndmanage' ${lndmanage} \ m 'lndmanage' ${lndmanage} \
i 'LNBits' ${LNBits} \ i 'LNBits' ${LNBits} \
d 'StaticChannelBackup on DropBox' ${DropboxBackup} \
j 'JoinMarket' ${joinmarket} \
2>&1 >/dev/tty) 2>&1 >/dev/tty)
fi fi
@ -218,13 +236,13 @@ if [ ${check} -eq 1 ]; then choice="on"; fi
if [ "${loop}" != "${choice}" ]; then if [ "${loop}" != "${choice}" ]; then
echo "Loop Setting changed .." echo "Loop Setting changed .."
anychange=1 anychange=1
needsReboot=1 # always reboot so that RTL gets restarted to show/hide support loop
/home/admin/config.scripts/bonus.loop.sh ${choice} /home/admin/config.scripts/bonus.loop.sh ${choice}
errorOnInstall=$? errorOnInstall=$?
if [ "${choice}" = "on" ]; then if [ "${choice}" = "on" ]; then
if [ ${errorOnInstall} -eq 0 ]; then if [ ${errorOnInstall} -eq 0 ]; then
sudo systemctl start loopd sudo systemctl start loopd
/home/admin/config.scripts/bonus.loop.sh menu /home/admin/config.scripts/bonus.loop.sh menu
needsReboot=1
else else
l1="FAILED to install Lightning LOOP" l1="FAILED to install Lightning LOOP"
l2="Try manual install in the terminal with:" l2="Try manual install in the terminal with:"
@ -488,6 +506,15 @@ choice="off"; check=$(echo "${CHOICES}" | grep -c "p")
if [ ${check} -eq 1 ]; then choice="on"; fi if [ ${check} -eq 1 ]; then choice="on"; fi
if [ "${BTCPayServer}" != "${choice}" ]; then if [ "${BTCPayServer}" != "${choice}" ]; then
echo "BTCPayServer setting changed .." echo "BTCPayServer setting changed .."
# check if TOR is installed
source /mnt/hdd/raspiblitz.conf
if [ "${choice}" = "on" ] && [ "${runBehindTor}" = "off" ]; then
whiptail --title " BTCPayServer needs TOR " --msgbox "\
At the moment the BTCPayServer on the RaspiBlitz needs TOR.\n
Please activate TOR in SERVICES first.\n
Then try activating BTCPayServer again in SERVICES.\n
" 13 42
else
anychange=1 anychange=1
/home/admin/config.scripts/bonus.btcpayserver.sh ${choice} tor /home/admin/config.scripts/bonus.btcpayserver.sh ${choice} tor
errorOnInstall=$? errorOnInstall=$?
@ -505,6 +532,7 @@ Use the new 'BTCPay' entry in Main Menu for more info.\n
dialog --title 'FAIL' --msgbox "${l1}\n${l2}\n${l3}" 7 65 dialog --title 'FAIL' --msgbox "${l1}\n${l2}\n${l3}" 7 65
fi fi
fi fi
fi
else else
echo "BTCPayServer setting not changed." echo "BTCPayServer setting not changed."
fi fi
@ -539,6 +567,64 @@ else
echo "lndmanage setting unchanged." echo "lndmanage setting unchanged."
fi fi
# DropBox process choice
choice="off"; check=$(echo "${CHOICES}" | grep -c "d")
if [ ${check} -eq 1 ]; then choice="on"; fi
if [ "${DropboxBackup}" != "${choice}" ]; then
echo "DropBox Setting changed .."
anychange=1
sudo -u admin /home/admin/config.scripts/dropbox.upload.sh ${choice}
if [ "${choice}" = "on" ]; then
# doing initial upload so that user can see result
source /mnt/hdd/raspiblitz.conf
sudo /home/admin/config.scripts/dropbox.upload.sh upload ${dropboxBackupTarget} /home/admin/.lnd/data/chain/${network}/${chain}net/channel.backup
fi
else
echo "lndmanage setting unchanged."
fi
# Keysend process choice
choice="off"; check=$(echo "${CHOICES}" | grep -c "k")
if [ ${check} -eq 1 ]; then choice="on"; fi
if [ "${keysend}" != "${choice}" ]; then
echo "keysend setting changed .."
anychange=1
needsReboot=1
sudo -u admin /home/admin/config.scripts/lnd.keysend.sh ${choice}
dialog --msgbox "Accept Keysend is now ${choice} after Reboot." 5 46
else
echo "keysend setting unchanged."
fi
# 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
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
fi
fi
fi
else
echo "JoinMarket not changed."
fi
if [ ${anychange} -eq 0 ]; then if [ ${anychange} -eq 0 ]; then
dialog --msgbox "NOTHING CHANGED!\nUse Spacebar to check/uncheck services." 8 58 dialog --msgbox "NOTHING CHANGED!\nUse Spacebar to check/uncheck services." 8 58
exit 0 exit 0

View file

@ -204,7 +204,6 @@ if [ ${isMounted} -eq 1 ]; then
--menu "You need a copy of the Bitcoin Blockchain - choose method:" 13 75 5 \ --menu "You need a copy of the Bitcoin Blockchain - choose method:" 13 75 5 \
T "TORRENT --> Download thru Torrent (TRUSTED DEFAULT ±1day)" \ T "TORRENT --> Download thru Torrent (TRUSTED DEFAULT ±1day)" \
C "COPY --> Copy from laptop/node (OVER LAN ±6hours)" \ C "COPY --> Copy from laptop/node (OVER LAN ±6hours)" \
N "CLONE --> Clone from 2nd HDD (EXTRA POWER NEEDED ±6hours)"\
S "SYNC --> Selfvalidate all Blocks (VERY SLOW ±2month)" 2>&1 >/dev/tty) S "SYNC --> Selfvalidate all Blocks (VERY SLOW ±2month)" 2>&1 >/dev/tty)
# Bitcoin on stronger RaspberryPi4 (new DEFAULT) # Bitcoin on stronger RaspberryPi4 (new DEFAULT)
@ -240,9 +239,6 @@ if [ ${isMounted} -eq 1 ]; then
C) C)
/home/admin/50copyHDD.sh /home/admin/50copyHDD.sh
;; ;;
N)
/home/admin/50cloneHDD.sh
;;
S) S)
/home/admin/50syncHDD.sh /home/admin/50syncHDD.sh
/home/admin/10setupBlitz.sh /home/admin/10setupBlitz.sh

View file

@ -1,181 +0,0 @@
#!/bin/bash
# CLODE HDD
# Script to use the HDD of another RaspiBlitz (Ext4) or from another desktop computer (ExFAT)
# and copy blocckhain data over to RaspiBlitz HDD/SSD
## get basic info
source /home/admin/raspiblitz.info
echo ""
echo "*** Check 1st HDD ***"
sleep 4
hddA=$(lsblk | grep /mnt/hdd | grep -c sda1)
if [ ${hddA} -eq 0 ]; then
echo "FAIL - 1st HDD not found as sda1"
echo "Try 'sudo shutdown -r now'"
exit 1
fi
ready=0
while [ ${ready} -eq 0 ]
do
hddA=$(lsblk | grep /mnt/hdd | grep -c sda1)
if [ ${hddA} -eq 1 ]; then
echo "OK - HDD as sda1 found"
ready=1
fi
if [ ${hddA} -eq 0 ]; then
echo "FAIL - 1st HDD not found as sda1 or sda"
echo "Try 'sudo shutdown -r now'"
exit 1
fi
hddB=$(lsblk | grep -c sda)
if [ ${hddB} -eq 1 ]; then
echo "OK - HDD as sda found"
ready=1
fi
done
echo ""
echo "*** Clone Blockchain form a second HDD ***"
echo ""
echo "WARNING: The RaspiBlitz cannot run 2 HDDs without extra Power!"
echo ""
echo "You can use a Y cable for the second HDD to inject extra power"
echo "or add a USB Hub with extra power between Raspi and 2nd HDD."
echo "If you see on LCD a error on connecting the 2nd HDD do a restart."
echo ""
echo "You can use the HDD of another RaspiBlitz for this."
echo "The 2nd HDD needs to be formatted Ext4/exFAT and the folder '${network}' is in root of HDD."
echo "The the folder '${network}' needs to be in root of the 1st or 2nd partition on the HDD."
echo ""
echo "**********************************"
echo "--> Please connect now the 2nd HDD"
echo "**********************************"
echo ""
echo "If 2nd HDD is connected but setup does not continue,"
echo "then cancel (CTRL+c) and reboot."
ready=0
while [ ${ready} -eq 0 ]
do
found=$(lsblk | grep part | grep -c sdb)
if [ ${found} -gt 0 ]; then
echo "OK - 2nd HDD found as part of sdb"
ready=1
fi
done
echo ""
echo "*** Mounting 2nd HDD ***"
sudo mkdir /mnt/genesis 2>/dev/null
echo "try ext4 on sdb1 .."
sudo mount -t ext4 /dev/sdb1 /mnt/genesis
sleep 4
mountOK=$(lsblk | grep -c /mnt/genesis)
if [ ${mountOK} -eq 0 ]; then
echo "try exfat on sdb1 .."
sudo mount -t exfat /dev/sdb1 /mnt/genesis
sleep 4
fi
mountOK=$(lsblk | grep -c /mnt/genesis)
if [ ${mountOK} -eq 0 ]; then
echo "try ext4 on sdb .."
sudo mount -t ext4 /dev/sdb /mnt/genesis
sleep 4
fi
mountOK=$(lsblk | grep -c /mnt/genesis)
if [ ${mountOK} -eq 0 ]; then
echo "try exfat on sdb.."
sudo mount -t exfat /dev/sdb /mnt/genesis
sleep 4
fi
mountOK=$(lsblk | grep -c /mnt/genesis)
if [ ${mountOK} -eq 0 ]; then
echo "FAIL - not able to mount the 2nd HDD"
echo "only ext4 and exfat possible"
echo "PRESS ENTER to return to menu"
read key
./10setupBlitz.sh
exit 1
else
echo "OK - 2nd HDD mounted at /mnt/genesis"
fi
echo ""
echo "*** Copy Blockchain ***"
sudo rsync --append --info=progress2 -a /mnt/genesis/bitcoin/blocks /mnt/genesis/bitcoin/chainstate /mnt/hdd/bitcoin
sudo umount -l /mnt/genesis
echo "OK - Copy done :)"
echo ""
# echo "---> You can now disconnect the 2nd HDD"
# If the Odorid HC1 reboots with a HDD attached to the USB it prioritises it over the SATA
echo "---> Disconnect the 2nd HDD and press a Enter"
read key
# set SetupState
# sudo sed -i "s/^setupStep=.*/setupStep=50/g" /home/admin/raspiblitz.info
# sleep 5
#./60finishHDD.sh
# unlink bitcoin user (will created later in setup again)
sudo unlink /home/bitcoin/.bitcoin
# make quick check if data is there
anyDataAtAll=0
quickCheckOK=1
count=$(sudo find /mnt/hdd/bitcoin/ -iname *.dat -type f | wc -l)
if [ ${count} -gt 0 ]; then
echo "Found data in /mnt/hdd/bitcoin/blocks"
anyDataAtAll=1
fi
if [ ${count} -lt 300 ]; then
echo "FAIL: transfer seems invalid - less then 300 .dat files (${count})"
quickCheckOK=0
fi
count=$(sudo find /mnt/hdd/bitcoin/ -iname *.ldb -type f | wc -l)
if [ ${count} -gt 0 ]; then
echo "Found data in /mnt/hdd/bitcoin/chainstate"
anyDataAtAll=1
fi
if [ ${count} -lt 700 ]; then
echo "FAIL: transfer seems invalid - less then 700 .ldb files (${count})"
quickCheckOK=0
fi
# just if any data transferred ..
if [ ${anyDataAtAll} -eq 1 ]; then
# data was invalid - ask user to keep?
if [ ${quickCheckOK} -eq 0 ]; then
echo "*********************************************"
echo "There seems to be an invalid transfer."
echo "Wait 5 secs ..."
sleep 5
dialog --title " INVALID TRANSFER - DELETE DATA?" --yesno "Quickcheck shows the data you transferred is invalid/incomplete. This can lead further RaspiBlitz setup to get stuck in error state.\nDo you want to reset/delete data data?" 8 60
response=$?
echo "response(${response})"
case $response in
1) quickCheckOK=1 ;;
esac
fi
if [ ${quickCheckOK} -eq 0 ]; then
echo "Deleting invalid Data ..."
sudo rm -rf /mnt/hdd/bitcoin
sudo rm -rf /home/bitcoin/.bitcoin
sleep 2
fi
else
# when no data transferred - just delete bitcoin base dir again
sudo rm -rf /mnt/hdd/bitcoin
fi
if [ ${setupStep} -lt 100 ]; then
# setup script will decide the next logical step
/home/admin/10setupBlitz.sh
fi

View file

@ -66,8 +66,9 @@ echo ""
echo "Both computers (your RaspberryPi and the other computer with the full blockchain on) need" echo "Both computers (your RaspberryPi and the other computer with the full blockchain on) need"
echo "to be connected to the same local network." echo "to be connected to the same local network."
echo "" echo ""
echo "Open a terminal on the source computer and change into the directory that contains the" echo "If you use a RaspiBlitz (>=v1.5) as Blockchain source go: MENU > REPAIR > COPY-SOURCE"
echo "blockchain data. You should see directories 'blocks', 'chainstate'". echo "Otherwiese open a terminal on the source computer and change into the directory that"
echo "contains the blockchain data. You should see directories 'blocks' & 'chainstate'".
echo "Make sure the bitcoin client on that computer is stopped." echo "Make sure the bitcoin client on that computer is stopped."
echo "" echo ""
echo "COPY, PASTE & EXECUTE the following command on the blockchain source computer:" echo "COPY, PASTE & EXECUTE the following command on the blockchain source computer:"

View file

@ -21,6 +21,20 @@ fi
# bitcoin errors always first # bitcoin errors always first
if [ ${bitcoinActive} -eq 0 ] || [ ${#bitcoinErrorFull} -gt 0 ] || [ "${1}" == "blockchain-error" ]; then if [ ${bitcoinActive} -eq 0 ] || [ ${#bitcoinErrorFull} -gt 0 ] || [ "${1}" == "blockchain-error" ]; then
####################
# Copy Blockchain Source Mode
# https://github.com/rootzoll/raspiblitz/issues/1081
####################
if [ "${state}" = "copysource" ]; then
l1="Copy Blockchain Source Modus\n"
l2="Please restart RaspiBlitz when done.\n"
l3="Restart from Terminal: sudo shutdown -r now"
dialog --backtitle "RaspiBlitz ${codeVersion} (${state}) ${localIP}" --infobox "$l1$l2$l3" 5 45
sleep 3
exit 1
fi
#################### ####################
# On Bitcoin Error # On Bitcoin Error
#################### ####################

View file

@ -5,8 +5,10 @@ cd
cd /home/admin/assets cd /home/admin/assets
chmod +x lnbalance.sh chmod +x lnbalance.sh
chmod +x lnchannels.sh chmod +x lnchannels.sh
chmod +x lnfwdreport.sh
sudo cp lnbalance.sh /usr/local/bin/lnbalance sudo cp lnbalance.sh /usr/local/bin/lnbalance
sudo cp lnchannels.sh /usr/local/bin/lnchannels sudo cp lnchannels.sh /usr/local/bin/lnchannels
sudo cp lnfwdreport.sh /usr/local/bin/lnfwdreport
echo "OK" echo "OK"
mkdir /home/admin/tmpScriptDL mkdir /home/admin/tmpScriptDL

View file

@ -120,6 +120,7 @@ case $CHOICE in
exit 1; exit 1;
;; ;;
ZAP_IOS) ZAP_IOS)
choose_IP_or_TOR
appstoreLink="https://apps.apple.com/us/app/zap-bitcoin-lightning-wallet/id1406311960" appstoreLink="https://apps.apple.com/us/app/zap-bitcoin-lightning-wallet/id1406311960"
/home/admin/config.scripts/blitz.lcd.sh qr ${appstoreLink} /home/admin/config.scripts/blitz.lcd.sh qr ${appstoreLink}
whiptail --title "Install Testflight and Zap on your iOS device" \ whiptail --title "Install Testflight and Zap on your iOS device" \

View file

@ -46,11 +46,29 @@ RaspiBlitz image to your SD card.
" 12 40 " 12 40
} }
copyHost()
{
clear
sed -i "s/^state=.*/state=copysource/g" /home/admin/raspiblitz.info
sudo systemctl stop lnd
sudo systemctl stop ${network}d
cd /mnt/hdd/${network}
echo
echo "*** Copy Blockchain Source Modus ***"
echo "Your RaspiBlitz has now stopped LND and ${network}d ..."
echo "1. Use command to change to source dir: cd /mnt/hdd/$network"
echo "2. Then run the script given by the other RaspiBlitz in Terminal"
echo "3. When you are done - Restart RaspiBlitz: sudo shutdown -r now"
echo
exit 99
}
# Basic Options # Basic Options
OPTIONS=(HARDWARE "Run Hardwaretest" \ OPTIONS=(HARDWARE "Run Hardwaretest" \
SOFTWARE "Run Softwaretest (DebugReport)" \ SOFTWARE "Run Softwaretest (DebugReport)" \
BACKUP-LND "Backup your LND data (Rescue-File)" \ BACKUP-LND "Backup your LND data (Rescue-File)" \
MIGRATION "Migrate Blitz Data to new Hardware" \ MIGRATION "Migrate Blitz Data to new Hardware" \
COPY-SOURCE "Copy Blockchain Source Modus" \
RESET-CHAIN "Delete Blockchain & Re-Download" \ RESET-CHAIN "Delete Blockchain & Re-Download" \
RESET-LND "Delete LND & start new node/wallet" \ RESET-LND "Delete LND & start new node/wallet" \
RESET-HDD "Delete HDD Data but keep Blockchain" \ RESET-HDD "Delete HDD Data but keep Blockchain" \
@ -130,4 +148,7 @@ case $CHOICE in
sudo shutdown now sudo shutdown now
exit 1; exit 1;
;; ;;
COPY-SOURCE)
copyHost
;;
esac esac

View file

@ -106,6 +106,8 @@ else
sudo rm -f -r /mnt/hdd/tor sudo rm -f -r /mnt/hdd/tor
sudo rm -f -r /mnt/hdd/temp sudo rm -f -r /mnt/hdd/temp
sudo rm -f -r /mnt/hdd/ssh sudo rm -f -r /mnt/hdd/ssh
sudo rm -f -r /mnt/hdd/app-storage
sudo rm -f -r /mnt/hdd/app-data
sudo rm -f /mnt/hdd/swapfile sudo rm -f /mnt/hdd/swapfile
sudo rm -f /mnt/hdd/*.* sudo rm -f /mnt/hdd/*.*

View file

@ -17,7 +17,7 @@ pathBitcoinBlockchain="/mnt/hdd/bitcoin"
pathLitecoinBlockchain="/mnt/hdd/litecoin" pathLitecoinBlockchain="/mnt/hdd/litecoin"
# where to find the RaspiBlitz HDD template directory (no trailing /) # where to find the RaspiBlitz HDD template directory (no trailing /)
pathTemplateHDD="/mnt/hdd/templateHDD" pathTemplateHDD="/mnt/hdd/app-storage/templateHDD"
# 0 = ask before formatting/init new HDD # 0 = ask before formatting/init new HDD
# 1 = auto-formatting every new HDD that needs init # 1 = auto-formatting every new HDD that needs init
@ -41,44 +41,61 @@ if [ "$EUID" -ne 0 ]; then
exit 1 exit 1
fi fi
# get HDD info
source <(sudo /home/admin/config.scripts/blitz.datadrive.sh status)
# check if HDD is mounted
if [ ${isMounted} -eq 0 ]; then
echo "error='HDD is not mounted'"
exit 1
fi
# check if HDD is big enough
if [ ${hddGigaBytes} -lt 800 ]; then
echo "# To run copy station (+/- 1TB needed)"
echo "error='HDD is too small'"
exit 1
fi
# check that path information is valid
if [ -d "$pathBitcoinBlockchain" ]; then
echo "# OK found $pathBitcoinBlockchain"
else
echo "# FAIL path of 'pathBitcoinBlockchain' does not exists: ${pathBitcoinBlockchain}"
echo "error='pathBitcoinBlockchain nit found'"
exit 1
fi
# make sure that its running in screen # make sure that its running in screen
# call with '-foreground' to prevent running in screen # call with '-foreground' to prevent running in screen
if [ "$1" != "-foreground" ]; then if [ "$1" != "-foreground" ]; then
screenPID=$(screen -ls | grep "copystation" | cut -d "." -f1 | xargs) screenPID=$(screen -ls | grep "copystation" | cut -d "." -f1 | xargs)
if [ ${#screenPID} -eq 0 ]; then if [ ${#screenPID} -eq 0 ]; then
# start copystation in sreen # start copystation in sreen
echo "starting copystation screen session" echo "# starting copystation screen session"
screen -S copystation -dm /home/admin/XXcopyStation.sh -foreground screen -S copystation -dm /home/admin/XXcopyStation.sh -foreground
screen -d -r screen -d -r
exit 0 exit 0
else else
echo "changing into running copystation screen session" echo "# changing into running copystation screen session"
screen -d -r screen -d -r
exit 0 exit 0
fi fi
fi fi
clear clear
echo "******************************" echo "# ******************************"
echo "RASPIBLITZ COPYSTATION SCRIPT" echo "# RASPIBLITZ COPYSTATION SCRIPT"
echo "******************************" echo "# ******************************"
echo echo
echo "*** CHECKING CONFIG" echo "*** CHECKING CONFIG"
# check that path information is valid
if [ -d "$pathBitcoinBlockchain" ]; then
echo "OK found $pathBitcoinBlockchain"
else
echo "FAIL path of 'pathBitcoinBlockchain' does not exists: ${pathBitcoinBlockchain}"
exit 1
fi
# check that path information is valid # check that path information is valid
if [ -d "$pathTemplateHDD" ]; then if [ -d "$pathTemplateHDD" ]; then
echo "OK found $pathTemplateHDD" echo "# OK found $pathTemplateHDD"
else else
echo "Creating: ${pathTemplateHDD}" echo "# Creating: ${pathTemplateHDD}"
mkdir ${pathTemplateHDD} mkdir ${pathTemplateHDD}
chmod 777 ${pathTemplateHDD} chmod 777 ${pathTemplateHDD}
fi fi
@ -87,29 +104,26 @@ fi
systemctl stop lnd 2>/dev/null systemctl stop lnd 2>/dev/null
systemctl stop background 2>/dev/null systemctl stop background 2>/dev/null
#if [ "${nointeraction}" == "1" ]; then
if [ "${nointeraction}" == "1" ]; then # echo "setting RaspiBlitz LCD info"
echo "setting RaspiBlitz LCD info" # sudo sed -i "s/^state=.*/state=copystation/g" /home/admin/raspiblitz.info 2>/dev/null
sudo sed -i "s/^state=.*/state=copystation/g" /home/admin/raspiblitz.info 2>/dev/null # sudo sed -i "s/^message=.*/message='Disconnect target HDDs!'/g" /home/admin/raspiblitz.info 2>/dev/null
sudo sed -i "s/^message=.*/message='Disconnect target HDDs!'/g" /home/admin/raspiblitz.info 2>/dev/null # echo "Disconnect target HDDs! .. 30sec until continue."
echo "Disconnect target HDDs! .. 30ses until continue." # sleep 30
sleep 30 #else
else # echo
echo # echo "*** INIT HDD SCAN"
echo "*** INIT HDD SCAN" # echo "Please make sure that no HDDs that you want to sync later to are not connected now."
echo "Please make sure that no HDDs that you want to sync later to are not connected now." # echo "PRESS ENTER when ready."
echo "PRESS ENTER when ready." # read key
read key #fi
fi
# finding system drives (the drives that should not be synced to) # finding system drives (the drives that should not be synced to)
systemDrives=$(lsblk -o NAME | grep "^sd") echo "# OK - the following drives detected as the system drive: $datadisk"
echo "OK - the following drives detected as system drives:"
echo "$systemDrives"
echo echo
if [ "${nointeraction}" == "1" ]; then if [ "${nointeraction}" == "1" ]; then
sudo sed -i "s/^message=.*/message='Connect now target HDDs ..'/g" /home/admin/raspiblitz.info 2>/dev/null sudo sed -i "s/^message=.*/message='Connect target HDDs ..'/g" /home/admin/raspiblitz.info 2>/dev/null
sleep 5 sleep 5
fi fi
@ -132,7 +146,7 @@ do
# only execute every 30min # only execute every 30min
nowTimestamp=$(date +%s) nowTimestamp=$(date +%s)
secondsDiff=$(echo "${nowTimestamp}-${lastBlockchainUpdateTimestamp}" | bc) secondsDiff=$(echo "${nowTimestamp}-${lastBlockchainUpdateTimestamp}" | bc)
echo "seconds since last update from bitcoind: ${secondsDiff}" echo "# seconds since last update from bitcoind: ${secondsDiff}"
echo echo
if [ ${secondsDiff} -gt 3000 ]; then if [ ${secondsDiff} -gt 3000 ]; then
@ -142,42 +156,45 @@ do
echo "******************************" echo "******************************"
# stop blockchains # stop blockchains
echo "Stopping Blockchain ..." echo "# Stopping Blockchain ..."
systemctl stop bitcoind 2>/dev/null systemctl stop bitcoind 2>/dev/null
systemctl stop litecoind 2>/dev/null systemctl stop litecoind 2>/dev/null
sleep 10 sleep 10
# sync bitcoin # sync bitcoin
echo "Syncing Bitcoin ..." echo "# Syncing Bitcoin to template folder ..."
sudo sed -i "s/^message=.*/message='Updating Template: Bitcoin'/g" /home/admin/raspiblitz.info 2>/dev/null sudo sed -i "s/^message=.*/message='Updating Template: Bitcoin'/g" /home/admin/raspiblitz.info 2>/dev/null
# make sure the bitcoin directory in template folder exists # make sure the bitcoin directory in template folder exists
if [ ! -d "$pathTemplateHDD/bitcoin" ]; then if [ ! -d "$pathTemplateHDD/bitcoin" ]; then
echo "creating the bitcoin subfolder in the template folder" echo "# creating the bitcoin subfolder in the template folder"
mkdir ${pathTemplateHDD}/bitcoin mkdir ${pathTemplateHDD}/bitcoin
chmod 777 ${pathTemplateHDD}/bitcoin chmod 777 ${pathTemplateHDD}/bitcoin
fi fi
rsync -a --info=progress2 ${pathBitcoinBlockchain}/chainstate ${pathBitcoinBlockchain}/blocks ${pathBitcoinBlockchain}/testnet3 ${pathTemplateHDD}/bitcoin # do the sync to the template folder for BITCOIN
rsync -a --info=progress2 --delete ${pathBitcoinBlockchain}/chainstate ${pathBitcoinBlockchain}/blocks ${pathTemplateHDD}/bitcoin
if [ -d "${pathLitecoinBlockchain}" ]; then litecoindirsize=$(sudo du -s -b /mnt/hdd/litecoin | awk '$1=$1' | cut -d " " -f1)
if [ -d "${pathLitecoinBlockchain}" ] && [ ${litecoindirsize} -gt 1000000000 ]; then
# sync litecoin # sync litecoin
echo "Syncing Litecoin ..." echo "# Syncing Litecoin ..."
echo "creating the litecoin subfolder in the template folder" echo "# creating the litecoin subfolder in the template folder"
mkdir ${pathTemplateHDD}/litecoin 2>/dev/null mkdir ${pathTemplateHDD}/litecoin 2>/dev/null
chmod 777 ${pathTemplateHDD}/litecoin 2>/dev/null chmod 777 ${pathTemplateHDD}/litecoin 2>/dev/null
sudo sed -i "s/^message=.*/message='Updating Template: Litecoin'/g" /home/admin/raspiblitz.info 2>/dev/null sudo sed -i "s/^message=.*/message='Updating Template: Litecoin'/g" /home/admin/raspiblitz.info 2>/dev/null
rsync -a --info=progress2 ${pathLitecoinBlockchain}/chainstate ${pathLitecoinBlockchain}/blocks ${pathTemplateHDD}/litecoin # do the sync to the template folder for LITECOIN
rsync -a --info=progress2 --delete ${pathLitecoinBlockchain}/chainstate ${pathLitecoinBlockchain}/blocks ${pathTemplateHDD}/litecoin
fi fi
# restart bitcoind (to let further setup while syncing HDDs) # restart bitcoind (to let further setup while syncing HDDs)
echo "Restarting Blockchain ..." echo "# Restarting Blockchain ..."
systemctl start bitcoind 2>/dev/null systemctl start bitcoind 2>/dev/null
systemctl start litecoind 2>/dev/null systemctl start litecoind 2>/dev/null
@ -188,10 +205,16 @@ do
################################################ ################################################
# 2. detect connected HDDs and loop thru them # 2. detect connected HDDs and loop thru them
echo
echo "**************************************"
echo "SYNCING TEMPLATE -> CONNECTED HDD/SSDs"
echo "**************************************"
echo "NOTE: Only use to prepare fresh HDDs"
sleep 4 sleep 4
echo "" > ./.syncinfo.tmp echo "" > ./.syncinfo.tmp
lsblk -o NAME | grep "^sd" | while read -r detectedDrive ; do lsblk -o NAME | grep "^sd" | while read -r detectedDrive ; do
isSystemDrive=$(echo "${systemDrives}" | grep -c "${detectedDrive}") isSystemDrive=$(echo "${datadisk}" | grep -c "${detectedDrive}")
if [ ${isSystemDrive} -eq 0 ]; then if [ ${isSystemDrive} -eq 0 ]; then
# check if drives 1st partition is named BLOCKCHAIN & in EXT4 format # check if drives 1st partition is named BLOCKCHAIN & in EXT4 format
@ -210,41 +233,17 @@ do
size=$(lsblk -o NAME,SIZE -b | grep "^${detectedDrive}" | awk '$1=$1' | cut -d " " -f 2) size=$(lsblk -o NAME,SIZE -b | grep "^${detectedDrive}" | awk '$1=$1' | cut -d " " -f 2)
echo "size: ${size}" echo "size: ${size}"
if [ ${size} -lt 250000000000 ]; then if [ ${size} -lt 250000000000 ]; then
read key
whiptail --title "FAIL" --msgbox " whiptail --title "FAIL" --msgbox "
THE DEVICE IS TOO SMALL <250GB THE DEVICE IS TOO SMALL <250GB
Please remove device and PRESS ENTER Please remove device and PRESS ENTER
" 9 46 " 9 46
else else
# find biggest partition
biggestSize=0
lsblk -o NAME,SIZE -b | grep "${detectedDrive}" | while read -r partitionLine ; do
partition=$(echo "${partitionLine}" | cut -d ' ' -f 1 | tr -cd "[:alnum:]")
size=$(echo "${partitionLine}" | tr -cd "[0-9]")
if [ ${size} -gt ${biggestSize} ]; then
formatPartition="${partition}"
biggestSize=$size
fi
echo "${formatPartition}" > .formatPartition.tmp
done
formatPartition=$(cat .formatPartition.tmp)
rm .formatPartition.tmp
if [ ${#formatPartition} -eq 0 ]; then
whiptail --title "FAIL" --msgbox "
NO PARTITIONS FOUND ON THAT DEVICE
Format on external computer with FAT32 first.
Please remove device now.
" 10 46
else
# if config value "nointeraction=1" default to format # if config value "nointeraction=1" default to format
if [ "${nointeraction}" != "1" ]; then if [ "${nointeraction}" != "1" ]; then
whiptail --title "Format HDD" --yes-button "Format" --no-button "Cancel" --yesno " whiptail --title "Format HDD" --yes-button "Format" --no-button "Cancel" --yesno "
Found new HDD. Do you want to FORMAT now? Found new HDD. Do you want to FORMAT now?
Please temp lable device with: ${formatPartition} Lable of device with: ${detectedDrive}
" 10 54 " 10 54
choice=$? choice=$?
else else
@ -261,10 +260,8 @@ OK NO FORMAT - Please remove decive now.
fi fi
# format the HDD # format the HDD
echo "Starting Formatting of device ..." echo "Starting Formatting of device ${detectedDrive} ..."
sudo mkfs.ext4 /dev/${formatPartition} -F -L BLOCKCHAIN sudo /home/admin/config.scripts/blitz.datadrive.sh format ext4 ${detectedDrive}
fi
fi fi
@ -284,15 +281,13 @@ OK NO FORMAT - Please remove decive now.
# rsync device # rsync device
mountOK=$(lsblk -o NAME,MOUNTPOINT | grep "${detectedDrive}" | grep -c "/mnt/hdd2") mountOK=$(lsblk -o NAME,MOUNTPOINT | grep "${detectedDrive}" | grep -c "/mnt/hdd2")
if [ ${mountOK} -eq 1 ]; then if [ ${mountOK} -eq 1 ]; then
if [ "${nointeraction}" == "1" ]; then sudo sed -i "s/^message=.*/message='Syncing Template -> ${partition}'/g" /home/admin/raspiblitz.info 2>/dev/null
sudo sed -i "s/^message=.*/message='Syncing from Template: ${partition}'/g" /home/admin/raspiblitz.info 2>/dev/null rsync -a --info=progress2 --delete ${pathTemplateHDD}/* /mnt/hdd2
fi sudo chmod -R 777 /mnt/hdd2
rsync -a --info=progress2 ${pathTemplateHDD}/* /mnt/hdd2
chmod -r 777 /mnt/hdd2
rm -r /mnt/hdd2/lost+found 2>/dev/null rm -r /mnt/hdd2/lost+found 2>/dev/null
echo "${partition} " >> ./.syncinfo.tmp echo "${partition} " >> ./.syncinfo.tmp
else else
echo "FAIL: was not able to mount --> ${partition}" echo "# FAIL: was not able to mount --> ${partition}"
fi fi
# unmount device # unmount device
@ -309,6 +304,7 @@ OK NO FORMAT - Please remove decive now.
echo "HDDs ready synced: ${synced}" echo "HDDs ready synced: ${synced}"
echo "*************************" echo "*************************"
echo "Its safe to disconnect/remove HDDs now." echo "Its safe to disconnect/remove HDDs now."
echo "Or connect a new HDD/SSD for syncing."
echo "To stop copystation script: CTRL+c" echo "To stop copystation script: CTRL+c"
echo "" echo ""

View file

@ -134,6 +134,16 @@ else
echo "" echo ""
fi fi
if [ "${specter}" = "on" ]; then
echo "*** LAST 20 SPECTER LOGS ***"
echo "sudo journalctl -u cryptoadvance-specter -b --no-pager -n20"
sudo journalctl -u cryptoadvance-specter -b --no-pager -n20
echo ""
else
echo "- SPECTER is OFF by config"
echo ""
fi
echo "*** HARDWARE TEST RESULTS ***" echo "*** HARDWARE TEST RESULTS ***"
showImproveInfo=0 showImproveInfo=0
if [ ${#undervoltageReports} -gt 0 ]; then if [ ${#undervoltageReports} -gt 0 ]; then

38
home.admin/XXlnfwdreport.sh Executable file
View file

@ -0,0 +1,38 @@
#!/bin/bash
_temp="./download/dialog.$$"
_error="./.error.out"
# load raspiblitz config data (with backup from old config)
source /home/admin/raspiblitz.info
source /mnt/hdd/raspiblitz.conf
if [ ${#network} -eq 0 ]; then network=`cat .network`; fi
if [ ${#network} -eq 0 ]; then network="bitcoin"; fi
if [ ${#chain} -eq 0 ]; then
echo "gathering chain info ... please wait"
chain=$(${network}-cli getblockchaininfo | jq -r '.chain')
fi
# let user enter a <pubkey>@host
l1="Enter the number of days to query:"
l2="e.g. '7' will query the last 7 days"
dialog --title "Create a forwarding event report" \
--backtitle "Lightning ( ${network} | ${chain} )" \
--inputbox "$l1\n$l2" 10 60 7 2>$_temp
_input=$(cat $_temp | xargs )
shred $_temp
if [ ${#_input} -eq 0 ]; then
exit 1
fi
# build command
command="lnfwdreport -n ${chain}net -c ${network} -- ${_input}"
clear
echo "Generating report..."
# execute command
result=$($command 2>$_error)
echo ""
echo ""
echo "$result"
echo ""

View file

@ -9,6 +9,12 @@ echo "they will get recreated on fresh bootup, by _bootstrap.sh service"
sudo rm /etc/ssh/ssh_host_* sudo rm /etc/ssh/ssh_host_*
echo "OK" echo "OK"
# https://github.com/rootzoll/raspiblitz/issues/1068#issuecomment-599267503
echo ""
echo "deleting local DNS confs ..."
sudo rm /etc/resolv.conf
echo "OK"
echo " " echo " "
echo "Will shutdown now." echo "Will shutdown now."
echo "Wait until Raspberry LEDs show no activity anymore." echo "Wait until Raspberry LEDs show no activity anymore."

View file

@ -324,13 +324,13 @@ else
fi fi
# LCD ROTATE # LCD ROTATE
if [ "${#lcdrotate}" -gt 0 ]; then if [ "${#lcdrotate}" -eq 0 ]; then
# when upgrading from an old raspiblitz - enforce lcdrotate = 0
lcdrotate=0
fi
echo "Provisioning LCD rotate - run config script" >> ${logFile} echo "Provisioning LCD rotate - run config script" >> ${logFile}
sudo sed -i "s/^message=.*/message='LCD Rotate'/g" ${infoFile} sudo sed -i "s/^message=.*/message='LCD Rotate'/g" ${infoFile}
sudo /home/admin/config.scripts/blitz.lcdrotate.sh ${lcdrotate} >> ${logFile} 2>&1 sudo /home/admin/config.scripts/blitz.lcdrotate.sh ${lcdrotate} >> ${logFile} 2>&1
else
echo "Provisioning LCD rotate - not active" >> ${logFile}
fi
# TOUCHSCREEN # TOUCHSCREEN
if [ "${#touchscreen}" -gt 0 ]; then if [ "${#touchscreen}" -gt 0 ]; then
@ -359,6 +359,24 @@ else
echo "Provisioning LNBits - keep default" >> ${logFile} echo "Provisioning LNBits - keep default" >> ${logFile}
fi fi
# JoinMarket
if [ "${joinmarket}" = "on" ]; then
echo "Provisioning JoinMarket - run config script" >> ${logFile}
sudo sed -i "s/^message=.*/message='Setup JoinMarket'/g" ${infoFile}
sudo /home/admin/config.scripts/bonus.joinmarket.sh on >> ${logFile} 2>&1
else
echo "Provisioning JoinMarket - keep default" >> ${logFile}
fi
# JoinMarket
if [ "${specter}" = "on" ]; then
echo "Provisioning Specter - run config script" >> ${logFile}
sudo sed -i "s/^message=.*/message='Setup Specter'/g" ${infoFile}
sudo -u admin /home/admin/config.scripts/bonus.cryptoadvance-specter.sh on >> ${logFile} 2>&1
else
echo "Provisioning Specter - keep default" >> ${logFile}
fi
# replay backup LND conf & tlscerts # replay backup LND conf & tlscerts
# https://github.com/rootzoll/raspiblitz/issues/324 # https://github.com/rootzoll/raspiblitz/issues/324
echo "" >> ${logFile} echo "" >> ${logFile}

View file

@ -147,15 +147,37 @@ fi
# the sd card - switch to hdmi # the sd card - switch to hdmi
################################ ################################
forceHDMIoutput=$(sudo ls /boot/hdmi 2>/dev/null | grep -c hdmi) forceHDMIoutput=$(sudo ls /boot/hdmi* 2>/dev/null | grep -c hdmi)
if [ ${forceHDMIoutput} -eq 1 ]; then if [ ${forceHDMIoutput} -eq 1 ]; then
# delete that file (to prevent loop) # delete that file (to prevent loop)
sudo rm /boot/hdmi sudo rm /boot/hdmi*
# switch to HDMI what will trigger reboot # switch to HDMI what will trigger reboot
sudo /home/admin/config.scripts/blitz.lcd.sh hdmi on sudo /home/admin/config.scripts/blitz.lcd.sh hdmi on
exit 0 exit 0
fi fi
################################
# SSH SERVER CERTS RESET
# if a file called 'ssh.reset' gets
# placed onto the boot part of
# the sd card - switch to hdmi
################################
sshReset=$(sudo ls /boot/ssh.reset* 2>/dev/null | grep -c reset)
if [ ${sshReset} -eq 1 ]; then
# delete that file (to prevent loop)
sudo rm /boot/ssh.reset*
# show info ssh reset
sed -i "s/^state=.*/state=sshreset/g" ${infoFile}
sed -i "s/^message=.*/message='resetting SSH & reboot'/g" ${infoFile}
# delete ssh certs
sudo systemctl stop sshd
sudo rm /mnt/hdd/ssh/ssh_host*
sudo ssh-keygen -A
sudo /home/admin/XXshutdown.sh reboot
exit 0
fi
################################ ################################
# WAIT FOR LOCAL NETWORK # WAIT FOR LOCAL NETWORK
################################ ################################

View file

@ -1,2 +1,2 @@
# RaspiBlitz Version - always [main].[sub] # RaspiBlitz Version - always [main].[sub]
codeVersion="1.4" codeVersion="1.5"

View file

@ -1,19 +0,0 @@
# Raspibolt RTL: systemd unit for RTL
# /etc/systemd/system/RTL.service
[Unit]
Description=RTL daemon
Wants=lnd.service
After=lnd.service
[Service]
ExecStart=/usr/bin/node /home/admin/RTL/rtl --lndir /home/admin/.lnd/data/chain/bitcoin/mainnet
User=root
Restart=always
TimeoutSec=120
RestartSec=30
StandardOutput=null
StandardError=journal
[Install]
WantedBy=multi-user.target

Binary file not shown.

View file

@ -11,7 +11,7 @@ After=bitcoind.service
[Service] [Service]
EnvironmentFile=/mnt/hdd/raspiblitz.conf EnvironmentFile=/mnt/hdd/raspiblitz.conf
ExecStartPre=-/home/admin/config.scripts/blitz.systemd.sh log lightning STARTED ExecStartPre=-/home/admin/config.scripts/blitz.systemd.sh log lightning STARTED
ExecStart=/usr/local/bin/lnd --externalip=${publicIP}:${lndPort} ExecStart=/usr/local/bin/lnd --externalip=${publicIP}:${lndPort} ${lndExtraParameter}
PIDFile=/home/bitcoin/.lnd/lnd.pid PIDFile=/home/bitcoin/.lnd/lnd.pid
User=bitcoin User=bitcoin
Group=bitcoin Group=bitcoin

View file

@ -0,0 +1,74 @@
#!/bin/bash
network=mainnet
chain=bitcoin
if [ $# -gt 1 ]; then
while [ -n "$1" ]; do # while loop starts
case "$1" in
-c) chain=$2
shift
;;
-n)
network="$2"
shift
;;
--)
shift # The double dash makes them parameters
break
;;
*) echo "Option $1 not recognized" ;;
esac
shift
done
fi
days=${1:-1}
start_date=$(date -d "$date -$days days" +%s)
declare -A pubKeyAliasLookup
while IFS= read -r pubKey
do
alias=$(lncli --network $network --chain $chain getnodeinfo $pubKey | jq '.node.alias')
alias=${alias:1:-1}
pubKeyAliasLookup[$pubKey]=$alias
# echo $pubKey : ${pubKeyAliasLookup[$pubKey]}
done < <(lncli --network $network --chain $chain listpeers | jq '.peers[].pub_key' | tr -d '"')
declare -A channelIdPubKeyLookup
while IFS=, read -r remotePubKey channelId
do
channelIdPubKeyLookup[$channelId]=$remotePubKey
done < <(lncli --network $network --chain $chain listchannels \
| jq --raw-output '.channels[] | [.remote_pubkey,.chan_id] | @csv' \
| tr -d '"')
OUTPUT="Date,Channel In,Channel Out,Amount,Fee
----------------,----------,-----------,------,---"
declare -i index_offset=0
while :
do
events=$(lncli --network $network --chain $chain fwdinghistory --start_time $start_date --index_offset $index_offset \
| jq -r '(([.last_offset_index, (.forwarding_events | length)]) | @csv),
(.forwarding_events[]
| [(.timestamp | tonumber | strftime("%a %d %h %H:%M")), .chan_id_in, .chan_id_out, .amt_out, .fee]
| @csv)' \
| tr -d '"')
IFS=, read last_offset_index event_count <<< "$events"
while IFS=, read eventDate channelIdIn channelIdOut amountIn fee
do
channelInPubKey=${channelIdPubKeyLookup[$channelIdIn]}
channelOutPubKey=${channelIdPubKeyLookup[$channelIdOut]}
OUTPUT="${OUTPUT}
${eventDate},${pubKeyAliasLookup[$channelInPubKey]},${pubKeyAliasLookup[$channelOutPubKey]},$amountIn,$fee"
done < <(tail -n +2 <<< $events)
if [ $event_count -lt 100 ]; then break; fi
index_offset=$last_offset_index
done
column -t -s',' <<< "$OUTPUT"

View file

@ -196,6 +196,12 @@ if [ "$1" = "status" ]; then
echo "hddGotBlockchain=0" echo "hddGotBlockchain=0"
fi fi
# check size in bytes and GBs
size=$(lsblk -o NAME,SIZE -b | grep "^${hdd}" | awk '$1=$1' | cut -d " " -f 2)
echo "hddBytes=${size}"
hddGigaBytes=$(echo "scale=0; ${size}/1024/1024/1024" | bc -l)
echo "hddGigaBytes=${hddGigaBytes}"
# used space - at the moment just string info to display # used space - at the moment just string info to display
if [ ${isBTRFS} -eq 0 ]; then if [ ${isBTRFS} -eq 0 ]; then
# EXT4 calculations # EXT4 calculations
@ -297,14 +303,16 @@ if [ "$1" = "format" ]; then
exit 1 exit 1
fi fi
>&2 echo "# Checking on SWAP" # get basic info on data drives
if [ ${isSwapExternal} -eq 1 ]; then source <(sudo /home/admin/config.scripts/blitz.datadrive.sh status)
>&2 echo "# Switching off external SWAP"
if [ ${isSwapExternal} -eq 1 ] && [ "${hdd}" == "${datadisk}" ]; then
>&2 echo "# Switching off external SWAP of system drive"
sudo dphys-swapfile swapoff 1>/dev/null sudo dphys-swapfile swapoff 1>/dev/null
sudo dphys-swapfile uninstall 1>/dev/null sudo dphys-swapfile uninstall 1>/dev/null
fi fi
>&2 echo "# Unmounting all data drives" >&2 echo "# Unmounting all partitions of this device"
# remove device from all system mounts (also fstab) # remove device from all system mounts (also fstab)
lsblk -o NAME,UUID | grep "${hdd}" | awk '$1=$1' | cut -d " " -f 2 | grep "-" | while read -r uuid ; do lsblk -o NAME,UUID | grep "${hdd}" | awk '$1=$1' | cut -d " " -f 2 | grep "-" | while read -r uuid ; do
>&2 echo "# Cleaning /etc/fstab from ${uuid}" >&2 echo "# Cleaning /etc/fstab from ${uuid}"
@ -313,7 +321,8 @@ if [ "$1" = "format" ]; then
done done
sudo mount -a sudo mount -a
# unmount drives if [ "${hdd}" == "${datadisk}" ]; then
>&2 echo "# Make sure system drives are unmounted .."
sudo umount /mnt/hdd 2>/dev/null sudo umount /mnt/hdd 2>/dev/null
sudo umount /mnt/temp 2>/dev/null sudo umount /mnt/temp 2>/dev/null
sudo umount /mnt/storage 2>/dev/null sudo umount /mnt/storage 2>/dev/null
@ -332,6 +341,7 @@ if [ "$1" = "format" ]; then
echo "error='failed to unmount /mnt/storage'" echo "error='failed to unmount /mnt/storage'"
exit 1 exit 1
fi fi
fi
# wipe all partitions and write fresh GPT # wipe all partitions and write fresh GPT
>&2 echo "# Wiping all partitions" >&2 echo "# Wiping all partitions"
@ -354,6 +364,9 @@ fi
# formatting old: EXT4 # formatting old: EXT4
if [ "$1" = "format" ] && [ "$2" = "ext4" ]; then if [ "$1" = "format" ] && [ "$2" = "ext4" ]; then
# prepare temo mount point
sudo mkdir -p /tmp/ext4 1>/dev/null
# write new EXT4 partition # write new EXT4 partition
>&2 echo "# Creating the one big partition" >&2 echo "# Creating the one big partition"
sudo parted /dev/${hdd} mkpart primary ext4 0% 100% 1>/dev/null 2>/dev/null sudo parted /dev/${hdd} mkpart primary ext4 0% 100% 1>/dev/null 2>/dev/null
@ -376,10 +389,10 @@ if [ "$1" = "format" ] && [ "$2" = "ext4" ]; then
done done
# make sure /mnt/hdd is unmounted before formatting # make sure /mnt/hdd is unmounted before formatting
sudo umount -f /mnt/hdd 2>/dev/null sudo umount -f /tmp/ext4 2>/dev/null
unmounted=$(df | grep -c "/mnt/hdd") unmounted=$(df | grep -c "/tmp/ext4")
if [ ${unmounted} -gt 0 ]; then if [ ${unmounted} -gt 0 ]; then
echo "error='failed to unmount /mnt/hdd'" echo "error='failed to unmount /tmp/ext4'"
exit 1 exit 1
fi fi
@ -402,7 +415,7 @@ if [ "$1" = "format" ] && [ "$2" = "ext4" ]; then
# setting fsk check intervall to 1 # setting fsk check intervall to 1
# see https://github.com/rootzoll/raspiblitz/issues/360#issuecomment-467567572 # see https://github.com/rootzoll/raspiblitz/issues/360#issuecomment-467567572
sudo tune2fs -c 1 /dev/sda1 sudo tune2fs -c 1 /dev/${hdd}1
>&2 echo "# OK EXT 4 format done" >&2 echo "# OK EXT 4 format done"
exit 0 exit 0

View file

@ -21,7 +21,7 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
# add default 'lcdrotate' raspiblitz.conf if needed # add default 'lcdrotate' raspiblitz.conf if needed
if [ ${#lcdrotate} -eq 0 ]; then if [ ${#lcdrotate} -eq 0 ]; then
echo "lcdrotate=0" >> /mnt/hdd/raspiblitz.conf echo "lcdrotate=1" >> /mnt/hdd/raspiblitz.conf
fi fi
sudo sed -i "s/^dtoverlay=.*/dtoverlay=tft35a:rotate=90/g" /boot/config.txt sudo sed -i "s/^dtoverlay=.*/dtoverlay=tft35a:rotate=90/g" /boot/config.txt
@ -42,6 +42,11 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then
echo "Turn OFF: LCD ROTATE" echo "Turn OFF: LCD ROTATE"
# add default 'lcdrotate' raspiblitz.conf if needed
if [ ${#lcdrotate} -eq 0 ]; then
echo "lcdrotate=0" >> /mnt/hdd/raspiblitz.conf
fi
sudo sed -i "s/^dtoverlay=.*/dtoverlay=tft35a:rotate=270/g" /boot/config.txt sudo sed -i "s/^dtoverlay=.*/dtoverlay=tft35a:rotate=270/g" /boot/config.txt
sudo sed -i "s/^lcdrotate=.*/lcdrotate=0/g" /mnt/hdd/raspiblitz.conf sudo sed -i "s/^lcdrotate=.*/lcdrotate=0/g" /mnt/hdd/raspiblitz.conf

View file

@ -208,44 +208,55 @@ elif [ "${abcd}" = "b" ]; then
# RTL - keep settings from current RTL-Config.json # RTL - keep settings from current RTL-Config.json
if [ "${rtlWebinterface}" == "on" ]; then if [ "${rtlWebinterface}" == "on" ]; then
echo "# changing RTL password" echo "# changing RTL password"
cp /home/admin/RTL/RTL-Config.json /home/admin/RTL/backup-RTL-Config.json cp /home/rtl/RTL/RTL-Config.json /home/rtl/RTL/backup-RTL-Config.json
# remove hashed old password # remove hashed old password
#sed -i "/\b\(multiPassHashed\)\b/d" ./RTL-Config.json #sed -i "/\b\(multiPassHashed\)\b/d" ./RTL-Config.json
# set new password # set new password
chmod 600 /home/admin/RTL/RTL-Config.json || exit 1 cp /home/rtl/RTL/RTL-Config.json /home/admin/RTL-Config.json
node > /home/admin/RTL/RTL-Config.json <<EOF chown admin:admin /home/admin/RTL-Config.json
chmod 600 /home/admin/RTL-Config.json || exit 1
node > /home/admin/RTL-Config.json <<EOF
//Read data //Read data
var data = require('/home/admin/RTL/backup-RTL-Config.json'); var data = require('/home/rtl/RTL/backup-RTL-Config.json');
//Manipulate data //Manipulate data
data.multiPassHashed = null; data.multiPassHashed = null;
data.multiPass = '$newPassword'; data.multiPass = '$newPassword';
//Output data //Output data
console.log(JSON.stringify(data, null, 2)); console.log(JSON.stringify(data, null, 2));
EOF EOF
rm -f /home/admin/RTL/backup-RTL-Config.json rm -f /home/rtl/RTL/backup-RTL-Config.json
rm -f /home/rtl/RTL/RTL-Config.json
mv /home/admin/RTL-Config.json /home/rtl/RTL/
chown rtl:rtl /home/rtl/RTL/RTL-Config.json
fi fi
# electrs # electrs
if [ "${ElectRS}" == "on" ]; then if [ "${ElectRS}" == "on" ]; then
echo "# changing ELECTRS password" echo "# changing the RPC password for ELECTRS"
RPC_USER=$(cat /mnt/hdd/bitcoin/bitcoin.conf | grep rpcuser | cut -c 9-) RPC_USER=$(cat /mnt/hdd/bitcoin/bitcoin.conf | grep rpcuser | cut -c 9-)
sed -i "s/^cookie = \"$RPC_USER.*\"/cookie = \"$RPC_USER:${newPassword}\"/g" /home/electrs/.electrs/config.toml 2>/dev/null sed -i "s/^cookie = \"$RPC_USER.*\"/cookie = \"$RPC_USER:${newPassword}\"/g" /home/electrs/.electrs/config.toml 2>/dev/null
fi fi
# BTC-RPC-Explorer # BTC-RPC-Explorer
if [ "${BTCRPCexplorer}" = "on" ]; then if [ "${BTCRPCexplorer}" = "on" ]; then
echo "# changing BTCRPCEXPLORER password" echo "# changing the RPC password for BTCRPCEXPLORER"
sed -i "s/^BTCEXP_BITCOIND_URI=$network:\/\/$RPC_USER:.*@127.0.0.1:8332?timeout=10000/BTCEXP_BITCOIND_URI=$network:\/\/$RPC_USER:${newPassword}@127.0.0.1:8332\?timeout=10000/g" /home/bitcoin/.config/btc-rpc-explorer.env 2>/dev/null sed -i "s/^BTCEXP_BITCOIND_PASS=.*/BTCEXP_BITCOIND_PASS=${newPassword}/g" /home/btcrpcexplorer/.config/btc-rpc-explorer.env 2>/dev/null
sed -i "s/^BTCEXP_BITCOIND_PASS=.*/BTCEXP_BITCOIND_PASS=${newPassword}/g" /home/bitcoin/.config/btc-rpc-explorer.env 2>/dev/null sed -i "s/^BTCEXP_BASIC_AUTH_PASSWORD=.*/BTCEXP_BASIC_AUTH_PASSWORD=${newPassword}/g" /home/btcrpcexplorer/.config/btc-rpc-explorer.env 2>/dev/null
sed -i "s/^BTCEXP_BASIC_AUTH_PASSWORD=.*/BTCEXP_BASIC_AUTH_PASSWORD=${newPassword}/g" /home/bitcoin/.config/btc-rpc-explorer.env 2>/dev/null
fi fi
# BTCPayServer # BTCPayServer
if [ "${BTCPayServer}" == "on" ]; then if [ "${BTCPayServer}" == "on" ]; then
echo "# changing BTCPAYSERVER password" echo "# changing the RPC password for BTCPAYSERVER"
sed -i "s/^btc.rpc.password=.*/btc.rpc.password=${newPassword}/g" /home/btcpay/.nbxplorer/Main/settings.config 2>/dev/null sed -i "s/^btc.rpc.password=.*/btc.rpc.password=${newPassword}/g" /home/btcpay/.nbxplorer/Main/settings.config 2>/dev/null
fi fi
# JoinMarket
if [ "${joinmarket}" == "on" ]; then
echo "# changing the RPC password for JOINMARKET"
sed -i "s/^rpc_password =.*/rpc_password = ${newPassword}/g" /home/joinmarket/.joinmarket/joinmarket.cfg 2>/dev/null
echo "# changing the password for the 'joinmarket' user"
echo "joinmarket:${newPassword}" | sudo chpasswd
fi
echo "# OK -> RPC Password B changed" echo "# OK -> RPC Password B changed"
echo "# Reboot is needed" echo "# Reboot is needed"
exit 0 exit 0

View file

@ -221,7 +221,7 @@ if [ ${lndRunning} -eq 1 ]; then
# lnd scan progress # lnd scan progress
scanTimestamp=$(echo ${lndinfo} | jq -r '.best_header_timestamp') scanTimestamp=$(echo ${lndinfo} | jq -r '.best_header_timestamp')
nowTimestamp=$(date +%s) nowTimestamp=$(date +%s)
if [ ${scanTimestamp} -gt ${nowTimestamp} ]; then if [ ${#scanTimestamp} -gt 0 ] && [ ${scanTimestamp} -gt ${nowTimestamp} ]; then
scanTimestamp=${nowTimestamp} scanTimestamp=${nowTimestamp}
fi fi
if [ ${#scanTimestamp} -gt 0 ]; then if [ ${#scanTimestamp} -gt 0 ]; then

View file

@ -88,30 +88,6 @@ if [ "$1" = "status" ]; then
exit 0 exit 0
fi fi
# determine nodeJS DISTRO
isARM=$(uname -m | grep -c 'arm')
isAARCH64=$(uname -m | grep -c 'aarch64')
isX86_64=$(uname -m | grep -c 'x86_64')
isX86_32=$(uname -m | grep -c 'i386\|i486\|i586\|i686\|i786')
# get checksums from -> https://nodejs.org/dist/vx.y.z/SHASUMS256.txt
if [ ${isARM} -eq 1 ] ; then
DISTRO="linux-armv7l"
fi
if [ ${isAARCH64} -eq 1 ] ; then
DISTRO="linux-arm64"
fi
if [ ${isX86_64} -eq 1 ] ; then
DISTRO="linux-x64"
fi
if [ ${isX86_32} -eq 1 ] ; then
echo "FAIL: No X86 32bit build available - will abort setup"
exit 1
fi
if [ ${#DISTRO} -eq 0 ]; then
echo "FAIL: Was not able to determine architecture"
exit 1
fi
# stop service # stop service
echo "making sure services are not running" echo "making sure services are not running"
sudo systemctl stop btc-rpc-explorer 2>/dev/null sudo systemctl stop btc-rpc-explorer 2>/dev/null
@ -129,7 +105,15 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
# make sure that txindex of blockchain is switched on # make sure that txindex of blockchain is switched on
/home/admin/config.scripts/network.txindex.sh on /home/admin/config.scripts/network.txindex.sh on
npm install -g btc-rpc-explorer@1.1.8 # add btcrpcexplorer user
sudo adduser --disabled-password --gecos "" btcrpcexplorer
# install btc-rpc-explorer
cd /home/btcrpcexplorer
sudo -u btcrpcexplorer git clone https://github.com/janoside/btc-rpc-explorer.git
cd btc-rpc-explorer
sudo -u btcrpcexplorer git reset --hard v1.1.9
sudo -u btcrpcexplorer npm install
# prepare .env file # prepare .env file
echo "getting RPC credentials from the ${network}.conf" echo "getting RPC credentials from the ${network}.conf"
@ -137,27 +121,25 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
RPC_USER=$(sudo cat /mnt/hdd/${network}/${network}.conf | grep rpcuser | cut -c 9-) RPC_USER=$(sudo cat /mnt/hdd/${network}/${network}.conf | grep rpcuser | cut -c 9-)
PASSWORD_B=$(sudo cat /mnt/hdd/${network}/${network}.conf | grep rpcpassword | cut -c 13-) PASSWORD_B=$(sudo cat /mnt/hdd/${network}/${network}.conf | grep rpcpassword | cut -c 13-)
sudo -u bitcoin mkdir /home/bitcoin/.config/ 2>/dev/null
touch /home/admin/btc-rpc-explorer.env touch /home/admin/btc-rpc-explorer.env
chmod 600 /home/admin/btc-rpc-explorer.env || exit 1 sudo chmod 600 /home/admin/btc-rpc-explorer.env || exit 1
cat > /home/admin/btc-rpc-explorer.env <<EOF cat > /home/admin/btc-rpc-explorer.env <<EOF
# Host/Port to bind to # Host/Port to bind to
# Defaults: shown # Defaults: shown
BTCEXP_HOST=0.0.0.0 BTCEXP_HOST=0.0.0.0
#BTCEXP_PORT=3002 BTCEXP_PORT=3002
# Bitcoin RPC Credentials (URI -OR- HOST/PORT/USER/PASS) # Bitcoin RPC Credentials (URI -OR- HOST/PORT/USER/PASS)
# Defaults: # Defaults:
# - [host/port]: 127.0.0.1:8332 # - [host/port]: 127.0.0.1:8332
# - [username/password]: none # - [username/password]: none
# - cookie: '~/.bitcoin/.cookie' # - cookie: '~/.bitcoin/.cookie'
# - timeout: 5000 (ms) # - timeout: 5000 (ms)
BTCEXP_BITCOIND_URI=$network://$RPC_USER:$PASSWORD_B@127.0.0.1:8332?timeout=10000 BTCEXP_BITCOIND_HOST=127.0.0.1
#BTCEXP_BITCOIND_HOST=127.0.0.1 BTCEXP_BITCOIND_PORT=8332
#BTCEXP_BITCOIND_PORT=8332
BTCEXP_BITCOIND_USER=$RPC_USER BTCEXP_BITCOIND_USER=$RPC_USER
BTCEXP_BITCOIND_PASS=$PASSWORD_B BTCEXP_BITCOIND_PASS=$PASSWORD_B
#BTCEXP_BITCOIND_COOKIE=/path/to/bitcoind/.cookie #BTCEXP_BITCOIND_COOKIE=/path/to/bitcoind/.cookie
BTCEXP_BITCOIND_RPC_TIMEOUT=5000 BTCEXP_BITCOIND_RPC_TIMEOUT=10000
# Password protection for site via basic auth (enter any username, only the password is checked) # Password protection for site via basic auth (enter any username, only the password is checked)
# Default: none # Default: none
BTCEXP_BASIC_AUTH_PASSWORD=$PASSWORD_B BTCEXP_BASIC_AUTH_PASSWORD=$PASSWORD_B
@ -169,8 +151,8 @@ BTCEXP_BASIC_AUTH_PASSWORD=$PASSWORD_B
BTCEXP_ADDRESS_API=none BTCEXP_ADDRESS_API=none
BTCEXP_ELECTRUMX_SERVERS=tcp://127.0.0.1:50001 BTCEXP_ELECTRUMX_SERVERS=tcp://127.0.0.1:50001
EOF EOF
sudo mv /home/admin/btc-rpc-explorer.env /home/bitcoin/.config/btc-rpc-explorer.env sudo mv /home/admin/btc-rpc-explorer.env /home/btcrpcexplorer/.config/btc-rpc-explorer.env
sudo chown bitcoin:bitcoin /home/bitcoin/.config/btc-rpc-explorer.env sudo chown btcrpcexplorer:btcrpcexplorer /home/btcrpcexplorer/.config/btc-rpc-explorer.env
# open firewall # open firewall
echo "*** Updating Firewall ***" echo "*** Updating Firewall ***"
@ -189,13 +171,13 @@ Wants=${network}d.service
After=${network}d.service After=${network}d.service
[Service] [Service]
ExecStart=/usr/local/lib/nodejs/node-$(node -v)-$DISTRO/bin/btc-rpc-explorer WorkingDirectory=/home/btcrpcexplorer/btc-rpc-explorer
User=bitcoin ExecStart=/usr/bin/npm start
Restart=always User=btcrpcexplorer
TimeoutSec=120 # Restart on failure but no more than 2 time every 10 minutes (600 seconds). Otherwise stop
RestartSec=30 Restart=on-failure
StandardOutput=null StartLimitIntervalSec=600
StandardError=journal StartLimitBurst=2
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
@ -241,7 +223,8 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then
sudo systemctl stop btc-rpc-explorer sudo systemctl stop btc-rpc-explorer
sudo systemctl disable btc-rpc-explorer sudo systemctl disable btc-rpc-explorer
sudo rm /etc/systemd/system/btc-rpc-explorer.service sudo rm /etc/systemd/system/btc-rpc-explorer.service
sudo rm -r /usr/local/lib/nodejs/node-$(node -v)-$DISTRO/bin/btc-rpc-explorer sudo rm -rf /home/btcrpcexplorer/btc-rpc-explorer
sudo rm -f /home/btcrpcexplorer/.config/btc-rpc-explorer.env
echo "OK BTC-RPC-explorer removed." echo "OK BTC-RPC-explorer removed."
else else
echo "BTC-RPC-explorer is not installed." echo "BTC-RPC-explorer is not installed."

View file

@ -236,7 +236,7 @@ EOF
sudo -u btcpay git clone https://github.com/btcpayserver/btcpayserver.git 2>/dev/null sudo -u btcpay git clone https://github.com/btcpayserver/btcpayserver.git 2>/dev/null
cd btcpayserver cd btcpayserver
# check https://github.com/btcpayserver/btcpayserver/releases # check https://github.com/btcpayserver/btcpayserver/releases
sudo -u btcpay git reset --hard v1.0.3.156 sudo -u btcpay git reset --hard v1.0.3.164
# from the build.sh with path # from the build.sh with path
sudo -u btcpay /home/btcpay/dotnet/dotnet build -c Release /home/btcpay/btcpayserver/BTCPayServer/BTCPayServer.csproj sudo -u btcpay /home/btcpay/dotnet/dotnet build -c Release /home/btcpay/btcpayserver/BTCPayServer/BTCPayServer.csproj

View file

@ -93,7 +93,7 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
sudo service bitcoind start sudo service bitcoind start
echo "*** Installing prerequisites ***" echo "*** Installing prerequisites ***"
sudo apt install libusb-1.0.0-dev libudev-dev virtualenv libssl-dev sudo apt install -y libusb-1.0.0-dev libudev-dev virtualenv libssl-dev
# activating Authentication here ... # activating Authentication here ...
echo "*** creating App-config ***" echo "*** creating App-config ***"

View file

@ -2,36 +2,13 @@
source /mnt/hdd/raspiblitz.conf source /mnt/hdd/raspiblitz.conf
# determine nodeJS DISTRO
isARM=$(uname -m | grep -c 'arm')
isAARCH64=$(uname -m | grep -c 'aarch64')
isX86_64=$(uname -m | grep -c 'x86_64')
isX86_32=$(uname -m | grep -c 'i386\|i486\|i586\|i686\|i786')
if [ ${isARM} -eq 1 ] ; then
DISTRO="linux-armv7l"
fi
if [ ${isAARCH64} -eq 1 ] ; then
DISTRO="linux-arm64"
fi
if [ ${isX86_64} -eq 1 ] ; then
DISTRO="linux-x64"
fi
if [ ${isX86_32} -eq 1 ] ; then
echo "FAIL: No X86 32bit build available - will abort setup"
exit 1
fi
if [ ${#DISTRO} -eq 0 ]; then
echo "FAIL: Was not able to determine architecture"
exit 1
fi
if [ "${BTCRPCexplorer}" = "on" ] & [ "${ElectRS}" = "on" ]; then if [ "${BTCRPCexplorer}" = "on" ] & [ "${ElectRS}" = "on" ]; then
## Enable BTCEXP_ADDRESS_API if BTC-RPC-Explorer is active ## Enable BTCEXP_ADDRESS_API if BTC-RPC-Explorer is active
if [ $(sudo -u electrs lsof -i | grep -c 50001) -gt 0 ]; then if [ $(sudo -u electrs lsof -i | grep -c 50001) -gt 0 ]; then
echo "electrs is active - switching address API support on in BTC-RPC-Explorer" echo "electrs is active - switching address API support on in BTC-RPC-Explorer"
sudo -u bitcoin sed -i 's/^BTCEXP_ADDRESS_API=none/BTCEXP_ADDRESS_API=electrumx/g' /home/bitcoin/.config/btc-rpc-explorer.env sudo -u btcrpcexplorer sed -i 's/^BTCEXP_ADDRESS_API=none/BTCEXP_ADDRESS_API=electrumx/g' /home/btcrpcexplorer/.config/btc-rpc-explorer.env
# create ExecStart=/home/bitcoin/btc-rpc-explorer.run.sh # create ExecStart=/home/admin/btc-rpc-explorer.run.sh
cat > /home/admin/btc-rpc-explorer.run.sh <<EOF cat > /home/admin/btc-rpc-explorer.run.sh <<EOF
#!/bin/bash #!/bin/bash
echo "Waiting Electrs on port 50001..." echo "Waiting Electrs on port 50001..."
@ -39,21 +16,22 @@ while [ $(sudo -u electrs lsof -i | grep -c 50001) -eq 0 ]; do
sleep 1 sleep 1
done done
echo "Electrs started, launching BTC-RPC-Explorer..." echo "Electrs started, launching BTC-RPC-Explorer..."
/usr/local/lib/nodejs/node-$(node -v)-$DISTRO/bin/btc-rpc-explorer cd /home/btcrpcexplorer/btc-rpc-explorer
sudo -u btcrpcexplorer /usr/bin/npm start
EOF EOF
sudo mv /home/admin/btc-rpc-explorer.run.sh /home/bitcoin/btc-rpc-explorer.run.sh sudo chmod +x /home/admin/btc-rpc-explorer.run.sh
sudo chown bitcoin:bitcoin /home/bitcoin/btc-rpc-explorer.run.sh
sudo chmod +x /home/bitcoin/btc-rpc-explorer.run.sh
sudo sed -i "s/^ExecStart=\/usr\/local\/lib\/nodejs\/node-$(node -v)-$DISTRO\/bin\/btc-rpc-explorer/ExecStart=\/home\/bitcoin\/btc-rpc-explorer.run.sh/g" /etc/systemd/system/btc-rpc-explorer.service sudo sed -i "s/^ExecStart=\/usr\/bin\/npm start/ExecStart=\/home\/admin\/btc-rpc-explorer.run.sh/g" /etc/systemd/system/btc-rpc-explorer.service
sudo sed -i "s/^User=.*/User=admin/g" /etc/systemd/system/btc-rpc-explorer.service
sudo systemctl daemon-reload sudo systemctl daemon-reload
sudo systemctl restart btc-rpc-explorer sudo systemctl restart btc-rpc-explorer
else else
echo "electrs is not active - switching address API support off in BTC-RPC-Explorer" echo "electrs is not active - switching address API support off in BTC-RPC-Explorer"
sudo -u bitcoin sed -i 's/^BTCEXP_ADDRESS_API=electrumx/BTCEXP_ADDRESS_API=none/g' /home/bitcoin/.config/btc-rpc-explorer.env sudo -u btcrpcexplorer sed -i 's/^BTCEXP_ADDRESS_API=electrumx/BTCEXP_ADDRESS_API=none/g' /home/btcrpcexplorer/.config/btc-rpc-explorer.env
sudo sed -i "s/^ExecStart=\/home\/bitcoin\/btc-rpc-explorer.run.sh/ExecStart=\/usr\/local\/lib\/nodejs\/node-$(node -v)-$DISTRO\/bin\/btc-rpc-explorer/g" /etc/systemd/system/btc-rpc-explorer.service sudo sed -i "s/^ExecStart=\/home\/admin\/btc-rpc-explorer.run.sh/ExecStart=\/usr\/bin\/npm start/g" /etc/systemd/system/btc-rpc-explorer.service
sudo sed -i "s/^User=.*/User=btcrpcexplorer/g" /etc/systemd/system/btc-rpc-explorer.service
sudo systemctl daemon-reload sudo systemctl daemon-reload
sudo systemctl restart btc-rpc-explorer sudo systemctl restart btc-rpc-explorer
fi fi
@ -62,9 +40,10 @@ else
## Disable BTCEXP_ADDRESS_API if BTC-RPC-Explorer is active ## Disable BTCEXP_ADDRESS_API if BTC-RPC-Explorer is active
if [ "${BTCRPCexplorer}" = "on" ]; then if [ "${BTCRPCexplorer}" = "on" ]; then
echo "electrs is not active - switching address API support off in BTC-RPC-Explorer" echo "electrs is not active - switching address API support off in BTC-RPC-Explorer"
sudo -u bitcoin sed -i 's/^BTCEXP_ADDRESS_API=electrumx/BTCEXP_ADDRESS_API=none/g' /home/bitcoin/.config/btc-rpc-explorer.env sudo -u btcrpcexplorer sed -i 's/^BTCEXP_ADDRESS_API=electrumx/BTCEXP_ADDRESS_API=none/g' /home/btcrpcexplorer/.config/btc-rpc-explorer.env
sudo sed -i "s/^ExecStart=\/home\/bitcoin\/btc-rpc-explorer.run.sh/ExecStart=\/usr\/local\/lib\/nodejs\/node-$(node -v)-$DISTRO\/bin\/btc-rpc-explorer/g" /etc/systemd/system/btc-rpc-explorer.service sudo sed -i "s/^ExecStart=\/home\/admin\/btc-rpc-explorer.run.sh/ExecStart=\/usr\/bin\/npm start/g" /etc/systemd/system/btc-rpc-explorer.service
sudo sed -i "s/^User=.*/User=btcrpcexplorer/g" /etc/systemd/system/btc-rpc-explorer.service
sudo systemctl daemon-reload sudo systemctl daemon-reload
sudo systemctl restart btc-rpc-explorer sudo systemctl restart btc-rpc-explorer
fi fi

View file

@ -0,0 +1,216 @@
#!/bin/bash
# links:
# https://github.com/JoinMarket-Org/joinmarket-clientserver#quickstart---recommended-installation-method-linux-only
# https://github.com/openoms/bitcoin-tutorials/tree/master/joinmarket
# https://github.com/openoms/joininbox
# command info
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
echo "JoinMarket install script to switch JoinMarket on or off"
echo "sudo /home/admin/config.scrips/bonus.joinmarket.sh on|off"
exit 1
fi
# check if sudo
if [ "$EUID" -ne 0 ]
then echo "Please run as root (with sudo)"
exit
fi
source /mnt/hdd/raspiblitz.conf
# add default value to raspi config if needed
if ! grep -Eq "^joinmarket=" /mnt/hdd/raspiblitz.conf; then
echo "joinmarket=off" >> /mnt/hdd/raspiblitz.conf
fi
# show info menu
if [ "$1" = "menu" ]; then
whiptail --title " JoinMarket info " --msgbox "Usage:
https://github.com/openoms/bitcoin-tutorials/blob/master/joinmarket/README.md\n
Start to use by logging in to the 'joinmarket' user with:
'sudo su - joinmarket' \n
Can log in directly with the 'joinmarket' user via ssh.
The user password is the PASSWORD_B.
" 14 81
exit 0
fi
# switch on
if [ "$1" = "1" ] || [ "$1" = "on" ]; then
echo "*** INSTALL JOINMARKET ***"
# check if running Tor
if [ ${runBehindTor} = on ]; then
echo "OK, running behind Tor."
else
echo "Not running Tor"
echo "Activate Tor from the SERVICES menu before installing JoinMarket."
exit 1
fi
# make sure the Bitcoin Core wallet is on
/home/admin/config.scripts/network.wallet.sh on
if [ ! -f "/home/joinmarket/joinmarket-clientserver/jmvenv/bin/activate" ] ; then
echo "*** Cleaning before install ***"
sudo userdel -rf joinmarket 2>/dev/null
echo "*** Add the 'joinmarket' user ***"
adduser --disabled-password --gecos "" joinmarket
echo "*** setting PASSWORD_B as the password for the 'joinmarket' user ***"
PASSWORD_B=$(sudo cat /mnt/hdd/${network}/${network}.conf | grep rpcpassword | cut -c 13-)
echo "joinmarket:$PASSWORD_B" | sudo chpasswd
# add to sudo group (required for installation)
adduser joinmarket sudo
# configure sudo for usage without password entry for the joinmarket user
echo 'joinmarket ALL=(ALL) NOPASSWD:ALL' | EDITOR='tee -a' visudo
# make a folder for authorized keys
sudo -u joinmarket mkdir -p /home/joinmarket/.ssh
chmod -R 700 /home/joinmarket/.ssh
# install the command-line fuzzy finder (https://github.com/junegunn/fzf)
bash -c "echo 'source /usr/share/doc/fzf/examples/key-bindings.bash' >> /home/joinmarket/.bashrc"
# store JoinMarket data on HDD
mkdir /mnt/hdd/app-data/.joinmarket 2>/dev/null
# copy old JoinMarket data to app-data
cp -rf /home/admin/joinmarket-clientserver/scripts/wallets /mnt/hdd/app-data/.joinmarket/ 2>/dev/null
chown -R joinmarket:joinmarket /mnt/hdd/app-data/.joinmarket
ln -s /mnt/hdd/app-data/.joinmarket /home/joinmarket/ 2>/dev/null
chown -R joinmarket:joinmarket /home/joinmarket/.joinmarket
# install joinmarket
cd /home/joinmarket
# PySide2 for armf: https://packages.debian.org/buster/python3-pyside2.qtcore
sudo apt install -y python3-pyside2.qtcore python3-pyside2.qtgui python3-pyside2.qtwidgets zlib1g-dev libjpeg-dev
# from https://github.com/JoinMarket-Org/joinmarket-clientserver/blob/master/docs/INSTALL.md
sudo apt install -y python3-dev python3-pip git build-essential automake pkg-config libtool libffi-dev libssl-dev libgmp-dev libsodium-dev
sudo -u joinmarket git clone https://github.com/Joinmarket-Org/joinmarket-clientserver
cd joinmarket-clientserver
git reset --hard v0.6.2
# set up jmvenv
sudo apt install -y virtualenv
# use the PySide2 armf package from the system
sudo -u joinmarket virtualenv --system-site-packages -p /usr/bin/python3.7 jmvenv
source jmvenv/bin/activate || exit 1
pip install -r requirements/base.txt
# https://github.com/JoinMarket-Org/joinmarket-clientserver/blob/master/requirements/gui.txt
/home/joinmarket/joinmarket-clientserver/jmvenv/bin/python -c 'import PySide2'
pip install qrcode[pil]
pip install https://github.com/sunu/qt5reactor/archive/58410aaead2185e9917ae9cac9c50fe7b70e4a60.zip#egg=qt5reactor
# autostart for joinmarket
if [ $(sudo cat /home/joinmarket/.bashrc | grep -c "bash startup.sh") -eq 0 ]; then
sudo bash -c "echo 'bash startup.sh' >> /home/joinmarket/.bashrc"
fi
if [ $(sudo cat /home/joinmarket/.bashrc | grep -c ". /home/joinmarket/joinmarket-clientserver/jmvenv/bin/activate") -eq 0 ]; then
sudo bash -c "echo '. /home/joinmarket/joinmarket-clientserver/jmvenv/bin/activate' >> /home/joinmarket/.bashrc"
fi
if [ $(sudo cat /home/joinmarket/.bashrc | grep -c "/home/joinmarket/joinmarket-clientserver/jmvenv/bin/python -c \"import PySide2\"") -eq 0 ]; then
sudo bash -c "echo '/home/joinmarket/joinmarket-clientserver/jmvenv/bin/python -c \"import PySide2\"' >> /home/joinmarket/.bashrc"
fi
if [ $(sudo cat /home/joinmarket/.bashrc | grep -c "cd /home/joinmarket/joinmarket-clientserver/scripts/") -eq 0 ]; then
sudo bash -c "echo 'cd /home/joinmarket/joinmarket-clientserver/scripts/' >> /home/joinmarket/.bashrc"
fi
cat > /home/admin/startup.sh <<EOF
# check for joinmarket.cfg
if [ -f "/home/joinmarket/.joinmarket/joinmarket.cfg" ] ; then
echo ""
echo "Welcome to the JoinMarket command line!"
echo ""
echo "Notes on usage:"
echo "https://github.com/openoms/bitcoin-tutorials/blob/master/joinmarket/README.md"
echo ""
echo "To return to the RaspiBlitz menu open a new a terminal window or use: exit"
echo ""
else
echo "Generating the joinmarket.cfg"
echo ""
. /home/joinmarket/joinmarket-clientserver/jmvenv/bin/activate &&\
cd /home/joinmarket/joinmarket-clientserver/scripts/
python wallet-tool.py generate --datadir=/home/joinmarket/.joinmarket
sudo chmod 600 /home/joinmarket/.joinmarket/joinmarket.cfg || exit 1
echo ""
echo "Editing the joinmarket.cfg"
sudo sed -i "s/^rpc_user =.*/rpc_user = raspibolt/g" /home/joinmarket/.joinmarket/joinmarket.cfg
PASSWORD_B=\$(sudo cat /mnt/hdd/bitcoin/bitcoin.conf | grep rpcpassword | cut -c 13-)
sudo sed -i "s/^rpc_password =.*/rpc_password = \$PASSWORD_B/g" /home/joinmarket/.joinmarket/joinmarket.cfg
echo "Filled the bitcoin RPC password (PASSWORD_B)"
#communicate with IRC servers via Tor
sudo sed -i "s/^host = irc.darkscience.net/#host = irc.darkscience.net/g" /home/joinmarket/.joinmarket/joinmarket.cfg
sudo sed -i "s/^#host = darksci3bfoka7tw.onion/host = darksci3bfoka7tw.onion/g" /home/joinmarket/.joinmarket/joinmarket.cfg
sudo sed -i "s/^host = irc.hackint.org/#host = irc.hackint.org/g" /home/joinmarket/.joinmarket/joinmarket.cfg
sudo sed -i "s/^#host = ncwkrwxpq2ikcngxq3dy2xctuheniggtqeibvgofixpzvrwpa77tozqd.onion/host = ncwkrwxpq2ikcngxq3dy2xctuheniggtqeibvgofixpzvrwpa77tozqd.onion/g" /home/joinmarket/.joinmarket/joinmarket.cfg
sudo sed -i "s/^socks5 = false/#socks5 = false/g" /home/joinmarket/.joinmarket/joinmarket.cfg
sudo sed -i "s/^#socks5 = true/socks5 = true/g" /home/joinmarket/.joinmarket/joinmarket.cfg
sudo sed -i "s/^#port = 6667/port = 6667/g" /home/joinmarket/.joinmarket/joinmarket.cfg
sudo sed -i "s/^#usessl = false/usessl = false/g" /home/joinmarket/.joinmarket/joinmarket.cfg
echo "Edited the joinmarket.cfg to communicate over Tor only."
echo ""
echo "Welcome to the JoinMarket command line!"
echo ""
echo "Notes on usage:"
echo "https://github.com/openoms/bitcoin-tutorials/blob/master/joinmarket/README.md"
echo ""
echo "To return to the RaspiBlitz menu open a new a terminal window or use: exit"
echo ""
fi
EOF
sudo mv /home/admin/startup.sh /home/joinmarket/startup.sh
sudo chown joinmarket:joinmarket /home/joinmarket/startup.sh
else
echo "JoinMarket is already installed"
echo ""
fi
if [ -f "/home/joinmarket/joinmarket-clientserver/jmvenv/bin/activate" ] ; then
# setting value in raspi blitz config
sudo sed -i "s/^joinmarket=.*/joinmarket=on/g" /mnt/hdd/raspiblitz.conf
# starting info
echo ""
echo "Start to use by logging in to the 'joinmarket' user with:"
echo "'sudo su - joinmarket'"
echo ""
echo "If logging in directly via ssh the password is the PASSWORD_B"
echo ""
else
echo " Failed to install JoinMarket"
exit 1
fi
exit 0
fi
# switch off
if [ "$1" = "0" ] || [ "$1" = "off" ]; then
# setting value in raspi blitz config
sudo sed -i "s/^joinmarket=.*/joinmarket=off/g" /mnt/hdd/raspiblitz.conf
if [ -f "/home/joinmarket/joinmarket-clientserver/jmvenv/bin/activate" ] ; then
echo "*** REMOVING JOINMARKET ***"
sudo userdel -rf joinmarket 2>/dev/null
echo "OK JoinMarket removed"
else
echo "JoinMarket is not installed."
fi
exit 0
fi
echo "FAIL - Unknown Parameter $1"
echo "may need reboot to run
exit 1

View file

@ -160,7 +160,7 @@ After=lnd.service
[Service] [Service]
WorkingDirectory=/home/admin/lnbits WorkingDirectory=/home/admin/lnbits
ExecStart=/bin/sh -c 'cd /home/admin/lnbits && pipenv run gunicorn -b :5000 lnbits:app' ExecStart=/bin/sh -c 'cd /home/admin/lnbits && pipenv run gunicorn -b :5000 lnbits:app -k gevent'
User=admin User=admin
Restart=always Restart=always
TimeoutSec=120 TimeoutSec=120

View file

@ -57,9 +57,6 @@ supportsTOR=0
if [ "${targetWallet}" = "zap-ios" ]; then if [ "${targetWallet}" = "zap-ios" ]; then
connector="lndconnect" connector="lndconnect"
if [ ${forceTOR} -eq 1 ]; then if [ ${forceTOR} -eq 1 ]; then
# deactivated until fix: https://github.com/rootzoll/raspiblitz/issues/1001
echo "error='no tor support'"
exit 1
# when ZAP runs on TOR it uses REST # when ZAP runs on TOR it uses REST
port="8080" port="8080"
extraparamter="--nocert" extraparamter="--nocert"

View file

@ -41,7 +41,8 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
cd /home/bitcoin cd /home/bitcoin
sudo -u bitcoin git clone https://github.com/lightninglabs/loop.git sudo -u bitcoin git clone https://github.com/lightninglabs/loop.git
cd /home/bitcoin/loop cd /home/bitcoin/loop
sudo -u bitcoin git reset --hard v0.4.1-beta # https://github.com/lightninglabs/loop/releases
sudo -u bitcoin git reset --hard v0.5.1-beta
cd /home/bitcoin/loop/cmd cd /home/bitcoin/loop/cmd
go install ./... go install ./...

View file

@ -75,17 +75,19 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
sudo apt-get install -y python2 sudo apt-get install -y python2
fi fi
# create rtl user
sudo adduser --disabled-password --gecos "" rtl
# download source code and set to tag release # download source code and set to tag release
echo "*** Get the RTL Source Code ***" echo "*** Get the RTL Source Code ***"
rm -r /home/admin/RTL 2>/dev/null rm -rf /home/admin/RTL 2>/dev/null
git clone https://github.com/ShahanaFarooqui/RTL.git /home/admin/RTL sudo -u rtl rm -rf /home/rtl/RTL 2>/dev/null
cd /home/admin/RTL sudo -u rtl git clone https://github.com/ShahanaFarooqui/RTL.git /home/rtl/RTL
git reset --hard v0.6.7 cd /home/rtl/RTL
sudo -u rtl git reset --hard v0.7.0
# from https://github.com/Ride-The-Lightning/RTL/commits/master # from https://github.com/Ride-The-Lightning/RTL/commits/master
# git checkout 917feebfa4fb583360c140e817c266649307ef72 # git checkout 917feebfa4fb583360c140e817c266649307ef72
# git fetch origin if [ -d "/home/rtl/RTL" ]; then
# git checkout feature/0.6.5
if [ -d "/home/admin/RTL" ]; then
echo "OK - RTL code copy looks good" echo "OK - RTL code copy looks good"
else else
echo "FAIL - code copy did not run correctly" echo "FAIL - code copy did not run correctly"
@ -97,10 +99,10 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
# install # install
echo "*** Run: npm install ***" echo "*** Run: npm install ***"
export NG_CLI_ANALYTICS=false export NG_CLI_ANALYTICS=false
npm install --only=production sudo -u rtl npm install --only=prod
cd .. cd ..
# check if node_modules exist now # check if node_modules exist now
if [ -d "/home/admin/RTL/node_modules" ]; then if [ -d "/home/rtl/RTL/node_modules" ]; then
echo "OK - RTL install looks good" echo "OK - RTL install looks good"
else else
echo "FAIL - npm install did not run correctly" echo "FAIL - npm install did not run correctly"
@ -117,23 +119,27 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
# prepare RTL-Config.json file # prepare RTL-Config.json file
echo "*** RTL.conf ***" echo "*** RTL.conf ***"
# change of config: https://github.com/Ride-The-Lightning/RTL/tree/v0.6.4 # change of config: https://github.com/Ride-The-Lightning/RTL/tree/v0.6.4
cp /home/admin/RTL/sample-RTL-Config.json /home/admin/RTL/RTL-Config.json sudo cp /home/rtl/RTL/sample-RTL-Config.json /home/admin/RTL-Config.json
chmod 600 /home/admin/RTL/RTL-Config.json || exit 1 sudo chown admin:admin /home/admin/RTL-Config.json
sudo chmod 600 /home/admin/RTL-Config.json || exit 1
PASSWORD_B=$(sudo cat /mnt/hdd/${network}/${network}.conf | grep rpcpassword | cut -c 13-) PASSWORD_B=$(sudo cat /mnt/hdd/${network}/${network}.conf | grep rpcpassword | cut -c 13-)
# modify sample-RTL-Config.json and save in RTL-Config.json # modify sample-RTL-Config.json and save in RTL-Config.json
node > /home/admin/RTL/RTL-Config.json <<EOF sudo node > /home/admin/RTL-Config.json <<EOF
//Read data //Read data
var data = require('/home/admin/RTL/sample-RTL-Config.json'); var data = require('/home/rtl/RTL/sample-RTL-Config.json');
//Manipulate data //Manipulate data
data.nodes[0].lnNode = '$hostname' data.nodes[0].lnNode = '$hostname'
data.nodes[0].Authentication.macaroonPath = '/mnt/hdd/lnd/data/chain/${network}/${chain}net/'; data.nodes[0].Authentication.macaroonPath = '/home/admin/.lnd/data/chain/${network}/${chain}net/';
data.nodes[0].Authentication.configPath = '/mnt/hdd/lnd/lnd.conf'; data.nodes[0].Authentication.configPath = '/mnt/hdd/lnd/lnd.conf';
data.multiPass = '$PASSWORD_B'; data.multiPass = '$PASSWORD_B';
data.nodes[0].Settings.userPersona = 'OPERATOR' data.nodes[0].Settings.userPersona = 'OPERATOR'
data.nodes[0].Settings.channelBackupPath = 'RTL-SCB-backup-$hostname' data.nodes[0].Settings.channelBackupPath = '/home/rtl/RTL-SCB-backup-$hostname'
//Output data //Output data
console.log(JSON.stringify(data, null, 2)); console.log(JSON.stringify(data, null, 2));
EOF EOF
sudo rm -f /home/rtl/RTL/RTL-Config.json
sudo mv /home/admin/RTL-Config.json /home/rtl/RTL/
sudo chown rtl:rtl /home/rtl/RTL/RTL-Config.json
echo "" echo ""
# open firewall # open firewall
@ -144,11 +150,32 @@ EOF
# install service # install service
echo "*** Install RTL systemd for ${network} on ${chain} ***" echo "*** Install RTL systemd for ${network} on ${chain} ***"
sudo cp /home/admin/assets/RTL.service /etc/systemd/system/RTL.service cat > /home/admin/RTL.service <<EOF
# Systemd unit for RTL
# /etc/systemd/system/RTL.service
[Unit]
Description=RTL daemon
Wants=lnd.service
After=lnd.service
[Service]
ExecStart=/usr/bin/node /home/rtl/RTL/rtl --lndir /home/admin/.lnd/data/chain/bitcoin/mainnet
User=rtl
Restart=always
TimeoutSec=120
RestartSec=30
StandardOutput=null
StandardError=journal
[Install]
WantedBy=multi-user.target
EOF
sudo mv /home/admin/RTL.service /etc/systemd/system/RTL.service
sudo sed -i "s|chain/bitcoin/mainnet|chain/${network}/${chain}net|" /etc/systemd/system/RTL.service sudo sed -i "s|chain/bitcoin/mainnet|chain/${network}/${chain}net|" /etc/systemd/system/RTL.service
sudo systemctl enable RTL sudo systemctl enable RTL
echo "OK - the RTL service is now enabled" echo "OK - the RTL service is now enabled"
fi fi
# setting value in raspi blitz config # setting value in raspi blitz config
@ -175,7 +202,7 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then
sudo systemctl stop RTL sudo systemctl stop RTL
sudo systemctl disable RTL sudo systemctl disable RTL
sudo rm /etc/systemd/system/RTL.service sudo rm /etc/systemd/system/RTL.service
sudo rm -r /home/admin/RTL sudo rm -rf /home/rtl/RTL
echo "OK RTL removed." echo "OK RTL removed."
else else
echo "RTL is not installed." echo "RTL is not installed."

View file

@ -3,6 +3,8 @@
# command info # command info
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
echo "# script to upload a file to DropBox (without third party libs)" echo "# script to upload a file to DropBox (without third party libs)"
echo "# dropbox.upload.sh on [AUTHTOKEN]"
echo "# dropbox.upload.sh off"
echo "# dropbox.upload.sh upload [AUTHTOKEN] [FILEPATH]" echo "# dropbox.upload.sh upload [AUTHTOKEN] [FILEPATH]"
echo "# dropbox.upload.sh check [AUTHTOKEN]" echo "# dropbox.upload.sh check [AUTHTOKEN]"
echo "# for Dropbox Setup with Authtoken, see:" echo "# for Dropbox Setup with Authtoken, see:"
@ -11,9 +13,47 @@ if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
exit 1 exit 1
fi fi
source /mnt/hdd/raspiblitz.conf
# get first parameter # get first parameter
MODE="$1" MODE="$1"
if [ "${MODE}" == "check" ]; then if [ "${MODE}" == "on" ]; then
# second parameter: dropbox auth token
authtoken="$2"
# get auth token from user if not given as second parameter
if [ ${#authtoken} -eq 0 ]; then
sudo touch /home/admin/.tmp
sudo chmod 777 /home/admin/.tmp
whiptail --title " Static Channel Backup on Dropbox " --inputbox "
Follow the steps described at the following link
to get the DropBox-Authtoken from your account:
https://github.com/rootzoll/raspiblitz/#b-dropbox-backup-target" 11 70 2>/home/admin/.tmp
authtoken=$(cat /home/admin/.tmp)
shred /home/admin/.tmp
fi
# quick check on authtoken
if [ ${#authtoken} -gt 80 ]; then
echo "err='authtoken unvalid'"
exit
fi
# set in config - that acivates the dropbox back in background process
if [ ${#authtoken} -gt 0 ]; then
if [ ${#dropboxBackupTarget} -eq 0 ]; then
echo "dropboxBackupTarget='${authtoken}'" >> /mnt/hdd/raspiblitz.conf
fi
sudo sed -i "s/^dropboxBackupTarget=.*/dropboxBackupTarget='${authtoken}'/g" /mnt/hdd/raspiblitz.conf
fi
elif [ "${MODE}" == "off" ]; then
# to turn backup off - delete the parameter from the config file
sudo sed -i '/dropboxBackupTarget=.*/d' /mnt/hdd/raspiblitz.conf
elif [ "${MODE}" == "check" ]; then
# get needed second parameter # get needed second parameter
DROPBOX_APITOKEN="$2" DROPBOX_APITOKEN="$2"

View file

@ -154,7 +154,7 @@ activateLndOverTOR()
sudo systemctl disable lnd 2>/dev/null sudo systemctl disable lnd 2>/dev/null
echo "editing /etc/systemd/system/lnd.service" echo "editing /etc/systemd/system/lnd.service"
sudo sed -i "s/^ExecStart=\/usr\/local\/bin\/lnd.*/ExecStart=\/usr\/local\/bin\/lnd --tor\.active --tor\.streamisolation --tor\.v3 --listen=127\.0\.0\.1\:9735/g" /etc/systemd/system/lnd.service sudo sed -i "s/^ExecStart=\/usr\/local\/bin\/lnd.*/ExecStart=\/usr\/local\/bin\/lnd --tor\.active --tor\.streamisolation --tor\.v3 --listen=127\.0\.0\.1\:9735 \${lndExtraParameter}/g" /etc/systemd/system/lnd.service
echo "Enable LND again" echo "Enable LND again"
sudo systemctl enable lnd sudo systemctl enable lnd
@ -409,7 +409,7 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then
echo "*** Removing TOR from LND ***" echo "*** Removing TOR from LND ***"
sudo systemctl disable lnd sudo systemctl disable lnd
echo "editing /etc/systemd/system/lnd.service" echo "editing /etc/systemd/system/lnd.service"
sudo sed -i "s/^ExecStart=\/usr\/local\/bin\/lnd.*/ExecStart=\/usr\/local\/bin\/lnd --externalip=\${publicIP}:\${lndPort}/g" /etc/systemd/system/lnd.service sudo sed -i "s/^ExecStart=\/usr\/local\/bin\/lnd.*/ExecStart=\/usr\/local\/bin\/lnd --externalip=\${publicIP}:\${lndPort} \${lndExtraParameter}/g" /etc/systemd/system/lnd.service
sudo systemctl enable lnd sudo systemctl enable lnd
echo "OK" echo "OK"

View file

@ -0,0 +1,44 @@
#!/bin/bash
# based on: https://github.com/rootzoll/raspiblitz/issues/1000
if [ $# -eq 0 ]; then
echo "activate/deactivate LND keysend feature"
echo "lnd.keysend.sh [on|off|status]"
exit 1
fi
# note: this script is not run during provision/recovery
# because if the lnd extra parameter is set in raspiblitz.conf,
# it will automatically be used by the service
source /mnt/hdd/raspiblitz.conf
parameter=$1
if [ "${parameter}" == "on" ]; then
# store to raspiblitz config (delete old line / add new)
sudo sed -i '/lndExtraParameter=.*/d' /mnt/hdd/raspiblitz.conf
echo "lndExtraParameter='--accept-keysend'" >> /mnt/hdd/raspiblitz.conf
echo "# OK - keysend feature is switched ON"
echo "# LND or RaspiBlitz needs restart"
elif [ "${parameter}" == "off" ]; then
# just remove the parameter from the config file
sudo sed -i '/lndExtraParameter=.*/d' /mnt/hdd/raspiblitz.conf
echo "# OK - keysend feature is switched OFF"
echo "# LND or RaspiBlitz needs restart"
elif [ "${parameter}" == "status" ]; then
keysendOn=$(echo "${lndExtraParameter}" | grep -c 'accept-keysend')
keysendRunning=$(sudo systemctl status lnd | grep -c 'accept-keysend')
echo "keysendOn=${keysendOn}"
echo "keysendRunning=${keysendRunning}"
else
echo "err='unknown parameter'"
fi

View file

@ -73,10 +73,6 @@ else
sudo sed -i "s/^lndPort=.*/lndPort=${portnumber}/g" /mnt/hdd/raspiblitz.conf sudo sed -i "s/^lndPort=.*/lndPort=${portnumber}/g" /mnt/hdd/raspiblitz.conf
fi fi
# editing service file
echo "editing /etc/systemd/system/lnd.service"
sudo sed -i "s/^ExecStart=\/usr\/local\/bin\/lnd.*/ExecStart=\/usr\/local\/bin\/lnd --externalip=\${publicIP}:\${lndPort}/g" /etc/systemd/system/lnd.service
# enable service again # enable service again
echo "enable service again" echo "enable service again"
sudo systemctl enable lnd sudo systemctl enable lnd