mirror of
https://github.com/rootzoll/raspiblitz.git
synced 2025-02-24 22:58:43 +01:00
Merge pull request #2612 from rootzoll/dev
Merging v1.7.1 changes from dev into v1.7 branch
This commit is contained in:
commit
a5c5f455c7
221 changed files with 16024 additions and 7840 deletions
33
CHANGES.md
33
CHANGES.md
|
@ -1,5 +1,38 @@
|
||||||
# CHANGES between Releases
|
# CHANGES between Releases
|
||||||
|
|
||||||
|
## What's new in Version 1.7.1 of RaspiBlitz?
|
||||||
|
|
||||||
|
- New: C-lightning v0.10.1 [details](https://github.com/ElementsProject/lightning/releases/tag/v0.10.1)
|
||||||
|
- New: C-lightningREST v0.5.1 [details](https://github.com/Ride-The-Lightning/c-lightning-REST/releases/tag/v0.5.1)
|
||||||
|
- New: CL Spark Wallet v0.3.0rc with BOLT12 offers [details](https://github.com/shesek/spark-wallet/releases)
|
||||||
|
- New: CL plugin: Sparko [details](https://github.com/fiatjaf/sparko)
|
||||||
|
- New: CL plugin: CLBOSS The C-Lightning Node Manager [details](https://github.com/ZmnSCPxj/clboss#clboss-the-c-lightning-node-manager)
|
||||||
|
- New: Refactored Setup-Process [details](https://github.com/rootzoll/raspiblitz/issues/1126#issuecomment-829757665)
|
||||||
|
- New: Suez - channel visualization for LND and CL [info](https://github.com/rootzoll/raspiblitz/issues/2366#issuecomment-939521302)[details](https://github.com/prusnak/suez)
|
||||||
|
- New: LND Static Channel Backup to Nextcloud
|
||||||
|
- New: Allow SphinxApp to connect over Tor
|
||||||
|
- New: Parallel TESTNET & SIGNET services
|
||||||
|
- Update: Bitcoin Core v22.0 [details](https://github.com/bitcoin/bitcoin/blob/master/doc/release-notes/release-notes-22.0.md)
|
||||||
|
- Update: LND v0.13.3 [details](https://github.com/lightningnetwork/lnd/releases/tag/v0.13.3-beta)
|
||||||
|
- Update: Specter Desktop 1.6.0 [details](https://github.com/cryptoadvance/specter-desktop/blob/master/README.md)
|
||||||
|
- Update: JoinMarket v0.9.2 [details](https://github.com/JoinMarket-Org/joinmarket-clientserver/releases/tag/v0.9.2)
|
||||||
|
- Update: JoininBox v0.6.1 [details](https://github.com/openoms/joininbox/releases/tag/v0.6.1)
|
||||||
|
- Update: Electrum Server in Rust (electrs) v0.9.0 [details](https://github.com/romanz/electrs/blob/v0.9.0/RELEASE-NOTES.md)
|
||||||
|
- Update: Mempool 2.2.2 [details](https://github.com/mempool/mempool)
|
||||||
|
- Update: BTC-RPC-Explorer v3.2.0 [details](https://github.com/janoside/btc-rpc-explorer/blob/master/CHANGELOG.md#v320)
|
||||||
|
- Update: stacking-sats-kraken 0.4.4 [details](https://github.com/dennisreimann/stacking-sats-kraken/blob/master/README.md)
|
||||||
|
- Update: BTCPayServer 1.2.3 [details](https://github.com/btcpayserver/btcpayserver/releases/tag/v1.2.3)
|
||||||
|
- Update: Lightning Terminal v0.5.1-alpha [details](https://github.com/lightninglabs/lightning-terminal/releases/tag/v0.5.1-alpha)
|
||||||
|
- Update: RTL 0.11.2 [details](https://github.com/Ride-The-Lightning/RTL/releases/tag/v0.11.2)
|
||||||
|
- Update: Lightning Terminal v0.5.0-alpha [details](https://github.com/lightninglabs/lightning-terminal/releases/tag/v0.5.0-alpha)
|
||||||
|
- Update: Thunderhub v0.12.30 [details](https://github.com/apotdevin/thunderhub/releases/tag/v0.12.30)
|
||||||
|
- Update: Pool CLI v0.5.1-alpha [details](https://github.com/lightninglabs/pool/releases/tag/v0.5.1-alpha)
|
||||||
|
- Update: Balance of Satoshis 10.7.8 (BOS) + keep data on reinstall [details](https://github.com/alexbosworth/balanceofsatoshis/blob/master/CHANGELOG.md#version-8010)
|
||||||
|
- Update: Channel Tools (chantools) v0.9.3 [details](https://github.com/guggero/chantools/blob/master/README.md)
|
||||||
|
- Update: Circuitbreaker v0.3.0 [details](https://github.com/lightningequipment/circuitbreaker/blob/master/README.md)
|
||||||
|
- Remove: DropBox Backup (its recommended to change to Nextcloud Backup)
|
||||||
|
- Remove: Litecoin (fork recommended) [details](https://github.com/rootzoll/raspiblitz/issues/2542)
|
||||||
|
|
||||||
## What's new in Version 1.7.0 of RaspiBlitz?
|
## What's new in Version 1.7.0 of RaspiBlitz?
|
||||||
|
|
||||||
- New: Raspberry Pi OS Base Image 64-bit (April 2021)
|
- New: Raspberry Pi OS Base Image 64-bit (April 2021)
|
||||||
|
|
86
CONTRIBUTING.md
Normal file
86
CONTRIBUTING.md
Normal file
|
@ -0,0 +1,86 @@
|
||||||
|
# Community development
|
||||||
|
Everybody is welcome to join, improve, and extend the RaspiBlitz - it's a work in progress. Check the issues if you wanna help out or add new ideas. You can find the scripts used for RaspiBlitz interactions on the device at /home/admin or in this Git repo's subfolder home.admin.
|
||||||
|
|
||||||
|
## Understanding Blitz project
|
||||||
|
RaspiBlitz is insipired by the [RaspiBolt guide](https://stadicus.github.io/RaspiBolt/). Tutorial on how to build a lightning node on the RaspberryPi. So much thx to Stadicus :)
|
||||||
|
To start your Deep Dive into the RaspiBlitz project, watch [this video](https://www.youtube.com/watch?v=QXUGg45CWLo).
|
||||||
|
|
||||||
|
### Blitz philosophy
|
||||||
|
|
||||||
|
* DIY community development, if you are unhappy with the code, fork and pull request, this will make you you DYOR instead of depending on the developers.
|
||||||
|
* If you ask when the next release will be available, we don't know, but if you contribute, it might be faster.
|
||||||
|
* Be sure to contribute back, every little help is wanted.
|
||||||
|
|
||||||
|
## Getting started
|
||||||
|
Get all details on "How to contribute to RaspiBlitz Development" on [this video](https://www.youtube.com/watch?v=ZVtZepV3OfM).
|
||||||
|
|
||||||
|
### Levels
|
||||||
|
All levels are important. Even advanced users help on basic levels for other Blitzers. Every help is welcome.
|
||||||
|
Not all enhancements needs to go through all levels, these are levels of difficulty, scalability depends on your skills.
|
||||||
|
|
||||||
|
#### Basic
|
||||||
|
1. **Reporting user side** --> Open an issue to indicate a problem or make a feature request.
|
||||||
|
1. **Community support** --> Solve other people issues.
|
||||||
|
1. **Good first issue** --> The purpose of the good first issue label is to highlight which issues are suitable for a new contributor without a deep understanding of the codebase.
|
||||||
|
|
||||||
|
#### Medium
|
||||||
|
1. **Sovereignty** --> Fork the repo to have the changes controlled by you.
|
||||||
|
1. **Experiment** --> Try things out on your RaspiBlitz.
|
||||||
|
1. **Executable** --> Turn your experiment into a basic shell script.
|
||||||
|
|
||||||
|
#### Advanced
|
||||||
|
1. **Config script** --> Integrate your executable into the RaspiBlitz enviroment.
|
||||||
|
1. **SSH-GUI** --> Make it easier for others to use your config script.
|
||||||
|
1. **WEB-GUI** --> Turn your feature into customer ready
|
||||||
|
|
||||||
|
### Workflow
|
||||||
|
|
||||||
|
Use the `github` command from terminal to set your RaspiBlitz to your own forked repo and development branch and use the command `patch` to sync your RaspiBlitz quickly with your latest commits.
|
||||||
|
|
||||||
|
**Solving issues**
|
||||||
|
|
||||||
|
You do not need to request permission to start working on an issue. However,
|
||||||
|
you are encouraged to leave a comment if you are planning to work on it. This
|
||||||
|
will help other contributors monitor which issues are actively being addressed
|
||||||
|
and is also an effective way to request assistance if and when you need it.
|
||||||
|
|
||||||
|
#### Pull Request
|
||||||
|
|
||||||
|
1. Make sure it is compatible with Blitz philosophy.
|
||||||
|
1. Fork the repo
|
||||||
|
1. Commit changes on the new branch
|
||||||
|
1. Open a pull request (PR are made to the `dev` branch unless indicated otherwise by a collaborator.
|
||||||
|
|
||||||
|
#### Review
|
||||||
|
|
||||||
|
##### Conceptual review
|
||||||
|
|
||||||
|
A review can be a conceptual review, where the reviewer leaves a comment
|
||||||
|
|
||||||
|
* Concept (N)ACK, meaning "I do (not) agree with the general goal of this pull
|
||||||
|
request",
|
||||||
|
* Approach (N)ACK, meaning Concept ACK, but "I do (not) agree with the
|
||||||
|
approach of this change".
|
||||||
|
|
||||||
|
A NACK needs to include a rationale why the change is not worthwhile.
|
||||||
|
NACKs without accompanying reasoning may be disregarded.
|
||||||
|
|
||||||
|
##### Code review
|
||||||
|
|
||||||
|
After conceptual agreement on the change, code review can be provided. A review begins with the urgent necessity of the changes.
|
||||||
|
Start from urgent to less important:
|
||||||
|
1. Security risk.
|
||||||
|
1. Code that breaks the enviroment.
|
||||||
|
1. Enhancing current services functionality.
|
||||||
|
1. Solving a common issue.
|
||||||
|
1. Adding new applications.
|
||||||
|
|
||||||
|
Project maintainers reserve the right to weigh the opinions of peer reviewers using common sense judgement and may also weigh based on merit.
|
||||||
|
Reviewers that have demonstrated a deeper commitment and understanding of the project over time or who have clear domain expertise may naturally have more weight, as one would expect in all walks of life.
|
||||||
|
|
||||||
|
## Release policy
|
||||||
|
The project leader is the release manager for each RaspiBlitz release.
|
||||||
|
|
||||||
|
## Copyright
|
||||||
|
By contributing to this repository, you agree to license your work under the [MIT license](https://github.com/rootzoll/raspiblitz/blob/master/LICENSE).
|
||||||
|
Any work contributed where you are not the original author must contain its license header with the original author(s) and source.
|
701
FAQ.cl.md
Normal file
701
FAQ.cl.md
Normal file
|
@ -0,0 +1,701 @@
|
||||||
|
<!-- omit in toc -->
|
||||||
|
# C-lightning on the RaspiBlitz FAQ
|
||||||
|
|
||||||
|
- [Common questions about the different Lightning Network implementations](#common-questions-about-the-different-lightning-network-implementations)
|
||||||
|
- [Can LND and C-lightning nodes open channels to each other and route payments?](#can-lnd-and-c-lightning-nodes-open-channels-to-each-other-and-route-payments)
|
||||||
|
- [Can I run LND and C-lightning connected to the same node?](#can-i-run-lnd-and-c-lightning-connected-to-the-same-node)
|
||||||
|
- [Can I convert an LND node to C-lightning (or the opposite)?](#can-i-convert-an-lnd-node-to-c-lightning-or-the-opposite)
|
||||||
|
- [Is there a table to quickly compare LND and C-Lightning?](#is-there-a-table-to-quickly-compare-lnd-and-c-lightning)
|
||||||
|
- [C-lightning official documentation](#c-lightning-official-documentation)
|
||||||
|
- [Commands and aliases](#commands-and-aliases)
|
||||||
|
- [Directories](#directories)
|
||||||
|
- [Config file](#config-file)
|
||||||
|
- [Default values](#default-values)
|
||||||
|
- [All possible config settings](#all-possible-config-settings)
|
||||||
|
- [Plug-ins](#plug-ins)
|
||||||
|
- [General info](#general-info)
|
||||||
|
- [Directories](#directories-1)
|
||||||
|
- [Implemented plugins](#implemented-plugins)
|
||||||
|
- [Add a custom plugin](#add-a-custom-plugin)
|
||||||
|
- [CLBOSS](#clboss)
|
||||||
|
- [Feeadjuster](#feeadjuster)
|
||||||
|
- [Dual funded channels](#dual-funded-channels)
|
||||||
|
- [Reading](#reading)
|
||||||
|
- [Setting up](#setting-up)
|
||||||
|
- [Open a dual funded channel](#open-a-dual-funded-channel)
|
||||||
|
- [Fundchannel syntax](#fundchannel-syntax)
|
||||||
|
- [Offers](#offers)
|
||||||
|
- [About the feature bits](#about-the-feature-bits)
|
||||||
|
- [Testnets](#testnets)
|
||||||
|
- [Backups](#backups)
|
||||||
|
- [Seed](#seed)
|
||||||
|
- [How to display the hsm_secret in a human-readable format?](#how-to-display-the-hsm_secret-in-a-human-readable-format)
|
||||||
|
- [Channel database](#channel-database)
|
||||||
|
- [Recovery](#recovery)
|
||||||
|
- [Script file help list](#script-file-help-list)
|
||||||
|
|
||||||
|
---
|
||||||
|
## Common questions about the different Lightning Network implementations
|
||||||
|
|
||||||
|
### Can LND and C-lightning nodes open channels to each other and route payments?
|
||||||
|
* Yes, all [BOLT specification](https://github.com/lightningnetwork/lightning-rfc) compliant implementations can open channels to each other and route payments.
|
||||||
|
|
||||||
|
### Can I run LND and C-lightning connected to the same node?
|
||||||
|
* Yes, both can run parallel on a RaspiBlitz and even have channels witch each other.
|
||||||
|
|
||||||
|
### Can I convert an LND node to C-lightning (or the opposite)?
|
||||||
|
* No, currently there are no tools available to convert between the databases storing the channel states.
|
||||||
|
The channels would need to be closed to use the same funds in an other node.
|
||||||
|
|
||||||
|
### Is there a table to quickly compare LND and C-Lightning?
|
||||||
|
* see [github.com/openoms/lightning-node-management/blob/master/node-types/comparison.md](https://github.com/openoms/lightning-node-management/blob/master/node-types/comparison.md)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## C-lightning official documentation
|
||||||
|
* https://lightning.readthedocs.io/
|
||||||
|
|
||||||
|
## Commands and aliases
|
||||||
|
|
||||||
|
* Check if the C-lightning daemon is running:
|
||||||
|
```
|
||||||
|
sudo systemctl status lightningd
|
||||||
|
```
|
||||||
|
* Follow it's system output for debugging:
|
||||||
|
```
|
||||||
|
sudo journalctl -fu lightningd
|
||||||
|
```
|
||||||
|
* The logs can be accessed in the menu `SYSTEM` - `CLLOG`
|
||||||
|
or with the alias: `cllog`
|
||||||
|
* The frequently used commands are shortened with alisases. Check them with the command `alias`:
|
||||||
|
```
|
||||||
|
alias cl='sudo -u bitcoin /usr/local/bin/lightning-cli --conf=/home/bitcoin/.lightning/config'
|
||||||
|
alias clconf='sudo nano /home/bitcoin/.lightning/config'
|
||||||
|
alias cllog='sudo tail -n 30 -f /home/bitcoin/.lightning/bitcoin/cl.log'
|
||||||
|
```
|
||||||
|
## Directories
|
||||||
|
* All data is stored on the disk in:
|
||||||
|
`/mnt/hdd/app-data/.lightningd`
|
||||||
|
* and symlinked to:
|
||||||
|
`/home/bitcoin/.lightningd`
|
||||||
|
|
||||||
|
## Config file
|
||||||
|
* Edit in the menu `SYSTEM` - `CLNCONF` or use the alias `clconf`
|
||||||
|
|
||||||
|
### Default values
|
||||||
|
* on the RaspiBlitz for mainnet
|
||||||
|
```
|
||||||
|
network=bitcoin
|
||||||
|
announce-addr=127.0.0.1:9736
|
||||||
|
log-file=cl.log
|
||||||
|
log-level=info
|
||||||
|
plugin-dir=/home/bitcoin/cln-plugins-enabled
|
||||||
|
# Tor settings
|
||||||
|
proxy=127.0.0.1:9050
|
||||||
|
bind-addr=127.0.0.1:9736
|
||||||
|
addr=statictor:127.0.0.1:9051/torport=9736
|
||||||
|
always-use-proxy=true
|
||||||
|
```
|
||||||
|
### All possible config settings
|
||||||
|
* can be shown by running:
|
||||||
|
`lightningd --help`
|
||||||
|
* Place the settings in the config file without the `--` and restart lightningd
|
||||||
|
```
|
||||||
|
Usage: lightningd
|
||||||
|
A bitcoin lightning daemon (default values shown for network: bitcoin).
|
||||||
|
--conf=<file> Specify configuration file
|
||||||
|
--lightning-dir=<dir> Set base directory: network-specific subdirectory is
|
||||||
|
under here (default: "/home/admin/.lightning")
|
||||||
|
--network <arg> Select the network parameters (bitcoin, testnet,
|
||||||
|
signet, regtest, litecoin or litecoin-testnet)
|
||||||
|
(default: bitcoin)
|
||||||
|
--mainnet Alias for --network=bitcoin
|
||||||
|
--testnet Alias for --network=testnet
|
||||||
|
--signet Alias for --network=signet
|
||||||
|
--allow-deprecated-apis <arg> Enable deprecated options, JSONRPC commands, fields,
|
||||||
|
etc. (default: true)
|
||||||
|
--rpc-file <arg> Set JSON-RPC socket (or /dev/tty)
|
||||||
|
(default: "lightning-rpc")
|
||||||
|
--plugin <arg> Add a plugin to be run (can be used multiple times)
|
||||||
|
--plugin-dir <arg> Add a directory to load plugins from (can be used
|
||||||
|
multiple times)
|
||||||
|
--clear-plugins Remove all plugins added before this option
|
||||||
|
--disable-plugin <arg> Disable a particular plugin by filename/name
|
||||||
|
--important-plugin <arg> Add an important plugin to be run (can be used multiple
|
||||||
|
times). Die if the plugin dies.
|
||||||
|
--always-use-proxy <arg> Use the proxy always (default: false)
|
||||||
|
--daemon Run in the background, suppress stdout/stderr
|
||||||
|
--wallet <arg> Location of the wallet database.
|
||||||
|
--large-channels|--wumbo Allow channels larger than 0.16777215 BTC
|
||||||
|
--experimental-dual-fund experimental: Advertise dual-funding and allow peers to
|
||||||
|
establish channels via v2 channel open protocol.
|
||||||
|
--experimental-onion-messages EXPERIMENTAL: enable send, receive and relay of onion
|
||||||
|
messages
|
||||||
|
--experimental-offers EXPERIMENTAL: enable send and receive of offers (also
|
||||||
|
sets experimental-onion-messages)
|
||||||
|
--experimental-shutdown-wrong-funding EXPERIMENTAL: allow shutdown with alternate txids
|
||||||
|
--help|-h Print this message.
|
||||||
|
--rgb <arg> RRGGBB hex color for node
|
||||||
|
--alias <arg> Up to 32-byte alias for node
|
||||||
|
--pid-file=<file> Specify pid file
|
||||||
|
(default: "/home/admin/.lightning/lightningd-bitcoin.pid")
|
||||||
|
--ignore-fee-limits <arg> (DANGEROUS) allow peer to set any feerate
|
||||||
|
(default: false)
|
||||||
|
--watchtime-blocks <arg> Blocks before peer can unilaterally spend funds
|
||||||
|
(default: 144)
|
||||||
|
--max-locktime-blocks <arg> Maximum blocks funds may be locked for (default: 2016)
|
||||||
|
--funding-confirms <arg> Confirmations required for funding transaction
|
||||||
|
(default: 3)
|
||||||
|
--cltv-delta <arg> Number of blocks for cltv_expiry_delta (default: 34)
|
||||||
|
--cltv-final <arg> Number of blocks for final cltv_expiry (default: 18)
|
||||||
|
--commit-time=<millseconds> Time after changes before sending out COMMIT
|
||||||
|
(default: 10)
|
||||||
|
--fee-base <arg> Millisatoshi minimum to charge for HTLC (default: 1000)
|
||||||
|
--rescan <arg> Number of blocks to rescan from the current head, or
|
||||||
|
absolute blockheight if negative (default: 15)
|
||||||
|
--fee-per-satoshi <arg> Microsatoshi fee for every satoshi in HTLC
|
||||||
|
(default: 10)
|
||||||
|
--max-concurrent-htlcs <arg> Number of HTLCs one channel can handle concurrently.
|
||||||
|
Should be between 1 and 483 (default: 30)
|
||||||
|
--min-capacity-sat <arg> Minimum capacity in satoshis for accepting channels
|
||||||
|
(default: 10000)
|
||||||
|
--addr <arg> Set an IP address (v4 or v6) to listen on and announce
|
||||||
|
to the network for incoming connections
|
||||||
|
--bind-addr <arg> Set an IP address (v4 or v6) to listen on, but not
|
||||||
|
announce
|
||||||
|
--announce-addr <arg> Set an IP address (v4 or v6) or .onion v3 to announce,
|
||||||
|
but not listen on
|
||||||
|
--offline Start in offline-mode (do not automatically reconnect
|
||||||
|
and do not accept incoming connections)
|
||||||
|
--autolisten <arg> If true, listen on default port and announce if it
|
||||||
|
seems to be a public interface (default: true)
|
||||||
|
--proxy <arg> Set a socks v5 proxy IP address and port
|
||||||
|
--tor-service-password <arg> Set a Tor hidden service password
|
||||||
|
--experimental-accept-extra-tlv-types <arg> Comma separated list of extra TLV types to accept.
|
||||||
|
--disable-dns Disable DNS lookups of peers
|
||||||
|
--encrypted-hsm Set the password to encrypt hsm_secret with. If no
|
||||||
|
password is passed through command line, you will be
|
||||||
|
prompted to enter it.
|
||||||
|
--rpc-file-mode <arg> Set the file mode (permissions) for the JSON-RPC socket
|
||||||
|
(default: "0600")
|
||||||
|
--force-feerates <arg> Set testnet/regtest feerates in sats perkw,
|
||||||
|
opening/mutual_close/unlateral_close/delayed_to_us/htlc_resolution/penalty:
|
||||||
|
if fewer specified, last number applies to remainder
|
||||||
|
--subdaemon <arg> Arg specified as SUBDAEMON:PATH. Specifies an alternate
|
||||||
|
subdaemon binary. If the supplied path is relative the
|
||||||
|
subdaemon binary is found in the working directory.
|
||||||
|
This option may be specified multiple times. For
|
||||||
|
example, --subdaemon=hsmd:remote_signer would use a
|
||||||
|
hypothetical remote signing subdaemon.
|
||||||
|
--log-level <arg> log level (io, debug, info, unusual, broken) [:prefix]
|
||||||
|
(default: info)
|
||||||
|
--log-timestamps <arg> prefix log messages with timestamp (default: true)
|
||||||
|
--log-prefix <arg> log prefix (default: lightningd)
|
||||||
|
--log-file=<file> log to file instead of stdout
|
||||||
|
--version|-V Print version and exit
|
||||||
|
--autocleaninvoice-cycle <arg> Perform cleanup of expired invoices every given
|
||||||
|
seconds, or do not autoclean if 0
|
||||||
|
--autocleaninvoice-expired-by <arg> If expired invoice autoclean enabled, invoices that
|
||||||
|
have expired for at least this given seconds are
|
||||||
|
cleaned
|
||||||
|
--fetchinvoice-noconnect Don't try to connect directly to fetch an invoice.
|
||||||
|
--bitcoin-datadir <arg> -datadir arg for bitcoin-cli
|
||||||
|
--bitcoin-cli <arg> bitcoin-cli pathname
|
||||||
|
--bitcoin-rpcuser <arg> bitcoind RPC username
|
||||||
|
--bitcoin-rpcpassword <arg> bitcoind RPC password
|
||||||
|
--bitcoin-rpcconnect <arg> bitcoind RPC host to connect to
|
||||||
|
--bitcoin-rpcport <arg> bitcoind RPC host's port
|
||||||
|
--bitcoin-retry-timeout <arg> how long to keep retrying to contact bitcoind before
|
||||||
|
fatally exiting
|
||||||
|
--commit-fee <arg> Percentage of fee to request for their commitment
|
||||||
|
--funder-policy <arg> Policy to use for dual-funding requests. [match,
|
||||||
|
available, fixed]
|
||||||
|
--funder-policy-mod <arg> Percent to apply policy at (match/available); or amount
|
||||||
|
to fund (fixed)
|
||||||
|
--funder-min-their-funding <arg> Minimum funding peer must open with to activate our
|
||||||
|
policy
|
||||||
|
--funder-max-their-funding <arg> Maximum funding peer may open with to activate our
|
||||||
|
policy
|
||||||
|
--funder-per-channel-min <arg> Minimum funding we'll add to a channel. If we can't
|
||||||
|
meet this, we don't fund
|
||||||
|
--funder-per-channel-max <arg> Maximum funding we'll add to a channel. We cap all
|
||||||
|
contributions to this
|
||||||
|
--funder-reserve-tank <arg> Amount of funds we'll always leave available.
|
||||||
|
--funder-fuzz-percent <arg> Percent to fuzz the policy contribution by. Defaults to
|
||||||
|
5%. Max is 100%
|
||||||
|
--funder-fund-probability <arg> Percent of requests to consider. Defaults to 100%.
|
||||||
|
Setting to 0% will disable dual-funding
|
||||||
|
--funder-lease-requests-only <arg> Only fund lease requests. Defaults to true if channel
|
||||||
|
lease rates are being advertised
|
||||||
|
--lease-fee-base-msat <arg> Channel lease rates, base fee for leased funds, in
|
||||||
|
satoshi.
|
||||||
|
--lease-fee-basis <arg> Channel lease rates, basis charged for leased funds
|
||||||
|
(per 10,000 satoshi.)
|
||||||
|
--lease-funding-weight <arg> Channel lease rates, weight we'll ask opening peer to
|
||||||
|
pay for in funding transaction
|
||||||
|
--channel-fee-max-base-msat <arg> Channel lease rates, maximum channel fee base we'll
|
||||||
|
charge for funds routed through a leased channel.
|
||||||
|
--channel-fee-max-proportional-thousandths <arg> Channel lease rates, maximum proportional fee (in
|
||||||
|
thousandths, or ppt) we'll charge for funds routed
|
||||||
|
through a leased channel. Note: 1ppt = 1,000ppm
|
||||||
|
--disable-mpp Disable multi-part payments.
|
||||||
|
```
|
||||||
|
|
||||||
|
## Plug-ins
|
||||||
|
|
||||||
|
### General info
|
||||||
|
* https://lightning.readthedocs.io/PLUGINS.html#a-day-in-the-life-of-a-plugin
|
||||||
|
* https://github.com/lightningd/plugins/
|
||||||
|
|
||||||
|
### Directories
|
||||||
|
* The plugins are installed to:
|
||||||
|
`/home/bitcoin/cl-plugins-available`
|
||||||
|
* and symlinked to:
|
||||||
|
`/home/bitcoin/cl-plugins-enabled`
|
||||||
|
* All plugins in the `/home/bitcoin/cl-plugins-enabled` directory are loaded automatically as set in the config file: `/home/bitcoin/.lightningd/config`
|
||||||
|
|
||||||
|
### Implemented plugins
|
||||||
|
* summary
|
||||||
|
* sparko
|
||||||
|
* clboss
|
||||||
|
|
||||||
|
### Add a custom plugin
|
||||||
|
* Place the plugin in the `/home/bitcoin/cl-plugins-enabled` directory
|
||||||
|
* Make sure it is owned by the `bitcoin` user and is executable:
|
||||||
|
```
|
||||||
|
sudo chown bitcoin:bitcoin /home/bitcoin/cl-plugins-enabled/PLUGIN_NAME
|
||||||
|
sudo chmod +x /home/bitcoin/cl-plugins-enabled/PLUGIN_NAME
|
||||||
|
```
|
||||||
|
* start with
|
||||||
|
```
|
||||||
|
lightnign-cli plugin start /home/bitcoin/cl-plugins-enabled/PLUGIN_NAME
|
||||||
|
```
|
||||||
|
* or to load it automatically on restart:
|
||||||
|
```
|
||||||
|
sudo systemctl restart lightningd
|
||||||
|
```
|
||||||
|
From the directory `/home/bitcoin/cl-plugins-enabled` it will load auomatically after restarts.
|
||||||
|
* To just load it run it once store in (and start from):
|
||||||
|
`/home/bitcoin/cl-plugins-available/`
|
||||||
|
|
||||||
|
### CLBOSS
|
||||||
|
A plugin for automatic LN node management.
|
||||||
|
CLBOSS only requires to have funds deposited to the onchain wallet of C-lightning.
|
||||||
|
The recommended amount to start is ~ 10 million satoshis (0.1 BTC).
|
||||||
|
|
||||||
|
It does automatically:
|
||||||
|
|
||||||
|
* generate outbound capacity - opens channels
|
||||||
|
* generate inbound capacity - submarine swaps through the boltz.exchange API
|
||||||
|
* aware of onchain fees and mempool through c-lightning and makes transactions when fees are low
|
||||||
|
* manages rebalancing - performs probing
|
||||||
|
* closes bad channels (inactive or low traffic) - this function needs to activated manually
|
||||||
|
|
||||||
|
Overall it is a tool which makes users able to send and receive lightning payments with minimal interaction, basically setting up a routing node by itself.
|
||||||
|
|
||||||
|
The transactions made by CLBOSS does cost money and running it requires a fair amount of trust in the (fully open-source - MIT) code.
|
||||||
|
Neither the CLBOSS nor the RaspiBlitz developers can take resposibility for lost sats, use at your own discretion!
|
||||||
|
|
||||||
|
* Activate it in the menu - `SETTINGS` - `-CL CLBOSS`
|
||||||
|
* Discussion: https://github.com/rootzoll/raspiblitz/issues/2490
|
||||||
|
* Advanced usage
|
||||||
|
https://github.com/ZmnSCPxj/clboss#clboss-status
|
||||||
|
* Stopping CLBOSS will leave the node in the last state. No channels will be closed or funds removed when CLBOSS is uninstalled.
|
||||||
|
|
||||||
|
### Feeadjuster
|
||||||
|
|
||||||
|
* Install:
|
||||||
|
|
||||||
|
* to set the default fees in the config add:
|
||||||
|
```
|
||||||
|
fee-base=BASEFEE_IN_MILLISATS
|
||||||
|
fee-per-satoshi=PPM_FEE_IN_SATS
|
||||||
|
```
|
||||||
|
* more options for the feeadjuster to be set in the c-lightning config can be seen in the [code](https://github.com/lightningd/plugins/blob/c16c564c2c5549b8f7236815490260c49e9e9bf4/feeadjuster/feeadjuster.py#L318):
|
||||||
|
```
|
||||||
|
plugin.add_option(
|
||||||
|
"feeadjuster-deactivate-fuzz",
|
||||||
|
False,
|
||||||
|
"Deactivate update threshold randomization and hysterisis.",
|
||||||
|
"flag"
|
||||||
|
)
|
||||||
|
plugin.add_option(
|
||||||
|
"feeadjuster-deactivate-fee-update",
|
||||||
|
False,
|
||||||
|
"Deactivate automatic fee updates for forward events.",
|
||||||
|
"flag"
|
||||||
|
)
|
||||||
|
plugin.add_option(
|
||||||
|
"feeadjuster-threshold",
|
||||||
|
"0.05",
|
||||||
|
"Relative channel balance delta at which to trigger an update. Default 0.05 means 5%. "
|
||||||
|
"Note: it's also fuzzed by 1.5%",
|
||||||
|
"string"
|
||||||
|
)
|
||||||
|
plugin.add_option(
|
||||||
|
"feeadjuster-threshold-abs",
|
||||||
|
"0.001btc",
|
||||||
|
"Absolute channel balance delta at which to always trigger an update. "
|
||||||
|
"Note: it's also fuzzed by 1.5%",
|
||||||
|
"string"
|
||||||
|
)
|
||||||
|
plugin.add_option(
|
||||||
|
"feeadjuster-enough-liquidity",
|
||||||
|
"0msat",
|
||||||
|
"Beyond this liquidity do not adjust fees. "
|
||||||
|
"This also modifies the fee curve to achieve having this amount of liquidity. "
|
||||||
|
"Default: '0msat' (turned off).",
|
||||||
|
"string"
|
||||||
|
)
|
||||||
|
plugin.add_option(
|
||||||
|
"feeadjuster-adjustment-method",
|
||||||
|
"default",
|
||||||
|
"Adjustment method to calculate channel fee"
|
||||||
|
"Can be 'default', 'soft' for less difference or 'hard' for higher difference"
|
||||||
|
"string"
|
||||||
|
)
|
||||||
|
plugin.add_option(
|
||||||
|
"feeadjuster-imbalance",
|
||||||
|
"0.5",
|
||||||
|
"Ratio at which channel imbalance the feeadjuster should start acting. "
|
||||||
|
"Default: 0.5 (always). Set higher or lower values to limit feeadjuster's "
|
||||||
|
"activity to more imbalanced channels. "
|
||||||
|
"E.g. 0.3 for '70/30'% or 0.6 for '40/60'%.",
|
||||||
|
"string"
|
||||||
|
)
|
||||||
|
plugin.add_option(
|
||||||
|
"feeadjuster-feestrategy",
|
||||||
|
"global",
|
||||||
|
"Sets the per channel fee selection strategy. "
|
||||||
|
"Can be 'global' to use global config or default values, "
|
||||||
|
"or 'median' to use the median fees from peers of peer "
|
||||||
|
"Default: 'global'.",
|
||||||
|
"string"
|
||||||
|
```
|
||||||
|
|
||||||
|
* start the feeadjuster
|
||||||
|
```
|
||||||
|
cl plugin start /home/bitcoin/cl-plugins-available/plugins/feeadjuster/feeadjuster.py
|
||||||
|
```
|
||||||
|
* stop (best to run only periodically)
|
||||||
|
```
|
||||||
|
cl plugin stop /home/bitcoin/cl-plugins-available/plugins/feeadjuster/feeadjuster.py
|
||||||
|
```
|
||||||
|
* Can use menu - `CL` - `SUEZ` to visualize the channel balances and fee settings
|
||||||
|
* check the list of base fees
|
||||||
|
```
|
||||||
|
cl listpeers | grep fee_base_msat
|
||||||
|
```
|
||||||
|
* check the list of proportional fees
|
||||||
|
```
|
||||||
|
cl listpeers | grep fee_proportional_millionths
|
||||||
|
```
|
||||||
|
* set the fees to the defaults
|
||||||
|
```
|
||||||
|
cl setchannelfee all
|
||||||
|
```
|
||||||
|
|
||||||
|
### Dual funded channels
|
||||||
|
#### Reading
|
||||||
|
* https://medium.com/blockstream/c-lightning-opens-first-dual-funded-mainnet-lightning-channel-ada6b32a527c
|
||||||
|
* https://medium.com/blockstream/setting-up-liquidity-ads-in-c-lightning-54e4c59c091d
|
||||||
|
* https://twitter.com/niftynei/status/1389328732377255938
|
||||||
|
* lightning-rfc PR: https://github.com/lightningnetwork/lightning-rfc/pull/851/files
|
||||||
|
* represented by the feature bits 28/29
|
||||||
|
|
||||||
|
#### Setting up
|
||||||
|
* activate the feature on your node:
|
||||||
|
Type: `clconf` or use the menu `SYSTEM` - `CLCONF`.
|
||||||
|
Add the line:
|
||||||
|
```
|
||||||
|
experimental-dual-fund
|
||||||
|
```
|
||||||
|
Save and restart C-lightning.
|
||||||
|
|
||||||
|
* set up a liquidity ad:
|
||||||
|
```
|
||||||
|
lightning-cli funderupdate -k policy=match policy_mod=100
|
||||||
|
```
|
||||||
|
or set in the config for example - see the meaning of each line in https://medium.com/blockstream/setting-up-liquidity-ads-in-c-lightning-54e4c59c091d :
|
||||||
|
|
||||||
|
```
|
||||||
|
experimental-dual-fund
|
||||||
|
funder-policy=match
|
||||||
|
funder-policy-mod=100
|
||||||
|
lease-fee-base-msat=500sat
|
||||||
|
lease-fee-basis=50
|
||||||
|
channel-fee-max-base-msat=100sat
|
||||||
|
channel-fee-max-proportional-thousandths=2
|
||||||
|
```
|
||||||
|
* check the settings used currently on your node:
|
||||||
|
```
|
||||||
|
lightning-cli funderupdate
|
||||||
|
```
|
||||||
|
* check your advertised settings (needs some minutes to appear):
|
||||||
|
```
|
||||||
|
lightning-cli listnodes $(lightning-cli getinfo | jq .id)
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Open a dual funded channel
|
||||||
|
* check if a node has onchain liquidity on offer:
|
||||||
|
```
|
||||||
|
lightning-cli listnodes nodeid
|
||||||
|
```
|
||||||
|
|
||||||
|
Example:
|
||||||
|
```
|
||||||
|
lightning-cli listnodes 02cca6c5c966fcf61d121e3a70e03a1cd9eeeea024b26ea666ce974d43b242e636
|
||||||
|
```
|
||||||
|
* list all nodes known in the graph with active offers:
|
||||||
|
```
|
||||||
|
lightning-cli listnodes | grep option_will_fund -B20 -A7
|
||||||
|
```
|
||||||
|
* note the node `id` and `compact_lease`
|
||||||
|
|
||||||
|
* connect to the node
|
||||||
|
```
|
||||||
|
lightning-cli connect nodeID@IP_or.onion
|
||||||
|
```
|
||||||
|
#### Fundchannel syntax
|
||||||
|
* the amount is the own funds in the wallet contributed
|
||||||
|
use equal amounts to have a balanced channel from start
|
||||||
|
the amounts can be specified in `sat` or `btc`
|
||||||
|
```
|
||||||
|
lightning-cli fundchannel -k id=NODE_ID amount=OWN_AMOUNTsat request_amt=PEER_CONTRIBUTION_AMOUNTsat compact_lease=COMPACT_LEASE
|
||||||
|
```
|
||||||
|
It can fail if the offer changed or there are not enough funds available on either side.
|
||||||
|
|
||||||
|
* open a dual funded channel with a chosen utxo and miner feerate
|
||||||
|
list the utxo-s with `lightning-cli listfunds`, can list multiple
|
||||||
|
the feerate is in `perkb` by default, e.g. use 1000 for 1 sat/byte
|
||||||
|
```
|
||||||
|
lightning-cli fundchannel feerate=PERKB_FEERATE utxos='["TRANSACTION_ID:INDDEX_NUMBER"]' -kid=NODE_ID amount=OWN_AMOUNTsat request_amt=PEER_CONTRIBUTION_AMOUNTsat compact_lease=COMPACT_LEASE
|
||||||
|
```
|
||||||
|
|
||||||
|
### Offers
|
||||||
|
* Details at bolt12.org
|
||||||
|
* Create an offer to receive payments:
|
||||||
|
https://lightning.readthedocs.io/lightning-offer.7.html
|
||||||
|
```
|
||||||
|
lightning-cli offer amount description [vendor] [label] [quantity_min] [quantity_max] [absolute_expiry] [recurrence] [recurrence_base] [recurrence_paywindow] [recurrence_limit] [single_use]
|
||||||
|
```
|
||||||
|
* Example:
|
||||||
|
Create a reusable offer which can be paid with any amount for LN tips using a fixed string.
|
||||||
|
```
|
||||||
|
lightning-cli offer any tip
|
||||||
|
```
|
||||||
|
|
||||||
|
* Create an offer to send payments:
|
||||||
|
https://lightning.readthedocs.io/lightning-offerout.7.html
|
||||||
|
```
|
||||||
|
lightning-cli offerout amount description [vendor] [label] [absolute_expiry] [refund_for]
|
||||||
|
```
|
||||||
|
* Fetch an invoice to pay an offer:
|
||||||
|
https://lightning.readthedocs.io/lightning-fetchinvoice.7.html
|
||||||
|
Will need at least one peer which supports onion the messages. For example:
|
||||||
|
```
|
||||||
|
lightning-cli connect 024b9a1fa8e006f1e3937f65f66c408e6da8e1ca728ea43222a7381df1cc449605@128.199.202.168:9735
|
||||||
|
```
|
||||||
|
* Then use the command to fetch the BOLT12 invoice:
|
||||||
|
```
|
||||||
|
lightning-cli fetchinvoice offer [msatoshi] [quantity] [recurrence_counter] [recurrence_start] [recurrence_label] [timeout] [payer_note]
|
||||||
|
```
|
||||||
|
* decode a BOLT12 invoice:
|
||||||
|
```
|
||||||
|
lightning-cli decode bolt12_invoice
|
||||||
|
```
|
||||||
|
* pay a a BOLT12 invoice:
|
||||||
|
Will need to pay through a peer which supports the onion messages which means you need at least one channel with such a node.
|
||||||
|
```
|
||||||
|
lightning-cli pay bolt12_invoice
|
||||||
|
```
|
||||||
|
* see if there is a new invoice is paid with:
|
||||||
|
```
|
||||||
|
lightning-cli listinvoices
|
||||||
|
```
|
||||||
|
The `pay_index` will increase as the offer gets reused.
|
||||||
|
|
||||||
|
### About the feature bits
|
||||||
|
* https://bitcoin.stackexchange.com/questions/107484/how-can-i-decode-the-feature-string-of-a-lightning-node-with-bolt-9
|
||||||
|
* Convert the hex number from `lightning-cli listpeers` to binary: https://www.binaryhexconverter.com/hex-to-binary-converter and count the position of the bits from the right.
|
||||||
|
|
||||||
|
|
||||||
|
## Testnets
|
||||||
|
* for testnet and signet there are prefixes `t` and `s` used for the aliases, daemons and their own plugin directory names.
|
||||||
|
* Testnet
|
||||||
|
```
|
||||||
|
# alias:
|
||||||
|
tcl | tclconf | tcllog
|
||||||
|
|
||||||
|
# daemon service name:
|
||||||
|
tlightningd
|
||||||
|
|
||||||
|
# config file:
|
||||||
|
/home/bitcoin/.lightningd/testnet/config
|
||||||
|
|
||||||
|
# plugin directory:
|
||||||
|
/home/bitcoin/tcl-plugins-enabled
|
||||||
|
```
|
||||||
|
* Signet
|
||||||
|
```
|
||||||
|
# aliases:
|
||||||
|
scl | sclconf | scllog
|
||||||
|
|
||||||
|
# daemon service name:
|
||||||
|
slightningd
|
||||||
|
|
||||||
|
# config file:
|
||||||
|
/home/bitcoin/.lightningd/signet/config
|
||||||
|
|
||||||
|
# plugin directory:
|
||||||
|
/home/bitcoin/scl-plugins-enabled
|
||||||
|
```
|
||||||
|
|
||||||
|
## Backups
|
||||||
|
* https://lightning.readthedocs.io/FAQ.html#how-to-backup-my-wallet
|
||||||
|
* General details: https://lightning.readthedocs.io/BACKUP.html
|
||||||
|
### Seed
|
||||||
|
### How to display the hsm_secret in a human-readable format?
|
||||||
|
* If there is no seed available it isbest is to save the hsm_secret as a file with `scp`. To display as text:
|
||||||
|
```
|
||||||
|
sudo cat /home/bitcoin/.lightning/bitcoin/hsm_secret | xxd
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Channel database
|
||||||
|
*
|
||||||
|
|
||||||
|
### Recovery
|
||||||
|
* https://lightning.readthedocs.io/FAQ.html#database-corruption-channel-state-lost
|
||||||
|
* https://lightning.readthedocs.io/FAQ.html#loss
|
||||||
|
|
||||||
|
## Script file help list
|
||||||
|
|
||||||
|
```
|
||||||
|
# generate a list of help texts on a RaspiBlitz:
|
||||||
|
cd /home/admin/config.scripts/
|
||||||
|
ls cl*.sh > clScriptList.txt
|
||||||
|
sed -i "s#cl#./cl#g" clScriptList.txt
|
||||||
|
sed -i "s#.sh#.sh -h#g" clScriptList.txt
|
||||||
|
bash -x clScriptList.txt
|
||||||
|
rm clScriptList.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
+ ./cl.backup.sh -h
|
||||||
|
|
||||||
|
---------------------------------------------------
|
||||||
|
CL RESCUE FILE (tar.gz of complete cl directory)
|
||||||
|
---------------------------------------------------
|
||||||
|
cl.backup.sh cl-export
|
||||||
|
cl.backup.sh cl-export-gui
|
||||||
|
cl.backup.sh cl-import [file]
|
||||||
|
cl.backup.sh cl-import-gui [setup|production] [?resultfile]
|
||||||
|
---------------------------------------------------
|
||||||
|
SEED WORDS
|
||||||
|
---------------------------------------------------
|
||||||
|
cl.backup.sh seed-export-gui [lndseeddata]
|
||||||
|
cl.backup.sh seed-import-gui [resultfile]
|
||||||
|
|
||||||
|
+ ./cl.hsmtool.sh -h
|
||||||
|
|
||||||
|
Create new wallet or import seed
|
||||||
|
Unlock/lock, encrypt, decrypt, set autounlock or change password for the hsm_secret
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
Create new wallet:
|
||||||
|
cl.hsmtool.sh [new] [mainnet|testnet|signet] [?seedPassword]
|
||||||
|
cl.hsmtool.sh [new-force] [mainnet|testnet|signet] [?seedPassword]
|
||||||
|
There will be no seedPassword(passphrase) used by default
|
||||||
|
new-force will delete any old wallet and will work without dialog
|
||||||
|
|
||||||
|
cl.hsmtool.sh [seed] [mainnet|testnet|signet] ["space-separated-seed-words"] [?seedPassword]
|
||||||
|
cl.hsmtool.sh [seed-force] [mainnet|testnet|signet] ["space-separated-seed-words"] [?seedPassword]
|
||||||
|
The new hsm_secret will be not encrypted if no NewPassword is given
|
||||||
|
seed-force will delete any old wallet and will work without dialog
|
||||||
|
|
||||||
|
cl.hsmtool.sh [unlock|lock] <mainnet|testnet|signet>
|
||||||
|
cl.hsmtool.sh [encrypt|decrypt] <mainnet|testnet|signet>
|
||||||
|
cl.hsmtool.sh [autounlock-on|autounlock-off] <mainnet|testnet|signet>
|
||||||
|
|
||||||
|
cl.hsmtool.sh [change-password] <mainnet|testnet|signet> <NewPassword>
|
||||||
|
|
||||||
|
+ ./cl.install-service.sh -h
|
||||||
|
|
||||||
|
Script to set up or update the C-lightning systemd service
|
||||||
|
Usage:
|
||||||
|
/home/admin/config.scripts/cl.install-service.sh <mainnet|testnet|signet>
|
||||||
|
|
||||||
|
+ ./cl.install.sh -h
|
||||||
|
|
||||||
|
C-lightning install script
|
||||||
|
The default version is: v0.10.1
|
||||||
|
Setting up on mainnet unless otherwise specified
|
||||||
|
mainnet / testnet / signet instances can run parallel
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
cl.install.sh on <mainnet|testnet|signet>
|
||||||
|
cl.install.sh off <mainnet|testnet|signet> <purge>
|
||||||
|
cl.install.sh [update <version>|testPR <PRnumber>]
|
||||||
|
cl.install.sh display-seed <mainnet|testnet|signet>
|
||||||
|
|
||||||
|
+ ./cl-plugin.backup.sh -h
|
||||||
|
|
||||||
|
Install the backup plugin for C-lightning
|
||||||
|
Replicates the lightningd.sqlite3 database on the SDcard
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
cl-plugin.backup.sh [on|off] [testnet|mainnet|signet]
|
||||||
|
cl-plugin.backup.sh [restore] [testnet|mainnet|signet] [force]
|
||||||
|
cl-plugin.backup.sh [backup-compact] [testnet|mainnet|signet]
|
||||||
|
|
||||||
|
https://github.com/lightningd/plugins/tree/master/backup
|
||||||
|
|
||||||
|
+ ./cl-plugin.clboss.sh -h
|
||||||
|
|
||||||
|
Install or remove the CLBOSS C-lightning plugin
|
||||||
|
version: v0.10
|
||||||
|
Usage:
|
||||||
|
cl-plugin.clboss.sh [on|off] [testnet|mainnet|signet]
|
||||||
|
|
||||||
|
+ ./cl-plugin.sparko.sh -h
|
||||||
|
|
||||||
|
Install, remove, connect or get info about the Sparko plugin for C-lightning
|
||||||
|
version: v2.7
|
||||||
|
Usage:
|
||||||
|
cl-plugin.sparko.sh [on|off|menu|connect] [testnet|mainnet|signet]
|
||||||
|
|
||||||
|
+ ./cl-plugin.standard-python.sh -h
|
||||||
|
|
||||||
|
Install and show the output of the chosen plugin for C-lightning
|
||||||
|
Usage:
|
||||||
|
cl-plugin.standard-python.sh on [plugin-name] [testnet|mainnet|signet] [runonce]
|
||||||
|
|
||||||
|
tested plugins:
|
||||||
|
summary | helpme | feeadjuster
|
||||||
|
|
||||||
|
find more at:
|
||||||
|
https://github.com/lightningd/plugins
|
||||||
|
|
||||||
|
+ ./cl-plugin.summary.sh -h
|
||||||
|
|
||||||
|
Install and show the output if the summary plugin for C-lightning
|
||||||
|
Usage:
|
||||||
|
cl-plugin.summary.sh [testnet|mainnet|signet] [runonce]
|
||||||
|
|
||||||
|
+ ./cl.rest.sh -h
|
||||||
|
|
||||||
|
C-lightning-REST install script
|
||||||
|
The default version is: v0.5.1
|
||||||
|
mainnet | testnet | signet instances can run parallel
|
||||||
|
The same macaroon and certs will be used for the parallel networks
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
cl.rest.sh [on|off|connect] <mainnet|testnet|signet>
|
||||||
|
|
||||||
|
+ ./cl.setname.sh -h
|
||||||
|
|
||||||
|
Config script to set the alias of the C-lightning node
|
||||||
|
cl.setname.sh [mainnet|testnet|signet] [?newName]
|
||||||
|
```
|
30
FAQ.md
30
FAQ.md
|
@ -192,7 +192,7 @@ If your RaspiBlitz is not working correctly and you like to get help from the co
|
||||||
|
|
||||||
- SSH into your raspiblitz as admin user with your password A
|
- SSH into your raspiblitz as admin user with your password A
|
||||||
- If you see the menu - use CTRL+C to get to the terminal
|
- If you see the menu - use CTRL+C to get to the terminal
|
||||||
- To generate debug report run: `./XXdebugLogs.sh`
|
- To generate debug report run: `debug`
|
||||||
- Then copy all output beginning with `*** RASPIBLITZ LOGS ***` and share this
|
- Then copy all output beginning with `*** RASPIBLITZ LOGS ***` and share this
|
||||||
|
|
||||||
*PLEASE NOTICE: It's possible that these logs can contain private information (like IPs, node IDs, ...) - just share publicly what you feel OK with.*
|
*PLEASE NOTICE: It's possible that these logs can contain private information (like IPs, node IDs, ...) - just share publicly what you feel OK with.*
|
||||||
|
@ -239,7 +239,7 @@ If you still can SSH in and HDD is readable, we can try to rescue/export your LN
|
||||||
To rescue/export your Lightning data from a RaspiBlitz (since v1.1):
|
To rescue/export your Lightning data from a RaspiBlitz (since v1.1):
|
||||||
|
|
||||||
* SSH into your RaspiBlitz and EXIT to terminal from the menu.
|
* SSH into your RaspiBlitz and EXIT to terminal from the menu.
|
||||||
* then run: `/home/admin/config.scripts/lnd.rescue.sh backup`
|
* then run: `/home/admin/config.scripts/lnd.backup.sh lnd-export-gui`
|
||||||
* follow the instructions of the script.
|
* follow the instructions of the script.
|
||||||
|
|
||||||
This will create a lnd-rescue file (ends on gz.tar) that contains all the data from the LND. The script offers you a command to transfer the lnd-rescue file to your laptop. If the transfer was successful you can now setup a fresh RaspiBlitz. Do all the setup until you have a clean new Lightning node running - just without any funding or channels.
|
This will create a lnd-rescue file (ends on gz.tar) that contains all the data from the LND. The script offers you a command to transfer the lnd-rescue file to your laptop. If the transfer was successful you can now setup a fresh RaspiBlitz. Do all the setup until you have a clean new Lightning node running - just without any funding or channels.
|
||||||
|
@ -247,7 +247,7 @@ This will create a lnd-rescue file (ends on gz.tar) that contains all the data f
|
||||||
Then to restore your old LND data and to recover your funds and channels:
|
Then to restore your old LND data and to recover your funds and channels:
|
||||||
|
|
||||||
* SSH into your new RaspiBlitz and EXIT to terminal from the menu.
|
* SSH into your new RaspiBlitz and EXIT to terminal from the menu.
|
||||||
* then run: `/home/admin/config.scripts/lnd.rescue.sh restore`
|
* then run: `/home/admin/config.scripts/lnd.backup.sh lnd-import-gui`
|
||||||
* follow the instructions of the script.
|
* follow the instructions of the script.
|
||||||
|
|
||||||
This script will offer you a way to transfer the lnd-rescue file from your laptop to the new RaspiBlitz and will restore the old data. LND then gets restarted for you, and after some time it should show you the status screen again with your old funds and channels.
|
This script will offer you a way to transfer the lnd-rescue file from your laptop to the new RaspiBlitz and will restore the old data. LND then gets restarted for you, and after some time it should show you the status screen again with your old funds and channels.
|
||||||
|
@ -418,13 +418,13 @@ For example if you want to make a build from the 'dev' branch you execute the fo
|
||||||
|
|
||||||
If you fork the RaspiBlitz repo (much welcome) and you want to run that code on your RaspiBlitz, there are two ways to do that:
|
If you fork the RaspiBlitz repo (much welcome) and you want to run that code on your RaspiBlitz, there are two ways to do that:
|
||||||
|
|
||||||
* The quick way: For small changes in scripts, go to `/home/admin` on your running RaspiBlitz, delete the old git with `sudo rm -r raspiblitz` then replace it with your code `git clone [YOURREPO]` and `/home/admin/XXsyncScripts.sh`
|
* The quick way: For small changes in scripts, go to `/home/admin` on your running RaspiBlitz, delete the old git with `sudo rm -r raspiblitz` then replace it with your code `git clone [YOURREPO]` and `patch`
|
||||||
|
|
||||||
* The long way: If you like to install/remove/change services and system configurations you need to build a SD card from your own code. Prepare like in [Build the SD Card Image](README.md#build-the-sd-card-image) from the README but in the end run the command:
|
* The long way: If you like to install/remove/change services and system configurations you need to build a SD card from your own code. Prepare like in [Build the SD Card Image](README.md#build-the-sd-card-image) from the README but in the end run the command:
|
||||||
|
|
||||||
`wget --no-cache https://raw.githubusercontent.com/[GITHUB-USERNAME]/raspiblitz/[BRANCH]/build_sdcard.sh && sudo bash build_sdcard.sh false false [GITHUB-USERNAME] [BRANCH] lcd true true`
|
`wget --no-cache https://raw.githubusercontent.com/[GITHUB-USERNAME]/raspiblitz/[BRANCH]/build_sdcard.sh && sudo bash build_sdcard.sh false false [GITHUB-USERNAME] [BRANCH] lcd true true`
|
||||||
|
|
||||||
If you are then working in your forked repo and want to update the scripts on your RaspiBlitz with your latest repo changes, run `/home/admin/XXsyncScripts.sh` - That's OK as long as you don't make changes to the SD card build script - for that you would need to build a fresh SD card again from your repo.
|
If you are then working in your forked repo and want to update the scripts on your RaspiBlitz with your latest repo changes, run `patch` - That's OK as long as you don't make changes to the SD card build script - for that you would need to build a fresh SD card again from your repo.
|
||||||
|
|
||||||
## How can I checkout a new branch from the RaspiBlitz repo to my forked repo?
|
## How can I checkout a new branch from the RaspiBlitz repo to my forked repo?
|
||||||
|
|
||||||
|
@ -455,7 +455,7 @@ git remote set-url origin [THE-URL-OF-YOUR-FORKED-REPO]
|
||||||
|
|
||||||
Now to sync your branch namend BRANCH on your forked repo with your RaspiBlitz, you always just run:
|
Now to sync your branch namend BRANCH on your forked repo with your RaspiBlitz, you always just run:
|
||||||
```
|
```
|
||||||
/home/admin/XXsyncScripts.sh BRANCH
|
/home/admin/config.scripts/blitz.github.sh BRANCH
|
||||||
```
|
```
|
||||||
|
|
||||||
So your workflow can go like this: You write code on your local computer. Commit to your local repo, push it to your forked repo and use the sync-script above to get the code to your RaspiBlitz.
|
So your workflow can go like this: You write code on your local computer. Commit to your local repo, push it to your forked repo and use the sync-script above to get the code to your RaspiBlitz.
|
||||||
|
@ -476,14 +476,14 @@ cd /home/admin/raspiblitz
|
||||||
git fetch origin pull/[PRNUMBER]/head:pr[PRNUMBER]
|
git fetch origin pull/[PRNUMBER]/head:pr[PRNUMBER]
|
||||||
git checkout pr[PRNUMBER]
|
git checkout pr[PRNUMBER]
|
||||||
cd /home/admin
|
cd /home/admin
|
||||||
./XXsyncScripts.sh -justinstall
|
/home/admin/config.scripts/blitz.github.sh -justinstall
|
||||||
```
|
```
|
||||||
|
|
||||||
Now you have the code of the PR active - depending on what scripts are changed you might need to reboot.
|
Now you have the code of the PR active - depending on what scripts are changed you might need to reboot.
|
||||||
|
|
||||||
To change back to the code:
|
To change back to the code:
|
||||||
```
|
```
|
||||||
./XXsyncScripts.sh master
|
/home/admin/config.scripts/blitz.github.sh master
|
||||||
```
|
```
|
||||||
|
|
||||||
## How to attach the RaspberryPi to the HDD?
|
## How to attach the RaspberryPi to the HDD?
|
||||||
|
@ -520,6 +520,7 @@ The best way would be to build the SD card yourself. You use the script `build_s
|
||||||
|
|
||||||
Work notes for the process of producing a new SD card image release:
|
Work notes for the process of producing a new SD card image release:
|
||||||
|
|
||||||
|
* Make sure you have the "Versioning" final in your RaspiBlitz Source Code
|
||||||
* Start [`Ubuntu LIVE`](http://releases.ubuntu.com/18.04.3/ubuntu-18.04.3-desktop-amd64.iso) from USB stick on the Build Computer (press F12 on startup)
|
* Start [`Ubuntu LIVE`](http://releases.ubuntu.com/18.04.3/ubuntu-18.04.3-desktop-amd64.iso) from USB stick on the Build Computer (press F12 on startup)
|
||||||
* Connect to a secure WiFi (hardware switch on) or LAN
|
* Connect to a secure WiFi (hardware switch on) or LAN
|
||||||
* Download the latest RaspiOS-64bit (zip & sig file) namend in the [build_sdcard.sh](./build_sdcard.sh) and note the SHA256 checksum
|
* Download the latest RaspiOS-64bit (zip & sig file) namend in the [build_sdcard.sh](./build_sdcard.sh) and note the SHA256 checksum
|
||||||
|
@ -543,7 +544,7 @@ Work notes for the process of producing a new SD card image release:
|
||||||
* Run the following command BUT REPLACE `[BRANCH]` with the branch-string of your latest version
|
* Run the following command BUT REPLACE `[BRANCH]` with the branch-string of your latest version
|
||||||
* `wget --no-cache https://raw.githubusercontent.com/rootzoll/raspiblitz/[BRANCH]/build_sdcard.sh && sudo bash build_sdcard.sh false true rootzoll [BRANCH] lcd true true`
|
* `wget --no-cache https://raw.githubusercontent.com/rootzoll/raspiblitz/[BRANCH]/build_sdcard.sh && sudo bash build_sdcard.sh false true rootzoll [BRANCH] lcd true true`
|
||||||
* Monitor/Check outputs for warnings/errors - install LCD
|
* Monitor/Check outputs for warnings/errors - install LCD
|
||||||
* Login new with `ssh admin@[IP-OF-RASPIBLITZ]` (pw: raspiblitz) and run `./XXprepareRelease.sh`
|
* Login new with `ssh admin@[IP-OF-RASPIBLITZ]` (pw: raspiblitz) and run `release`
|
||||||
* Disconnect WiFi/LAN on build laptop (hardware switch off) and shutdown
|
* Disconnect WiFi/LAN on build laptop (hardware switch off) and shutdown
|
||||||
* Remove `Ubuntu LIVE` USB stick and cut power from the RaspberryPi
|
* Remove `Ubuntu LIVE` USB stick and cut power from the RaspberryPi
|
||||||
* Connect USB stick with latest `TAILS` (make it stay offline)
|
* Connect USB stick with latest `TAILS` (make it stay offline)
|
||||||
|
@ -841,13 +842,13 @@ https://seravo.fi/2015/using-raid-btrfs-recovering-broken-disks
|
||||||
## How do I fix a displayed Error in my Config?
|
## How do I fix a displayed Error in my Config?
|
||||||
|
|
||||||
When the LCD display is telling you to do a config check:
|
When the LCD display is telling you to do a config check:
|
||||||
- go to the RaspiBlitz terminal (X on main menu) and run './XXsyncScripts.sh'
|
- go to the RaspiBlitz terminal (X on main menu) and run 'patch'
|
||||||
- start reboot with command: './XXshutdown.sh reboot'
|
- start reboot with command: 'restart'
|
||||||
- go to the RaspiBlitz terminal run the command: 'check'
|
- go to the RaspiBlitz terminal run the command: 'check'
|
||||||
- now edit the RaspiBlitz config and get rid of the errors: 'nano /mnt/hdd/raspiblitz.conf'
|
- now edit the RaspiBlitz config and get rid of the errors: 'nano /mnt/hdd/raspiblitz.conf'
|
||||||
- save config with: CTRL+o
|
- save config with: CTRL+o
|
||||||
- exit nano editor with: CTRL+x
|
- exit nano editor with: CTRL+x
|
||||||
- start reboot with command: './XXshutdown.sh reboot'
|
- start reboot with command: 'restart'
|
||||||
|
|
||||||
## How to fix my upside down LCD after update?
|
## How to fix my upside down LCD after update?
|
||||||
|
|
||||||
|
@ -956,3 +957,8 @@ If you can login into your local internet router it should show you the IP addre
|
||||||
Another way is to use [Angry IP Scanner](https://angryip.org/) to find the IP address.
|
Another way is to use [Angry IP Scanner](https://angryip.org/) to find the IP address.
|
||||||
|
|
||||||
You can also put an empty file just called `hdmi` (without any ending) onto the sd card when connected to your laptop and then start it up on the RaspberryPi. This will activate the HDMI port and if you connect a HDMI monitor to the RaspberryPi it will show you the RaspiBlitz status screen containing the local IP address.
|
You can also put an empty file just called `hdmi` (without any ending) onto the sd card when connected to your laptop and then start it up on the RaspberryPi. This will activate the HDMI port and if you connect a HDMI monitor to the RaspberryPi it will show you the RaspiBlitz status screen containing the local IP address.
|
||||||
|
|
||||||
|
## How can I enforce UASP mode for my SSD controller?
|
||||||
|
|
||||||
|
By default just tested & selected SSD encasings/controller are running enabled with UASP in RaspiBlitz. UASP brings a speed up for the SSD but also if not well supported by the SSD encasing/controller can lead to system halts. If you know for sure that your SSD encasing/controller is supporting UASP fully you can place a file called `uasp.force` on the sd card boot section after flashing the image with your laptop. See details or report errors on issue [#2488](https://github.com/rootzoll/raspiblitz/issues/2488)
|
||||||
|
|
||||||
|
|
610
README.md
610
README.md
|
@ -1,12 +1,12 @@
|
||||||

|

|
||||||
|
|
||||||
*Build your own Lightning Node on a RaspberryPi with a nice Display.*
|
*Build your own Lightning & Bitcoin Fullnode on a RaspberryPi with a nice Display.*
|
||||||
|
|
||||||
`Version 1.7.0 with lnd 0.12.1 and bitcoin 0.21.0 (or litecoin 0.18.1)`
|
`Version 1.7.1 with lnd 0.13.3 & c-lightning 0.10.0 and bitcoin 22.0.0`
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
**The RaspiBlitz is a do-it-yourself Lightning Node based on LND running together with a Bitcoin-Fullnode on a RaspberryPi (1TB SSD) and a nice display for easy setup & monitoring.**
|
**The RaspiBlitz is a do-it-yourself Lightning Node (LND and/or c-lightning) running together with a Bitcoin-Fullnode on a RaspberryPi (1TB SSD) and a nice display for easy setup & monitoring.**
|
||||||
|
|
||||||
RaspiBlitz is mainly targeted for learning how to run your own node decentralized from home - because: Not your Node, Not your Rules. Discover & develop the growing ecosystem of the Lightning Network by becoming a full part of it. Build it as part of a [workshop](WORKSHOP.md) or as a weekend project yourself.
|
RaspiBlitz is mainly targeted for learning how to run your own node decentralized from home - because: Not your Node, Not your Rules. Discover & develop the growing ecosystem of the Lightning Network by becoming a full part of it. Build it as part of a [workshop](WORKSHOP.md) or as a weekend project yourself.
|
||||||
|
|
||||||
|
@ -19,7 +19,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://twitter.com/lnbits/status/1253700293440741377?s=20)
|
* **LNbits** (Lightning wallet/accounts System) [details](https://twitter.com/lnbits/status/1253700293440741377?s=20)
|
||||||
* **SpecterDesktop** (Multisig Trezor, Ledger, COLDCARDwallet & Specter-DIY) [details](https://github.com/cryptoadvance/specter-desktop)
|
* **SpecterDesktop** (Multisig Trezor, Ledger, COLDCARDwallet & Specter-DIY) [details](https://github.com/cryptoadvance/specter-desktop) [app connection guide](https://d11n.net/connect-specter-desktor-with-raspiblitz.html)
|
||||||
* **Lightning Terminal (Loop, Pool & Faraday)** (Manage Channel Liquidity) [details](https://github.com/lightninglabs/lightning-terminal#lightning-terminal-lit)
|
* **Lightning Terminal (Loop, Pool & Faraday)** (Manage Channel Liquidity) [details](https://github.com/lightninglabs/lightning-terminal#lightning-terminal-lit)
|
||||||
* **JoinMarket** (CoinJoin Service) [details](https://github.com/JoinMarket-Org/joinmarket-clientserver)
|
* **JoinMarket** (CoinJoin Service) [details](https://github.com/JoinMarket-Org/joinmarket-clientserver)
|
||||||
* **ThunderHub** (Lightning Node Manager WebUI) [details](https://www.thunderhub.io/)
|
* **ThunderHub** (Lightning Node Manager WebUI) [details](https://www.thunderhub.io/)
|
||||||
|
@ -32,6 +32,10 @@ There are further Services that can be switched on:
|
||||||
* **Sphinx Chat Relay Server** [details](https://github.com/stakwork/sphinx-relay/blob/master/README.md)
|
* **Sphinx Chat Relay Server** [details](https://github.com/stakwork/sphinx-relay/blob/master/README.md)
|
||||||
* **Telegraf metrics** [details](https://github.com/rootzoll/raspiblitz/issues/1369)
|
* **Telegraf metrics** [details](https://github.com/rootzoll/raspiblitz/issues/1369)
|
||||||
* **Chantools** (Fund Rescue) [details](https://github.com/guggero/chantools/blob/master/README.md)
|
* **Chantools** (Fund Rescue) [details](https://github.com/guggero/chantools/blob/master/README.md)
|
||||||
|
* **Suez** (Channel Visualization for LND & CL) [details](https://github.com/prusnak/suez#suez)
|
||||||
|
* **CL Spark Wallet** (WalletUI with BOLT12 offers) [details](https://github.com/shesek/spark-wallet#progressive-web-app)
|
||||||
|
* **CL plugin: Sparko** (WalletUI & HTTP-RPC bridge) [details](https://github.com/fiatjaf/sparko#the-sparko-plugin)
|
||||||
|
* **CL plugin: CLBOSS** (Automated Node Manager) [details](https://github.com/ZmnSCPxj/clboss#clboss-the-c-lightning-node-manager)
|
||||||
|
|
||||||
You can connect the following Wallet-Apps to your RaspiBlitz:
|
You can connect the following Wallet-Apps to your RaspiBlitz:
|
||||||
|
|
||||||
|
@ -40,7 +44,7 @@ You can connect the following Wallet-Apps to your RaspiBlitz:
|
||||||
* **SendMany** (Android) [details](https://github.com/fusion44/sendmany/blob/master/README.md)
|
* **SendMany** (Android) [details](https://github.com/fusion44/sendmany/blob/master/README.md)
|
||||||
* **Sphinx Chat App** (Android & iOS) [details](https://sphinx.chat)
|
* **Sphinx Chat App** (Android & iOS) [details](https://sphinx.chat)
|
||||||
|
|
||||||
Also many more features like Touchscreen, Channels Autopilot, DynDNS, SSH-Tunneling, UPS Support, ...
|
Also many more features like Touchscreen, Channels Autopilot, Backup, DynDNS, SSH-Tunneling, UPS Support, ...
|
||||||
|
|
||||||
## DeepDive Video (July 2020)
|
## DeepDive Video (July 2020)
|
||||||
|
|
||||||
|
@ -48,7 +52,7 @@ Also many more features like Touchscreen, Channels Autopilot, DynDNS, SSH-Tunnel
|
||||||
|
|
||||||
## Time Estimate to Set Up a RaspiBlitz
|
## Time Estimate to Set Up a RaspiBlitz
|
||||||
|
|
||||||
The RaspiBlitz is optimized for being setup during a workshop at a hackday or conference (see [detailed workshop tutorial](WORKSHOP.md)). When it comes fully assembled with an up-to-date synced blockchain, it's possible to have it ready in about 2 to 3 hours - most of it is waiting time.
|
The RaspiBlitz is optimized for being setup during a workshop at a hackday or conference (see [detailed workshop tutorial](WORKSHOP.md)). When it comes fully assembled with an up-to-date synced blockchain, it's possible to have it ready in about 2 to 3 hours.
|
||||||
|
|
||||||
If you start at home ordering the parts from Amazon (see shopping list below) then it's a weekend project with a lot of downloading and syncing time where you can do other stuff while checking on the progress from time to time.
|
If you start at home ordering the parts from Amazon (see shopping list below) then it's a weekend project with a lot of downloading and syncing time where you can do other stuff while checking on the progress from time to time.
|
||||||
|
|
||||||
|
@ -60,9 +64,9 @@ All parts together cost around 180-250 USD - based on shops and location.
|
||||||
|
|
||||||
### Buy a ready-2-go RaspiBlitz (Germany, EU and International)
|
### Buy a ready-2-go RaspiBlitz (Germany, EU and International)
|
||||||
|
|
||||||
If you like to support the RaspiBlitz project you can order a ready-2-go RaspiBlitz or an all-you-need-hardware set for yourself or for your RaspiBlitz workshop from [raspiblitz.com](https://raspiblitz.com)
|
If you like to support the RaspiBlitz project you can order a plug&play RaspiBlitz from [raspiblitz.com](https://raspiblitz.com)
|
||||||
|
|
||||||
Find a list of other shops selling a Ready-2-Go RaspiBlitz in your area on [raspiblitz.org](https://raspiblitz.org/).
|
Find a list of other shops selling a plug&play RaspiBlitz in your area on [raspiblitz.org](https://raspiblitz.org).
|
||||||
|
|
||||||
### Amazon Shopping List (buy parts & build it yourself)
|
### Amazon Shopping List (buy parts & build it yourself)
|
||||||
|
|
||||||
|
@ -103,30 +107,29 @@ In the end your RaspiBlitz should look like this:
|
||||||
|
|
||||||
## Downloading the Software
|
## Downloading the Software
|
||||||
|
|
||||||
There are two ways how you can install the RaspiBlitz software on your RaspberryPi:
|
*PLEASE WAIT SOME MORE HOURS .. NEW RELEASE 1.7.1 IMAGE WILL BE POROVIDED VERY SOON*
|
||||||
|
|
||||||
|Method|Install the image|Build the sd card|
|
|Method|Install the image|Build the sd card|
|
||||||
|------|-----------------|-----------------|
|
|------|-----------------|-----------------|
|
||||||
|Philosophy|Trust|Sovereignty|
|
|Philosophy|Trust|Sovereignty|
|
||||||
|Difficulty level|Easy|Medium|
|
|Difficulty level|Easy|Medium|
|
||||||
|Pros|Make Blitz accessible to everyone|You don't need to trust us, build from your own forked repository|
|
|Pros|Make Blitz accessible to everyone|You don't need to trust us, build from your own forked repository|
|
||||||
|Cons|You have to trust the mantainer image binaries|You need to read the build_sdcard.sh parameters in order for the customization to suit your needs|
|
|Instructions|(NEW IMAGE WILL BE RELEASED SHORTLY) and [Flash the sd card](README.md#write-the-sd-card-image-to-your-sd-card)|[Build your own sd card image](#build-the-sd-card-image)|
|
||||||
|Instructions|[Download image](https://raspiblitz.fulmo.org/images/raspiblitz-v1.7.0-2021-04-25.img.gz) and [Flash the sd card](README.md#write-the-sd-card-image-to-your-sd-card)|[Build your own sd card image](#build-the-sd-card-image)|
|
|Verify what?|[Signature file]() and [verify the Sig](FAQ.md#how-to-verify-the-sd-card-image-after-download) OR SHA-256 (below)|All of the code, don't trust, verify|
|
||||||
|Verify what?|[Signature file](https://raspiblitz.fulmo.org/images/raspiblitz-v1.7.0-2021-04-25.img.gz.sig) and [verify the Sig](FAQ.md#how-to-verify-the-sd-card-image-after-download) OR SHA-256 (below)|All of the code, don't trust, verify|
|
|
||||||
|
|
||||||
If downloading the mantainer sd card image:
|
If downloading the maintainer sd card image:
|
||||||
* GPG 64-bit: 1C73 060C 7C17 6461
|
* GPG 64-bit: 1C73 060C 7C17 6461
|
||||||
* SHA-256: e6d70ac1662af3e90e57bee8c50e9a7925239431892e1916c2be80e519befc3f
|
* SHA-256: (please wait)
|
||||||
|
|
||||||
Which verification method should I used: Hash or Signature?
|
Which verification method should I used: Hash or Signature?
|
||||||
* Signed file prove to you that the SD card image was actually built by the lead developer of the RaspiBlitz project. (Safest)
|
* Signed file prove to you that the SD card image was actually built by the lead developer of the RaspiBlitz project. (Safest)
|
||||||
* Hash function checks file integrity. (Secure)
|
* Hash function checks file integrity. (Secure)
|
||||||
|
|
||||||
The mantainer sd card image can also be downloaded via torrent:
|
The maintainer sd card image can also be downloaded via torrent:
|
||||||
* [assets/raspiblitz-v1.7.0-2021-04-25.img.gz.torrent](https://github.com/rootzoll/raspiblitz/raw/v1.7/home.admin/assets/raspiblitz-v1.7.0-2021-04-25.img.gz.torrent)
|
* [assets/raspiblitz-vXXX.img.gz.torrent](https://github.com/rootzoll/raspiblitz/raw/v1.7/home.admin/assets/raspiblitz-XXX.img.gz.torrent)
|
||||||
|
|
||||||
Useful info:
|
Useful info:
|
||||||
* [What's new in Version 1.7 of RaspiBlitz?](CHANGES.md#whats-new-in-version-170-of-raspiblitz)
|
* [What's new in Version 1.7.1 of RaspiBlitz?](CHANGES.md#whats-new-in-version-171-of-raspiblitz)
|
||||||
* [How to update my RaspiBlitz?](README.md#updating-raspiblitz-to-new-version)
|
* [How to update my RaspiBlitz?](README.md#updating-raspiblitz-to-new-version)
|
||||||
* [How to migrate to RaspiBlitz from Umbrel/myNode](#make-a-raspiblitz-out-of-your-umbrel-or-mynode)
|
* [How to migrate to RaspiBlitz from Umbrel/myNode](#make-a-raspiblitz-out-of-your-umbrel-or-mynode)
|
||||||
* [How to verify the SD card image after download?](FAQ.md#how-to-verify-the-sd-card-image-after-download)
|
* [How to verify the SD card image after download?](FAQ.md#how-to-verify-the-sd-card-image-after-download)
|
||||||
|
@ -149,7 +152,7 @@ Insert the SD card and connect the power plug.
|
||||||
* [Can I directly connect the RaspiBlitz with my laptop?](FAQ.md#can-i-directly-connect-the-raspiblitz-to-my-laptop)
|
* [Can I directly connect the RaspiBlitz with my laptop?](FAQ.md#can-i-directly-connect-the-raspiblitz-to-my-laptop)
|
||||||
* [I connected my HDD, but it still says 'Connect HDD' on the display?](FAQ.md#i-connected-my-hdd-but-it-still-says-connect-hdd-on-the-display)
|
* [I connected my HDD, but it still says 'Connect HDD' on the display?](FAQ.md#i-connected-my-hdd-but-it-still-says-connect-hdd-on-the-display)
|
||||||
|
|
||||||
When everything boots up correctly, you should see the local IP address of your RaspiBlitz on the LCD panel.
|
When everything boots up correctly (one reboot is normal), you should finally see the local IP address of your RaspiBlitz on the LCD panel.
|
||||||
|
|
||||||
- [How do I find the IP address when running without a display?](FAQ.md#how-do-i-find-the-ip-address-when-running-without-a-display)
|
- [How do I find the IP address when running without a display?](FAQ.md#how-do-i-find-the-ip-address-when-running-without-a-display)
|
||||||
|
|
||||||
|
@ -159,7 +162,9 @@ Now open up a terminal ([OSX](https://www.youtube.com/watch?v=5XgBd6rjuDQ)/[Win1
|
||||||
|
|
||||||
`ssh admin@[YOURIP]` → use password: `raspiblitz`
|
`ssh admin@[YOURIP]` → use password: `raspiblitz`
|
||||||
|
|
||||||
**Now follow the dialogue in your terminal. This can take some time (prepare some coffee) - but in the end you should have a running Lightning node on your RaspberryPi that you can start to learn and hack on.**
|
**Now follow the dialogue in your terminal.**
|
||||||
|
|
||||||
|
*Further down you will find more [detailed documentation of the setup process](#setup-process-detailed-documentation).*
|
||||||
|
|
||||||
* [I cannot connect per SSH to my RaspiBlitz. What to do?](FAQ.md#i-cannot-connect-per-ssh-to-my-raspiblitz-what-to-do)
|
* [I cannot connect per SSH to my RaspiBlitz. What to do?](FAQ.md#i-cannot-connect-per-ssh-to-my-raspiblitz-what-to-do)
|
||||||
|
|
||||||
|
@ -173,7 +178,7 @@ If you run into a problem or you have still a question, follow the steps below t
|
||||||
|
|
||||||
2. If you have a hardware problem, please check that your hardware parts are exactly the parts recommended in the shopping list above. Different screens or even SSD-casings can cause problems.
|
2. If you have a hardware problem, please check that your hardware parts are exactly the parts recommended in the shopping list above. Different screens or even SSD-casings can cause problems.
|
||||||
|
|
||||||
3. Please determine if your problem/question is about RaspiBlitz or for example with LND. For example if you can't route a payment or get an error when opening a channel that is an LND question/problem and is best answered by the LND dev community: https://dev.lightning.community
|
3. Please determine if your problem/question is about RaspiBlitz or for example with LND or c-lightning. For example if you can't route a payment or get an error when opening a channel that is an LND/c-lightning question/problem and is best answered by the [LND dev community](https://dev.lightning.community) or the [c-lightning documentation](https://lightning.readthedocs.io/)
|
||||||
|
|
||||||
4. Go to the GitHub issues of the RaspiBlitz: https://github.com/rootzoll/raspiblitz/issues Do a search there. Also check closed issues by removing 'is:open' from the filter/search-box.
|
4. Go to the GitHub issues of the RaspiBlitz: https://github.com/rootzoll/raspiblitz/issues Do a search there. Also check closed issues by removing 'is:open' from the filter/search-box.
|
||||||
|
|
||||||
|
@ -203,115 +208,53 @@ There are plenty off rooms you can find Raspiblitz users that can help you:
|
||||||
|
|
||||||
## Setup Process (Detailed Documentation)
|
## Setup Process (Detailed Documentation)
|
||||||
|
|
||||||
*The goal is, that all information needed during setup is provided from the interaction with the RaspiBlitz itself during the setup. Documentation in this chapter is for background, comments for educators and to mention edge cases.*
|
*The following documentation will provide more detailed background information on the setup process.*
|
||||||
|
|
||||||
If you are looking for a tutorial on how to organize a workshop to build the RaspiBlitz, [see here](WORKSHOP.md).
|
If you are looking for a tutorial on how to organize a workshop to build the RaspiBlitz, [see here](WORKSHOP.md).
|
||||||
|
|
||||||
### Init
|
### Basic Setup
|
||||||
|
|
||||||
In the beginning you can choose how to setup your RaspiBlitz, by running on Bitcoin or Litecoin with Lightning. This is also the point where you can import a Migration file from an older RaspiBlitz - read about Migration [further down](README.md#import-a-migration-file). The default choice here is Bitcoin.
|
Everytime you start with a fresh sd card image you will get offerered different options. For example this is also the point where you can import a Migration file from an older RaspiBlitz - read about Migration [further down](README.md#import-a-migration-file). But because you are setting up a brand new RaspiBlitz you will choose here `FRESHSETUP`.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
Then you will be asked what todo with the connected harddrive/ssd.
|
||||||
|
|
||||||
|
If there is already a blockchain on your hardrive/ssd - you will be asked if you want to use this pre-synced/validated data or if its OK to delete it. If there is no blockchain data - this question will be skipped.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Finally you have to agree that all (other) data will get deleted on the harddrive/ssd (except the blockchain if you choosed that before). This might take some seconds.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
First thing to setup is giving your RaspiBlitz a name:
|
First thing to setup is giving your RaspiBlitz a name:
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
This name is given to the RaspiBlitz as a public alias of the lightning node for everybody to see.
|
This name is given to the RaspiBlitz as a public alias of the lightning node for everybody to see.
|
||||||
|
|
||||||
Then the user is requested to think of and write down 4 passwords:
|
Then you can choose which Lightning implementation you want to run on top of your Bitcoin Fullnode. RaspiBlitz started with `LND` from Lightning Labs which is used by most other RaspberryPi lightning nodes and works with most additional apps. But you can now also choose `CL` for c-lightning by Blockstream which is a good choice for already more experienced node operators & lightning developers that want to use the highly customizable plug-in structure that c-lightning offers.
|
||||||
|
|
||||||

|
Its also possible to use both in parallel on your RaspiBlitz later on - just pick one to start with or choose `NONE` is your only interested in running a Fullnode without Lightning.
|
||||||
|
|
||||||
You can use this [RaspiBlitz Password Sheet (PDF)](https://github.com/rootzoll/raspiblitz/raw/v1.4/home.admin/assets/RaspiBlitzRecoverySheet.pdf) to write those passwords down for save storage and also use it later on for your Seed Words.
|

|
||||||
|
|
||||||
*The password A,B,C & D idea is directly based on the [RaspiBolt Guide Preparations](https://stadicus.github.io/RaspiBolt/raspibolt_10_preparations.html#write-down-your-passwords) - check out for more background.*
|
*In the following we show the setup with LND - which is very similar to the steps with c-lightning.*
|
||||||
|
|
||||||
Then the user is asked to enter the Password A:
|
If you choosed one of the lightning implementations you will now be asked if you want to start a `NEW` wallet/lightning node or if you had an `OLD` lightning wallet/node that you want to re-create.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
This is the new password which has to be used for every SSH login after this screen with the user admin. It's also set for the existing user: root, bitcoin & pi.
|
Normally you just chose `NEW` here .. but to recover an old wallet you have the following options if you choose `OLD`:
|
||||||
|
|
||||||
*The bitcoin and lightning services will later run in the background (as daemon) and use the separate user “bitcoin” for security reasons. This user does not have admin rights and cannot change the system configuration.*
|

|
||||||
|
|
||||||
Then the user is asked to enter the Password B - this is internally used for the bitcoin RPC interface. But also as login for additional apps like the RTL-WebGUI or the Blockexplorer:
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
*The other passwords C & D will be needed later on. They will be used during the lightning wallet setup.*
|
|
||||||
|
|
||||||
After this the setup process will need some time and the user will see a lot of console outputs - just wait until it's finished:
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
### Getting the Blockchain
|
|
||||||
|
|
||||||
*If you have a HDD/SSD with a prepared blockchain (e.g. a ready2go-set or you are at a workshop) you have the option to trust that data and skip to the [next chapter](#setup-lightning). If you started with an empty HDD - you will see the following screens:*
|
|
||||||
|
|
||||||
If you connected a fresh Hard Drive or SSD to the RaspiBlitz, it might now ask you if it's OK to format it.
|
|
||||||
|
|
||||||
<img src="pictures/ssh4-formatHDD.png" alt="format-HDD" width="366">
|
|
||||||
|
|
||||||
*Your HDD/SSD will get formatted with the linux standard file system EXT4. If you want to try out the experimental new [BTRFS](FAQ.md#why-use-btrfs-on-raspiblitz) that RaspiBlitz supports since v1.4 - you need to start the setup with an additional 32GB USB thumb drive connected to the second USB3 port of the RaspberryPi. Then you will unlock this new secret feature.*
|
|
||||||
|
|
||||||
After formatting you need to get a copy of the blockchain; the RaspiBlitz offers the following options:
|
|
||||||
|
|
||||||
<img src="pictures/ssh5-blockchain2.png" alt="blockchain-options" width="551">
|
|
||||||
|
|
||||||
The options - and when to choose which - will be explained here shortly:
|
|
||||||
|
|
||||||
#### 1. SYNC - Selfvalidate all Blocks
|
|
||||||
|
|
||||||
With the new RaspberryPi 4 (with SSD & min 2GB RAM) this is the best way to go. It will take around 2-3 days to sync & validate directly with the bitcoin network. With this option, you have done it the original `don't trust, verify` way.
|
|
||||||
|
|
||||||
*For the old RaspberryPi 3 this is not recommended. A RaspberryPi 3 has a very low power CPU and syncing+validating the blockchain directly with the peer2peer network can take multiple weeks - that's why for a RP3 you should choose the COPY option .*
|
|
||||||
|
|
||||||
#### 2. COPY - Copy from Laptop or another RaspiBlitz over Local Network
|
|
||||||
|
|
||||||
First you need to download & validate the blockchain on your own computer/laptop. Todo so install bitcoin-core (0.18.1 or higher) from [bitcoin.org](https://bitcoin.org/en/download) and keep it running until blockchain is synced (will need around 320 GB).
|
|
||||||
|
|
||||||
Then you can use the COPY option to copy the blockchain over to the RaspiBlitz. This will be done over the local network by SCP (SSH file transfer) - follow the instructions given in the dialogs.
|
|
||||||
|
|
||||||
It's advised to keep a backup of the bitcoin-core & the blockchain data (e.g. on your laptop) in case you need to re-setup the RaspiBlitz.
|
|
||||||
|
|
||||||
More details: [I have the full blockchain on another computer. How do I copy it to the RaspiBlitz?](FAQ.md#i-have-the-full-blockchain-on-another-computer-how-do-i-copy-it-to-the-raspiblitz)
|
|
||||||
|
|
||||||
### Setup Lightning
|
|
||||||
|
|
||||||
Lightning is installed and waiting for your setup if you see this screen.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
You can now decide if you want to setup a fresh new wallet or if you want to recover an old wallet from a RaspiBlitz you had before.
|
|
||||||
|
|
||||||
#### Setup a NEW Wallet
|
|
||||||
|
|
||||||
This is the default if you setup a RaspiBlitz the first time.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
RaspiBlitz will ask you to set your wallet unlock password - use your chosen PASSWORD C here. Confirm by inputting it a second time.
|
|
||||||
|
|
||||||
LND will now generate a fresh cipher seed (word list) for you.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
WRITE YOUR PERSONAL WORDS DOWN before you continue - without it you limit your chances to recover funds in case of failing hardware etc. If you just want to try/experiment with the RaspiBlitz, at least take a photo with your smartphone just in case. If you plan to keep your RaspiBlitz running, store this word list offline or in a password safe. You can use the [RaspiBlitz Password Sheet (PDF)](https://github.com/rootzoll/raspiblitz/raw/v1.4/home.admin/assets/RaspiBlitzRecoverySheet.pdf) for this.
|
|
||||||
|
|
||||||
#### Recover an OLD Wallet
|
|
||||||
|
|
||||||
Choose this option if you had an old RaspiBlitz you want to recover. You have three options to do that:
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
The RaspiBlitz calling the LND wallet creation command for you:
|
|
||||||
|
|
||||||
##### LNDRESCUE LND tar.gz-Backupfile (BEST)
|
##### LNDRESCUE LND tar.gz-Backupfile (BEST)
|
||||||
|
|
||||||
Choose this option if you have made a complete backup of the LND data and have a tar.gz file starting with the word 'lnd-rescue' available. It will recover all your on-chain funds and open channels you had. But you have to make sure that the LND backup you have is really the latest version - otherwise you might lose channel funds.
|
Choose this option if you have made a complete backup of the LND or c-lightning data and have a tar.gz file starting with the word 'lnd-rescue' or 'cl-rescue' available. It will recover all your on-chain funds and open channels you had. But you have to make sure that the rescue backup you have is really the latest version - otherwise you might lose channel funds.
|
||||||
|
|
||||||
*If you have tar.gz file that starts with 'raspiblitz', that's a migration file. That also includes your old LND wallet, but you import it earlier in the setup process .. see further below for details.*
|
*If you have tar.gz file that starts with 'raspiblitz', that's a migration file. That also includes your old LND/c-lightning wallet, but you import that file at the beginning of the setup process with 'FROMBACKUP - Upload Migration Backup' instead choosing FRESHSETUP*
|
||||||
|
|
||||||
##### SEED+SCB Words Seed & channel.backup file (OK)
|
##### SEED+SCB Words Seed & channel.backup file (OK)
|
||||||
|
|
||||||
|
@ -321,55 +264,87 @@ Next best option is, if you have the channel.backup file and the word list seed.
|
||||||
|
|
||||||
If you just have the word list (RaspiBlitz 1.1 and older) you can at least try to recover your on-chain funds. Recovery of channel funds is not very likely in this scenario.
|
If you just have the word list (RaspiBlitz 1.1 and older) you can at least try to recover your on-chain funds. Recovery of channel funds is not very likely in this scenario.
|
||||||
|
|
||||||
### Final LND Setup
|
But normally you are setting up a new node - so simply choose `NEW` in the menu.
|
||||||
|
|
||||||
It will now make sure your wallet is initialized correctly and may ask you to unlock it with PASSWORD C.
|

|
||||||
|
|
||||||

|
Finally you have to set 3 passwords called A, B & C ... please choose here single strings (without spaces and special characters) that are at least 8 chars long.
|
||||||
|
|
||||||
*The LND wallet needs to get unlocked on every new start/reboot of the RaspiBlitz.*
|
You can use this [RaspiBlitz Recovery Sheet (PDF)](https://github.com/rootzoll/raspiblitz/raw/v1.7/home.admin/assets/RaspiBlitzRecoverySheet.pdf) to write those passwords down for save storage and also use it later on for your Seed Words.
|
||||||
|
|
||||||
The RaspiBlitz will now do final setup configuration, such as installing tools, moving the SWAP file to the HDD, or activating the firewall. You will see some text moving across the screen until this screen:
|
*The password A,B,C idea is based on the [RaspiBolt Guide Preparations](https://stadicus.github.io/RaspiBolt/raspibolt_10_preparations.html#write-down-your-passwords) - check out for more background.*
|
||||||
|
|
||||||

|
First Password A is requested - this is the new password which has to be used for every SSH login for now. It's also set for the existing users: admin, root, bitcoin & pi.
|
||||||
|
|
||||||
The basic setup is done - hooray ... but it may still take some time before everything is ready and you can play around with your new RaspiBlitz. Press 'OK' to reboot. Your terminal session will get disconnected and the raspberry pi restarts.
|
*The bitcoin and lightning services will later run in the background (as daemon) and use the separate user “bitcoin” for security reasons. This user does not have admin rights and cannot change the system configuration.*
|
||||||
|
|
||||||
### First Start: Syncing & Scanning
|
Then enter the Password B - this is internally used for the bitcoin RPC interface. But also as login for additional apps like the RTL-WebGUI or the Blockexplorer:
|
||||||
|
|
||||||
After the reboot is done, it will take a while for all services to start up - wait until you see on the LCD/display that LND wallet needs to get unlocked. Then SSH in again with the same command like in the beginning (check LCD/display) but this time (and every following login) use your PASSWORD A.
|
And finally enter the Password C - this is used to encrypt/lock the lightning wallet on the harddrive/ssd and is used by LND. Everytime a lightning node is started/rebooted LND needs load the wallet into memory to work with and ask you for the Password C to "unlock" the wallet.
|
||||||
|
|
||||||
After terminal login, LND will ask you (like on every start/reboot) to unlock the wallet again - use PASSWORD C:
|
*In the early RaspiBlitz versions there was also an additional Pasword D, that is no longer in use.*
|
||||||
|
|
||||||

|
After this the setup process will need some time to set everything up - just wait until it's finished - this can take from 10 to 30 minutes:
|
||||||
|
|
||||||
On first start, you will have a longer waiting time (between 10 minutes and 2-3 days, depending on your initial setup) ... but that's OK, just leave the RaspiBlitz running until it's done.
|

|
||||||
|
|
||||||

|
### Final Setup
|
||||||
|
|
||||||
*You can even close your terminal now and shutdown your laptop and ssh back in later on. You will see on the Blitz LCD/display that it is ready when the blue background screen is gone, and you see a status screen.*
|
Once the basic setup ran thru you lightning node & wallet was created and you get presented the important backup seed words which you need to write down on paper and store them in a secure location. You will need to confirm that you wrote the seed words down before you can continue.
|
||||||
|
|
||||||
To understand what is taking so long .. it's two things:
|

|
||||||
|
|
||||||
1. Blockchain Sync
|
WRITE YOUR PERSONAL WORDS DOWN before you continue - you will need them to recover funds in case of failing hardware etc. If you just want to try/experiment with the RaspiBlitz, at least take a photo with your smartphone just in case. If you plan to keep your RaspiBlitz running, store this word list offline or in a password safe.
|
||||||
|
|
||||||
The blockchain on your HDD is not absolutely up-to-date. Depending on how you got it transferred to your RaspiBlitz it will be some hours, days, or even weeks behind. Now the RaspiBlitz needs to catch-up on the rest by directly syncing with the peer-2-peer network until it reaches almost 100%. Even if you see progress at 99.8%, there can still be waiting time - gaining 1% can take up to 4 hours (depending on network speed), so be patient here.
|
You can use this [RaspiBlitz Recovery Sheet (PDF)](https://github.com/rootzoll/raspiblitz/raw/v1.7/home.admin/assets/RaspiBlitzRecoverySheet.pdf) to write down those seed words for save storage.
|
||||||
|
|
||||||
2. Lightning Scanning
|
If you dont had a full copy of the blockchain pre-synced/validated on your harddrive/ssd then you will now be asked how you want to get your copy of the blockchain .. there are two basic options here:
|
||||||
|
|
||||||
Automatically if the Blockchain Sync is progressing LND will start to scan the blockchain and collect information. The Lightning scanning alone normally just takes around 1 hour until the waiting time is over. Can take much longer if you recover on old wallet from seed.
|

|
||||||
|
|
||||||
* [Why is my "final sync" taking so long?](FAQ.md#why-is-my-final-sync-taking-so-long)
|
#### 1. SYNC - Selfvalidate all Blocks
|
||||||
|
|
||||||
Once all is done, you should see a status screen on the RaspiBlitz LCD/display like this:
|
With the new RaspberryPi 4 (with SSD & min 2GB RAM) this is the best way to go. It will take around 3-6 days to sync & validate directly with the bitcoin network. With this option, you have done it the original `don't trust, verify` way.
|
||||||
|
|
||||||

|
*For the old RaspberryPi 3 this is not recommended. A RaspberryPi 3 has a very low power CPU and syncing+validating the blockchain directly with the peer2peer network can take multiple weeks - that's why for a RP3 you should choose the COPY option .*
|
||||||
|
|
||||||
|
#### 2. COPY - Copy from Laptop or another RaspiBlitz over Local Network
|
||||||
|
|
||||||
|
If you have a friend that is already running a synced RaspiBlitz or you have a laptop with enough free space on the harddrive that can download & validate the Blockchain much faster you can also choose the `COPY` option. You can then delete existing blockchain your RaspiBlitz already started syncing for you.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
To copy from another RaspiBlitz choose `BLITZ` and follow the instructions. Know that the other Blitz will be offline to the lightning network during the copy that will take multiple hours.
|
||||||
|
|
||||||
|
To copy from your laptop/computer (`WINDOWNS`, `MACOS` & `LINUX` options) you first need to download & validate the blockchain on your own computer/laptop. Todo so install latest bitcoin-core (0.18.1 or higher) from [bitcoin.org](https://bitcoin.org/en/download) and keep it running until blockchain is synced (will need around 400 GB). Then under the `COPY` option choose the Operating System. The copy will be done over the local network by SCP (SSH file transfer) - follow the instructions given in the dialogs. It's advised to keep a backup of the bitcoin-core & the blockchain data (e.g. on your laptop) in case you need to re-setup the RaspiBlitz.
|
||||||
|
|
||||||
|
More details: [I have the full blockchain on another computer. How do I copy it to the RaspiBlitz?](FAQ.md#i-have-the-full-blockchain-on-another-computer-how-do-i-copy-it-to-the-raspiblitz)
|
||||||
|
|
||||||
|
If you dont have the Bitcoin Blockchain already on another laptop or RaspiBlitz simply choose `SELFSYNC`.
|
||||||
|
|
||||||
|
And hooray :D Your RaspiBlitz is ready to go! Welcome new node operator.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
If you hit OK, the RaspiBlitz will go into a final reboot.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Just wait a bit and then the SSH command to login again. Dont forget to use this time your password A ... which is always for password for system login.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
If you run LND you will be asked to unlock your wallet - thats always your password C. BTW under `SETTINGS` in the main menu you can activate the Auto-Unlock if you prefer.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Remeber that now your RaspiBlitz might need a longer time to sync/validate the blockchain - this can be multiple days. In the beginnig you might see fast progress but its normal that this gets slower later on. Also your RaspberryPi CPU might get quite hot ... thats also OK during this inital sync time - the RaspberryPi has its own protection against overheating and will push thru.
|
||||||
|
|
||||||
### Main Menu
|
### Main Menu
|
||||||
|
|
||||||
If you now login by SSH in your RaspiBlitz (or you are still logged in) you will see the Main Menu:
|
Once the Blockchain is synced you will enter the SSH Main Menu:
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
All options on the main menu will be explained below in the feature documentation.
|
All options on the main menu will be explained below in the feature documentation.
|
||||||
|
|
||||||
|
@ -381,7 +356,7 @@ If you need an idea of what the most basic next steps to experience Lightning wo
|
||||||
* Open a channel
|
* Open a channel
|
||||||
* Make a payment
|
* Make a payment
|
||||||
|
|
||||||
If you would prefer to do this from a web browser with a dashboard UI, instead of an SSH terminal, go to `SERVICES`, activate the `RTL Webinterface`, and after the reboot you will see a new `RTL` option in the SSH main menu - it will give you all the information so that you can now open the RTL Webinterface in your browser.
|
If you would prefer to do this from a web browser with a dashboard UI, instead of an SSH terminal, go to `SERVICES`, activate the `RTL Webinterface`, and after install you will find a new menu option for RTL in the SSH main menu - it will give you all the information so that you can now open the RTL Webinterface in your browser.
|
||||||
|
|
||||||
Have fun riding the lightning :D
|
Have fun riding the lightning :D
|
||||||
|
|
||||||
|
@ -393,7 +368,7 @@ Have fun riding the lightning :D
|
||||||
|
|
||||||
These are the features available through the RaspiBlitz SSH menus. They have the goal to offer some basic/fallback functionality & configurations. More complex or user-friendly tasks are best to be done with wallets, apps and scripts you connect to your Lightning Node via [APIs](#interface--apis) - because you have a full Bitcoin- and Lightning-Node on the RaspiBlitz.
|
These are the features available through the RaspiBlitz SSH menus. They have the goal to offer some basic/fallback functionality & configurations. More complex or user-friendly tasks are best to be done with wallets, apps and scripts you connect to your Lightning Node via [APIs](#interface--apis) - because you have a full Bitcoin- and Lightning-Node on the RaspiBlitz.
|
||||||
|
|
||||||
So let's take a look at the SSH main in detail:
|
So let's take a look at the SSH main menu in detail:
|
||||||
|
|
||||||
#### INFO: Raspiblitz Status Screen
|
#### INFO: Raspiblitz Status Screen
|
||||||
|
|
||||||
|
@ -409,21 +384,21 @@ This is the screen that gets displayed on the LCD/display. It's useful to call i
|
||||||
|
|
||||||
#### LIGHTNING (Basic Node Management)
|
#### LIGHTNING (Basic Node Management)
|
||||||
|
|
||||||
Under `LIGHTNING` you find some basic steps to manage your Lightning node. Those are very simplified in the RaspiBlitz SSH menu for the reason of learning. For more advanced management of your Lightning node see additional apps under 'SERVICES'.
|
Under `LND/c-lightning Wallet options` you find some basic steps to manage your Lightning node. Those are very simplified in the RaspiBlitz SSH menu for the reason of learning. For more advanced management of your Lightning node see additional apps under `SERVICES`.
|
||||||
|
|
||||||
##### FUNDING: Fund your on-chain Wallet
|
##### FUNDING: Fund your on-chain Wallet
|
||||||
|
|
||||||
Before you can open channels with other nodes you need to put some coins in your LND on-chain wallet. Use this option to generate an address to send funds to.
|
Before you can open channels with other nodes you need to put some coins in your on-chain wallet (managed by your lightning sofware). Use this option to generate an address to send funds to.
|
||||||
|
|
||||||
*Reminder: RaspiBlitz & LND is still experimental software. With funding your LND node you accept the risk of losing funds. So just play with small amounts - something in the area of 20 EUR/USD should be enough to make your first experiences. Also, it's a good privacy practice to [coinjoin your coins](https://bitcoin-only.com/privacy) before sending them to any Lightning Network wallet.*
|
*Reminder: RaspiBlitz is still experimental software. With funding your lightning node you accept the risk of losing funds. So just play with small amounts - something in the area of 20 EUR/USD should be enough to make your first experiences. Also, it's a good privacy practice to [coinjoin your coins](https://bitcoin-only.com/privacy) before sending them to any Lightning Network wallet.*
|
||||||
|
|
||||||
You can fund it multiple times - starting with small amounts first to test. LND will always generate a different address, but all funds you send will get into the same LND on-chain wallet.
|
You can fund it multiple times - starting with small amounts first to test. Your lightning node will always generate a different address, but all funds you send will get into the same LND on-chain wallet.
|
||||||
|
|
||||||
##### CONNECT: Connect to a Peer
|
##### CONNECT: Connect to a Peer
|
||||||
|
|
||||||
Before you can open a channel with another node on the network, you need to connect this node as a peer to your node.
|
Before you can open a channel with another node on the network, you need to connect this node as a peer to your node.
|
||||||
|
|
||||||
Opening a channel with a peer is just optional. Having another node as peer helps your node to receive information about the network through the gossip protocol. It will help your node to find better routes through the network.
|
Opening a channel with a peer is just optional. Having another node as peer helps your node to receive information about the lightning network through the gossip protocol. It will help your node to find better routes through the network.
|
||||||
|
|
||||||
##### CHANNEL: Open a Channel with Peer
|
##### CHANNEL: Open a Channel with Peer
|
||||||
|
|
||||||
|
@ -449,20 +424,6 @@ Create an invoice to send to someone for a service to be paid through lightning.
|
||||||
|
|
||||||
*This is just a very basic shell script. For more usability try the RTL Webinterface (under Services) or connect a (mobile) wallet with your RaspiBlitz.*
|
*This is just a very basic shell script. For more usability try the RTL Webinterface (under Services) or connect a (mobile) wallet with your RaspiBlitz.*
|
||||||
|
|
||||||
#### lnbalance: Detailed Wallet Balances
|
|
||||||
|
|
||||||
<img src="pictures/bonus-lnbalance.png" alt="bonus-lnbalance" width="600">
|
|
||||||
|
|
||||||
#### lnchannels: Lightning Channel List
|
|
||||||
|
|
||||||
<img src="pictures/bonus-lnchannels.png" alt="bonus-lnchannels" width="600">
|
|
||||||
|
|
||||||
#### lnfwdreport: Report on your earned fees for Forwarding Payments
|
|
||||||
|
|
||||||
If you connected your node well within the Lightning Network you can become a "Routing Node". Other users might select your Node as part of a Lightning Payment and will pay you the fee you set on those channels. This menu point gives you a detailed report over the amount of days you set.
|
|
||||||
|
|
||||||
Beware - earning fees as a routing node does not come automatic. It's a bit of hard work of building the right channels to be attractive for other people to route through. Check the internet for tutorials or use tools like "lndmanage" (see under RaspiBlitz SERVICES) to help you analyse and optimize your channel management.
|
|
||||||
|
|
||||||
##### NAME: Change name of your Node
|
##### NAME: Change name of your Node
|
||||||
|
|
||||||
Here you can change the alias name of your node as it is shown as part of the Lightning network.
|
Here you can change the alias name of your node as it is shown as part of the Lightning network.
|
||||||
|
@ -487,25 +448,6 @@ Here you will find basic settings for your RaspiBlitz:
|
||||||
|
|
||||||
Activate/Deactivate settings with the space bar and then select 'OK' to activate changes. You can find more details about those options (top to down):
|
Activate/Deactivate settings with the space bar and then select 'OK' to activate changes. You can find more details about those options (top to down):
|
||||||
|
|
||||||
##### Run behind Tor
|
|
||||||
|
|
||||||
You can run your Bitcoin- & Lightning-Node, as well as additional Apps, as a Tor hidden service - replacing your IP with an .onion-address
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
Running your node as a hidden service has some benefits:
|
|
||||||
|
|
||||||
* You don't publish your IP running a node so it's much harder to resolve your real name and location.
|
|
||||||
* You tunnel through the NAT of your router and make Bitcoin and Lightning reachable to all other Tor nodes.
|
|
||||||
* By using a Tor address it's possible to move the node to a different IPv4 address and keep the existing (i.e. previously opened and funded) channels functional.
|
|
||||||
|
|
||||||
But this can also come with the following side effects:
|
|
||||||
|
|
||||||
* Some Mobile wallets don't support connecting to RaspiBlitz over Tor yet.
|
|
||||||
* Lightning nodes that don't run Tor cannot reach you (like behind NAT).
|
|
||||||
|
|
||||||
To try it out, just switch on the service - you can deactivate it later on if it's not working for you.
|
|
||||||
|
|
||||||
##### Touchscreen (experimental)
|
##### Touchscreen (experimental)
|
||||||
|
|
||||||
Your RaspiBlitz has an LCD that is touchscreen capable. You can switch on this new feature that is still in development.
|
Your RaspiBlitz has an LCD that is touchscreen capable. You can switch on this new feature that is still in development.
|
||||||
|
@ -523,7 +465,50 @@ It will give you 4 buttons on the right side.
|
||||||
|
|
||||||
If you switch this on, you can rotate the LCD of your RaspiBlitz 180 degrees. This might make sense if you have a special case or wall mount.
|
If you switch this on, you can rotate the LCD of your RaspiBlitz 180 degrees. This might make sense if you have a special case or wall mount.
|
||||||
|
|
||||||
##### Channels Autopilot
|
##### Run behind Tor
|
||||||
|
|
||||||
|
You can run your Bitcoin- & Lightning-Node, as well as additional Apps, as a Tor hidden service - replacing your IP with an .onion-address
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Running your node as a hidden service has some benefits:
|
||||||
|
|
||||||
|
* You don't publish your IP running a node so it's much harder to resolve your real name and location.
|
||||||
|
* You tunnel through the NAT of your router and make Bitcoin and Lightning reachable to all other Tor nodes.
|
||||||
|
* By using a Tor address it's possible to move the node to a different IPv4 address and keep the existing (i.e. previously opened and funded) channels functional.
|
||||||
|
|
||||||
|
But this can also come with the following side effects:
|
||||||
|
|
||||||
|
* Some Mobile wallets don't support connecting to RaspiBlitz over Tor yet.
|
||||||
|
* Lightning nodes that don't run Tor cannot reach you (like behind NAT).
|
||||||
|
|
||||||
|
*Using Tor hides your IP address but will possibly increase the [time](https://twitter.com/SeverinAlexB/status/1442138426740981761) it will take for your node to route a payment. Setting up over clearnet will give you a lower response time when routing but your IP address will be freely availible to the rest of the network like the node [tippin.me](https://1ml.com/node/03c2abfa93eacec04721c019644584424aab2ba4dff3ac9bdab4e9c97007491dda). If you need to be private and/or don't want to doxx your home network then Tor might be the option for you. However if privacy isn't something you need and/or want, or you are trying to set up a service that your node is the back end for then clearnet might be more advantageous choice.*
|
||||||
|
|
||||||
|
To try it out, just switch on the service - you can deactivate it later on if it's not working for you.
|
||||||
|
|
||||||
|
##### Parallel Testnet/Signet
|
||||||
|
|
||||||
|
It is very convenient to learn and test to play around in a "sandbox" environment. RaspiBlitz allows this through activating "Testnet & Signet" that run in parallel to the "Mainnet".
|
||||||
|
|
||||||
|
Once activated you will see an additional option in the SSH Main Menu that will give you more options to operate the Testnet & Signet.
|
||||||
|
|
||||||
|
You can get Bitcoin Testnet coins you can use Faucets from different places on the internet, here are a few links:
|
||||||
|
* https://coinfaucet.eu/en/btc-testnet/
|
||||||
|
* https://testnet-faucet.mempool.co/
|
||||||
|
* https://kuttler.eu/en/bitcoin/btc/faucet/
|
||||||
|
* https://faucet.lightning.community/
|
||||||
|
|
||||||
|
You can read more about TESTNET and Bitcoin Faucets here: https://kuttler.eu/code/bitcoin-testnet-blockchain-size-in-2020/
|
||||||
|
|
||||||
|
##### ZeroTier
|
||||||
|
|
||||||
|
With ZeroTier you can add your RaspiBlitz to a software defined network - see for details: https://en.wikipedia.org/wiki/ZeroTier
|
||||||
|
|
||||||
|
##### LND LIGHTNING LABS NODE
|
||||||
|
|
||||||
|
This needs to switched on to see the sub-settings options for LND. If switched on it means the LND lightning node implementation is installed and running on your RaspiBlitz - it can run in parallel to c-lightning. If activated you will find an additional option in the SSH Main Menu that offers you more options to operate the LND node. Also under `SERVICES` some apps might just be available if LND is activated.
|
||||||
|
|
||||||
|
##### LND Channel Autopilot
|
||||||
|
|
||||||
The channels autopilot feature of LND allows to automatically uses around half of your on-chain funds (if available) to open new channels with other lightning nodes.
|
The channels autopilot feature of LND allows to automatically uses around half of your on-chain funds (if available) to open new channels with other lightning nodes.
|
||||||
Channels autopilot is very useful to get started transacting swiftly if you're a newbie as the channels are generated for you.
|
Channels autopilot is very useful to get started transacting swiftly if you're a newbie as the channels are generated for you.
|
||||||
|
@ -531,34 +516,13 @@ It is very likely that after a while, once you will have a hang of the concept o
|
||||||
|
|
||||||
Beware that presently toggling the Channels Autopilot setting will trigger a reboot of your Raspiblitz. It is not a problem per se, just a bit of waste of time [Improvement request #1953](https://github.com/rootzoll/raspiblitz/issues/1953)
|
Beware that presently toggling the Channels Autopilot setting will trigger a reboot of your Raspiblitz. It is not a problem per se, just a bit of waste of time [Improvement request #1953](https://github.com/rootzoll/raspiblitz/issues/1953)
|
||||||
|
|
||||||
##### Accept Keysend
|
##### LND Accept Keysend
|
||||||
|
|
||||||
Keysend is a feature of LND that allows your node to accept payments without having created an invoice first. This needs to be activated, for example, if you want to use your nodes for experimental messaging over the Lightning Network (see RaspiBlitz MOBILE apps like SendMany).
|
Keysend is a feature of LND that allows your node to accept payments without having created an invoice first. This needs to be activated, for example, if you want to use your nodes for experimental messaging over the Lightning Network (see RaspiBlitz MOBILE apps like SendMany).
|
||||||
|
|
||||||
##### Testnet
|
##### LND Circuitbreaker (Firewall for LND)
|
||||||
|
|
||||||
It is very convenient to learn and test to play around in a "sandbox" environment. RaspiBlitz allows this through the "Testnet" setting.
|
Not everybody is acting friendly in the Lightning network. Circuitbreaker is a background service you can activate that acts similar to a firewall to protect your now better. For details see: https://github.com/lightningequipment/circuitbreaker/blob/master/README.md
|
||||||
You can freely switch from prod environemt (running on BITCOIN MAINNET) to test environment (running on BITCOIN TESTNET) and back using this setting.
|
|
||||||
The state of your environments is restored everytime you switch (blockchain, wallets, channels) which is very convenient and safe.
|
|
||||||
Note however that switching from one environment to the other requires an auto resynchronisation with the corresponding blockchain (MAINNET or TESTNET) and can take some time (e.x. If you switch for the first time to "Testnet" the initial sync of the TESTNET blockchain may take several hours; also if you switch back and forth environment the corresponding blockchain must catchup from where it left before switching.
|
|
||||||
|
|
||||||
Of course it would be much more fun and less scary if everyone could afford to own 2 distinct RaspiBlitz, one for each environment, this way your production RaspiBlitz remains online all the time and you can recklessly play around on the other one.
|
|
||||||
|
|
||||||
Once in "TESTNET" environment go ahead! Get hold of some Bitcoin Testnet Faucets (these are worthless bitcoins on testnet) and start playing around with them!
|
|
||||||
You can get Bitcoin Testnet Faucets from different places on the internet, here are a few links:
|
|
||||||
* https://coinfaucet.eu/en/btc-testnet/
|
|
||||||
* https://testnet-faucet.mempool.co/
|
|
||||||
* https://kuttler.eu/en/bitcoin/btc/faucet/
|
|
||||||
* https://faucet.lightning.community/
|
|
||||||
|
|
||||||
You can read more about TESTNET and Bitcoin Faucets here: https://kuttler.eu/code/bitcoin-testnet-blockchain-size-in-2020/
|
|
||||||
Have fun.
|
|
||||||
|
|
||||||
IMPORTANT: Presently BTCPay Server service is NOT supported on TESTNET (RPC connection error messages). Until this [issue #1724](https://github.com/rootzoll/raspiblitz/issues/1724) is resolved you can [play around with BTCPay Server on TESTNET](https://testnet.demo.btcpayserver.org)
|
|
||||||
|
|
||||||
##### Circuitbreaker (LND Firewall)
|
|
||||||
|
|
||||||
Not everybody is acting friendly in the Lightning network. Circuitbreaker is a background service you cann activate that acts similar to a firewall to protect your now better. For details see: https://github.com/lightningequipment/circuitbreaker/blob/master/README.md
|
|
||||||
|
|
||||||
##### LND Auto-Unlock
|
##### LND Auto-Unlock
|
||||||
|
|
||||||
|
@ -570,21 +534,47 @@ It can be activated under "Services" -> "Auto-unlock LND". We recommend that it
|
||||||
|
|
||||||
* [When using Auto-Unlock, how much security do I lose?](FAQ.md#when-using-auto-unlock-how-much-security-do-i-lose)
|
* [When using Auto-Unlock, how much security do I lose?](FAQ.md#when-using-auto-unlock-how-much-security-do-i-lose)
|
||||||
|
|
||||||
##### StaticChannelBackup on DropBox
|
##### LND StaticChannelBackup on Nextcloud
|
||||||
|
|
||||||
See [below on this README](README.md#backup-for-on-chain---channel-funds) for your Backup options to secure your funds against loss. Storing the encrypted Static Channel Backup file to your Dropbox account is an easy and secure way to do this.
|
See [below on this README](README.md#backup-for-on-chain---channel-funds) for your Backup options to secure your funds against loss. Storing the encrypted Static Channel Backup file to your Nextcloud account is an easy and secure way to do this.
|
||||||
|
|
||||||
|
Nextcloud is an open-source project to host your own files: https://en.wikipedia.org/wiki/Nextcloud - in its basics its an open DropBox replacement ... but can do much much more. You can run it yourself or use a hosted Nextcloud server. Find free Nextcloud providers here to sign up: https://nextcloud.com/signup/
|
||||||
|
|
||||||
##### StaticChannelBackup on USB Drive
|
##### StaticChannelBackup on USB Drive
|
||||||
|
|
||||||
You can connect a small extra USB drive to your RaspiBlitz (choose a small one up to 32GB - don't use second HDD or SSD here, that would drain too much power from the RaspiBlitz). On that USB drive your latest StaticChannelBackup will be stored - just in case your HDD gets an error.
|
You can connect a small extra USB drive to your RaspiBlitz (choose a small one up to 32GB - don't use second HDD or SSD here, that would drain too much power from the RaspiBlitz). On that USB drive your latest StaticChannelBackup will be stored - just in case your HDD gets an error.
|
||||||
|
|
||||||
##### ZeroTier
|
##### StaticChannelBackup per SCP/SSH to other server
|
||||||
|
|
||||||
With ZeroTier you can add your RaspiBlitz to a software defined network - see for details: https://en.wikipedia.org/wiki/ZeroTier
|
An option for more advanced users that you only can set directly in the `raspiblitz.conf` is the automated backup of the Static Channel Backup to another server per SSH/SCP. For this you need to set the value:
|
||||||
|
|
||||||
|
`scpBackupTarget='[USER]@[SERVER]:[DIRPATH-WITHOUT-ENDING-/]'`
|
||||||
|
|
||||||
|
and you can optionally set custom options for the scp command (for example to set a non-default port) with:
|
||||||
|
|
||||||
|
`scpBackupOptions='[YOUR-CUSTOM-OPTIONS]'`
|
||||||
|
|
||||||
|
On target server add the root ssh public key of your RaspiBlitz to the authorized_keys for the user - how to do this see: https://www.linode.com/docs/security/authentication/use-public-key-authentication-with-ssh/
|
||||||
|
|
||||||
|
##### C-LIGHTNING NODE
|
||||||
|
|
||||||
|
This needs to switched on to see the sub-settings options for c-lightning. If switched on it means the c-lighting node implementation is installed and running on your RaspiBlitz - it can run in parallel to LND. If activated you will find an additional option in the SSH Main Menu that offers you more options to operate the c-lightning node. Also under `SERVICES` some apps might just be available if c-lightning is activated.
|
||||||
|
|
||||||
|
For more details on this lightning node implementation go to the [c-lightning FAQ page](FAQ.cl.md).
|
||||||
|
|
||||||
|
##### CL CLBOSS Automatic Node Manager
|
||||||
|
|
||||||
|
CLBOSS is an automated manager for C-Lightning routing payments nodes. CLBOSS is effectively a bunch of heuristics modules wired together to a regular clock to continuously monitor your node.
|
||||||
|
|
||||||
|
Find more info at the [CLBOSS GitHub](https://github.com/ZmnSCPxj/clboss).
|
||||||
|
|
||||||
|
##### CL Wallet Encryption
|
||||||
|
|
||||||
|
You can protect your c-lightning wallet by encrypting it with your passwordC. On every restart/reboot you will need to decrypt/unlock with that password before c-lightning can use the wallet. This adds some physical security for example in case your node get stolen.
|
||||||
|
|
||||||
#### SERVICES: Activate/Deactivate Services
|
#### SERVICES: Activate/Deactivate Services
|
||||||
|
|
||||||
The RaspiBlitz offers further Services, Apps and configuration (scroll down to see all options in the RaspiBlitz):
|
The RaspiBlitz offers further Services, Apps and configuration (scroll down to see all options in the RaspiBlitz) also some Apps & Services might just be available if you installed/activated LND or c-lightning:
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
@ -606,9 +596,65 @@ Learn how you can use Electrum with your own Server over Tor:
|
||||||
|
|
||||||
After install, you will see a new `ELECTRS` option in the SSH main menu - it will give you all the information you need to start using it.
|
After install, you will see a new `ELECTRS` option in the SSH main menu - it will give you all the information you need to start using it.
|
||||||
|
|
||||||
|
##### BTCPayServer
|
||||||
|
|
||||||
|
[BTCPay Server](https://github.com/btcpayserver) is a self-hosted, open-source cryptocurrency payment processor. It's secure, private, censorship-resistant and free.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Find all details on how to use the BTCPay Server on your RaspiBlitz in this great tutorial: https://coincharge.io/en/btcpay-server-on-the-raspiblitz/
|
||||||
|
|
||||||
|
After install, you will see a new `BTCPAY` option in the SSH main menu - it will give you all the information you need to start using it.
|
||||||
|
|
||||||
|
##### BTC-RPC-Explorer
|
||||||
|
|
||||||
|
BTC-RPC-Explorer is a blockchain explorer website you can run on your own RaspiBlitz. See an example running on: https://btc-explorer.com
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
[Details on Service](https://github.com/janoside/btc-rpc-explorer)
|
||||||
|
|
||||||
|
After install, you will see a new `EXPLORE` option in the SSH main menu - it will give you all the information you need to start using it.
|
||||||
|
|
||||||
|
##### Specter Desktop
|
||||||
|
|
||||||
|
Bitcoin Core has a very powerful command line interface and a wonderful daemon. Using pre-signed bitcoin transactions (PSBT) and [Hardware Wallet Interface](https://github.com/bitcoin-core/HWI) (HWI), it can also work with hardware wallets. At the moment it is very Linux-focused. The same applies to multi-signature setups.
|
||||||
|
|
||||||
|
The goal of Specter Desktop is to make a convenient and user-friendly GUI around Bitcoin Core, focusing on multi-signature setups with airgapped hardware wallets like Trezor, Ledger, COLDCARD or the Specter-DIY.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
After install, you will see a new `SPECTER` option in the SSH main menu - it will give you all the information you need to start using it.
|
||||||
|
|
||||||
|
##### Mempool Space
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Mempool Space is the fully featured visualizer, explorer, and API service running on mempool.space
|
||||||
|
|
||||||
|
[Details on Service](https://github.com/mempool/mempool)
|
||||||
|
|
||||||
|
After install, you will see a new `MEMPOOL` option in the SSH main menu - it will give you all the information you need to start using it.
|
||||||
|
|
||||||
|
##### JoinMarket
|
||||||
|
|
||||||
|
JoinMarket is software to create a special kind of bitcoin transaction called a CoinJoin transaction. Its aim is to improve the confidentiality and privacy of bitcoin transactions.
|
||||||
|
|
||||||
|
<a href="https://www.youtube.com/watch?v=uGHRjilMhwY" target="_blank"><img src="pictures/video-joinmarket.png" alt="Video Tutorial" width="400"></a><br>--watch--> https://www.youtube.com/watch?v=uGHRjilMhwY
|
||||||
|
|
||||||
|
A CoinJoin transaction requires other people to take part. The right resources (coins) have to be in the right place, at the right time, in the right quantity. This isn't a software or tech problem, it's an economic problem. JoinMarket works by creating a new kind of market that would allocate these resources in the best way.
|
||||||
|
|
||||||
|
For more details see [here](https://github.com/JoinMarket-Org/joinmarket-clientserver).
|
||||||
|
|
||||||
|
After install, you will see a new `JMARKET` option in the SSH main menu - it will give you all the information you need to start using it.
|
||||||
|
|
||||||
|
##### Download Bitcoin Whitepaper
|
||||||
|
|
||||||
|
Extract the original Bitcoin Whitepaper as PDF directly from the blockchain of your node.
|
||||||
|
|
||||||
##### RTL Webinterface
|
##### RTL Webinterface
|
||||||
|
|
||||||
The RTL Webinterface is an LND Control Dashboard you can run in your browser with a nice GUI - it offers much more control over your Lightning node than the RaspiBlitz SSH menus. It's recommended to give it a try.
|
The RTL Webinterface is available as an LND & c-lightning Control Dashboard you can run in your browser with a nice GUI - it offers much more control over your Lightning node than the RaspiBlitz SSH menus. It's recommended to give it a try.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
@ -624,7 +670,7 @@ After install, you will see a new `RTL` option in the SSH main menu - it will gi
|
||||||
|
|
||||||
##### ThunderHub
|
##### ThunderHub
|
||||||
|
|
||||||
A Lightning Node Manager WebUI - similar to RTL.
|
A Lightning Node Manager WebUI - similar to RTL, but just available for LND.
|
||||||
|
|
||||||
[Details on Service](https://www.thunderhub.io)
|
[Details on Service](https://www.thunderhub.io)
|
||||||
|
|
||||||
|
@ -632,7 +678,7 @@ After install, you will see a new `THUB` option in the SSH main menu - it will g
|
||||||
|
|
||||||
##### Lightning Terminal (LIT) with loop, pool & faraday
|
##### Lightning Terminal (LIT) with loop, pool & faraday
|
||||||
|
|
||||||
Lightning Terminal (LiT) is a browser-based interface for managing channel liquidity. It bundles the former single tools called loop, pool & faraday with an easy to use browser interface.
|
Lightning Terminal (LiT) is a browser-based interface for managing channel liquidity on LND. It bundles the former single tools called loop, pool & faraday with an easy to use browser interface.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
@ -640,16 +686,6 @@ Lightning Terminal (LiT) is a browser-based interface for managing channel liqui
|
||||||
|
|
||||||
After install, you will see a new `LIT` option in the SSH main menu - it will give you all the information you need to start using it.
|
After install, you will see a new `LIT` option in the SSH main menu - it will give you all the information you need to start using it.
|
||||||
|
|
||||||
##### BTCPayServer
|
|
||||||
|
|
||||||
[BTCPay Server](https://github.com/btcpayserver) is a self-hosted, open-source cryptocurrency payment processor. It's secure, private, censorship-resistant and free.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
Find all details on how to use the BTCPay Server on your RaspiBlitz in this great tutorial: https://coincharge.io/en/btcpay-server-on-the-raspiblitz/
|
|
||||||
|
|
||||||
After install, you will see a new `BTCPAY` option in the SSH main menu - it will give you all the information you need to start using it.
|
|
||||||
|
|
||||||
##### LNbits
|
##### LNbits
|
||||||
|
|
||||||
LNbits is a very simple server that sits on top of your Lightning Wallet.
|
LNbits is a very simple server that sits on top of your Lightning Wallet.
|
||||||
|
@ -668,50 +704,6 @@ You can also develop your own extensions on it.
|
||||||
|
|
||||||
After install, you will see a new `LNBITS` option in the SSH main menu - it will give you all the information you need to start using it.
|
After install, you will see a new `LNBITS` option in the SSH main menu - it will give you all the information you need to start using it.
|
||||||
|
|
||||||
##### BTC-RPC-Explorer
|
|
||||||
|
|
||||||
BTC-RPC-Explorer is a blockchain explorer website you can run on your own RaspiBlitz. See an example running on: https://btc-explorer.com
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
[Details on Service](https://github.com/janoside/btc-rpc-explorer)
|
|
||||||
|
|
||||||
After install, you will see a new `EXPLORE` option in the SSH main menu - it will give you all the information you need to start using it.
|
|
||||||
|
|
||||||
##### Cryptoadvance Specter
|
|
||||||
|
|
||||||
Bitcoin Core has a very powerful command line interface and a wonderful daemon. Using pre-signed bitcoin transactions (PSBT) and [Hardware Wallet Interface](https://github.com/bitcoin-core/HWI) (HWI), it can also work with hardware wallets. At the moment it is very Linux-focused. The same applies to multi-signature setups.
|
|
||||||
|
|
||||||
The goal of SpecterDesktop is to make a convenient and user-friendly GUI around Bitcoin Core, focusing on multi-signature setups with airgapped hardware wallets like Trezor, Ledger, COLDCARD or the Specter-DIY.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
After install, you will see a new `SPECTER` option in the SSH main menu - it will give you all the information you need to start using it.
|
|
||||||
|
|
||||||
As an alternative to runninf Specter on directly on the RaspiBlitz, there is a Specter Desktop version that runs on your laptop. Here is a [guide to connect the specter laptop app] (https://d11n.net/connect-specter-desktor-with-raspiblitz.html) to your RaspiBlitz Bitcoin fullnode.
|
|
||||||
|
|
||||||
##### Mempool Explorer
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
Mempool is the fully featured visualizer, explorer, and API service running on mempool.space
|
|
||||||
|
|
||||||
[Details on Service](https://github.com/mempool/mempool)
|
|
||||||
|
|
||||||
After install, you will see a new `MEMPOOL` option in the SSH main menu - it will give you all the information you need to start using it.
|
|
||||||
|
|
||||||
##### JoinMarket
|
|
||||||
|
|
||||||
JoinMarket is software to create a special kind of bitcoin transaction called a CoinJoin transaction. Its aim is to improve the confidentiality and privacy of bitcoin transactions.
|
|
||||||
|
|
||||||
<a href="https://www.youtube.com/watch?v=uGHRjilMhwY" target="_blank"><img src="pictures/video-joinmarket.png" alt="Video Tutorial" width="400"></a><br>--watch--> https://www.youtube.com/watch?v=uGHRjilMhwY
|
|
||||||
|
|
||||||
A CoinJoin transaction requires other people to take part. The right resources (coins) have to be in the right place, at the right time, in the right quantity. This isn't a software or tech problem, it's an economic problem. JoinMarket works by creating a new kind of market that would allocate these resources in the best way.
|
|
||||||
|
|
||||||
For more details see [here](https://github.com/JoinMarket-Org/joinmarket-clientserver).
|
|
||||||
|
|
||||||
After install, you will see a new `JMARKET` option in the SSH main menu - it will give you all the information you need to start using it.
|
|
||||||
|
|
||||||
##### Balance of Satoshi
|
##### Balance of Satoshi
|
||||||
|
|
||||||
Balance of Satoshi gives you enhanced commands for working with LND balances.
|
Balance of Satoshi gives you enhanced commands for working with LND balances.
|
||||||
|
@ -720,32 +712,48 @@ Balance of Satoshi gives you enhanced commands for working with LND balances.
|
||||||
|
|
||||||
After install, you will see a new `BOS` option in the SSH main menu - it will give you all the information you need to start using it.
|
After install, you will see a new `BOS` option in the SSH main menu - it will give you all the information you need to start using it.
|
||||||
|
|
||||||
|
##### PyBlock
|
||||||
|
|
||||||
|
Dashboard Bitcoin information program (needs LND).
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
https://github.com/curly60e/pyblock/blob/master/README.md
|
||||||
|
|
||||||
|
##### Channel Tools (chantools)
|
||||||
|
|
||||||
|
This tool provides helper functions that can be used to rescue funds locked in LND channels in case lnd itself cannot run properly anymore. Also some other usefull command line features.
|
||||||
|
|
||||||
|
https://github.com/guggero/chantools
|
||||||
|
|
||||||
##### Sphinx Relay Server
|
##### Sphinx Relay Server
|
||||||
|
|
||||||
The Sphinx App allows chat over the Lightning Network and ties into the idea of [Podcasting 2.0](https://u.today/father-of-podcasting-integrates-bitcoin-lightning-into-his-app). To use the mobile app with your own RaspiBlitz you need to install the [Sphinx Relay Server](https://github.com/stakwork/sphinx-relay/blob/master/README.md).
|
The Sphinx App allows chat over the Lightning Network with LND and ties into the idea of [Podcasting 2.0](https://u.today/father-of-podcasting-integrates-bitcoin-lightning-into-his-app). To use the mobile app with your own RaspiBlitz you need to install the [Sphinx Relay Server](https://github.com/stakwork/sphinx-relay/blob/master/README.md).
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
After install, you will see a new `SPHINX` option in the SSH main menu - it will give you all the information you need to start using it.
|
After install, you will see a new `SPHINX` option in the SSH main menu - it will give you all the information you need to start using it.
|
||||||
|
|
||||||
##### PyBlock
|
##### C-Lightning RTL Webinterface
|
||||||
|
|
||||||

|
The same RTL as above but running with c-lightning node. Can run parrallel to the LND version. See deatils above.
|
||||||
|
|
||||||
https://github.com/curly60e/pyblock/blob/master/README.md
|
##### C-Lightning Sparko Webwallet
|
||||||
|
|
||||||
##### Channel Tools (chantools)
|
WalletUI & HTTP-RPC bridge for c-lightning
|
||||||
|
|
||||||
This tool provides helper functions that can be used to rescue funds locked in lnd channels in case lnd itself cannot run properly anymore.
|
https://github.com/fiatjaf/sparko#the-sparko-plugin
|
||||||
|
|
||||||
https://github.com/curly60e/pyblock/blob/master/README.md
|
##### C-Lightning Spark Webwallet
|
||||||
|
|
||||||
##### Download Bitcoin Whitepaper
|
WalletUI for c-lightning with BOLT12 offers
|
||||||
|
|
||||||
Extract the original Bitcoin Whitepaper as PDF directly from the blockchain of your node.
|
https://github.com/shesek/spark-wallet#progressive-web-app
|
||||||
|
|
||||||
#### SYSTEM: Monitoring & Configuration
|
#### SYSTEM: Monitoring & Configuration
|
||||||
|
|
||||||
|
Different options to monitor & edit system services.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
#### CONNECT: Connect Apps & Credentials
|
#### CONNECT: Connect Apps & Credentials
|
||||||
|
@ -756,15 +764,21 @@ This feature should support connecting your RaspiBlitz to a mobile wallets or ot
|
||||||
|
|
||||||
##### MOBILE: Mobile Wallet Apps (Smartphone)
|
##### MOBILE: Mobile Wallet Apps (Smartphone)
|
||||||
|
|
||||||
At the moment, the following mobile wallets are supported:
|

|
||||||
|
|
||||||
* [Zeus (iOS/Android)](https://github.com/ZeusLN/zeus)
|
At the moment, the following mobile wallets are supported - some are just available if LND or c-lightning is activated:
|
||||||
|
|
||||||
|
* [Zeus (iOS/Android)](https://github.com/ZeusLN/zeus) (LND & c-lightning)
|
||||||
* [Fully Noded (iOS over Tor)](https://apps.apple.com/us/app/fully-noded/id1436425586)
|
* [Fully Noded (iOS over Tor)](https://apps.apple.com/us/app/fully-noded/id1436425586)
|
||||||
* [SendMany (Android)](https://github.com/fusion44/sendmany/blob/master/README.md)
|
* [SendMany (Android)](https://github.com/fusion44/sendmany/blob/master/README.md) (only LND)
|
||||||
* [Sphinx Chat App (iOS/Android)](https://sphinx.chat/)
|
* [Sphinx Chat App (iOS/Android)](https://sphinx.chat/) (only LND)
|
||||||
|
|
||||||
Mobile wallets work as a remote control app for your RaspiBlitz. First you need to install the apps on your phone - a QR code with the links to the app stores are displayed. Then you need to `pair` them with your RaspiBlitz - also via a QR code displayed on the LCD. If you run your RaspiBlitz without an LCD, there is the fallback option to display that QR code on the terminal as ASCII code (which might involve lowering your terminal's font size).
|
Mobile wallets work as a remote control app for your RaspiBlitz. First you need to install the apps on your phone - a QR code with the links to the app stores are displayed. Then you need to `pair` them with your RaspiBlitz - also via a QR code displayed on the LCD. If you run your RaspiBlitz without an LCD, there is the fallback option to display that QR code on the terminal as ASCII code (which might involve lowering your terminal's font size).
|
||||||
|
|
||||||
|
##### Electrum Rust Server
|
||||||
|
|
||||||
|
Information how to connect to Electrum Rust Server (if installed).
|
||||||
|
|
||||||
##### BTCPAY: Get the connection string for the BTCPay Server
|
##### BTCPAY: Get the connection string for the BTCPay Server
|
||||||
|
|
||||||
To connect the payment processing BTCPay server to your Lightning node you find here the needed Connection string.
|
To connect the payment processing BTCPay server to your Lightning node you find here the needed Connection string.
|
||||||
|
@ -801,7 +815,7 @@ Opens an ad-hoc webserver so that you can download the files in your local netwo
|
||||||
|
|
||||||
*This is the least secure way to transfer those files - everybody in your local network has access to those file during download. Remember with the Admin-Macaroon somebody could take over your node and spend all your funds. Just use as last fallback.*
|
*This is the least secure way to transfer those files - everybody in your local network has access to those file during download. Remember with the Admin-Macaroon somebody could take over your node and spend all your funds. Just use as last fallback.*
|
||||||
|
|
||||||
###### Hex-String
|
####### Hex-String
|
||||||
|
|
||||||
The Macaroons and TLS.cert files can be copy+pasted as Hex-Strings from RaspiBlitz to any other app that supports that format. If you choose this option, RaspiBlitz will print all the files for you as Hex-String to do so.
|
The Macaroons and TLS.cert files can be copy+pasted as Hex-Strings from RaspiBlitz to any other app that supports that format. If you choose this option, RaspiBlitz will print all the files for you as Hex-String to do so.
|
||||||
|
|
||||||
|
@ -838,7 +852,7 @@ If you want a Webservice like BTCPay Server or LNbits available to the outside i
|
||||||
|
|
||||||
Because you also need a domain name for that you will need to open a free account, the following are presently supported, would be good to add more with the help of the community:
|
Because you also need a domain name for that you will need to open a free account, the following are presently supported, would be good to add more with the help of the community:
|
||||||
[DuckDNS.org](https://www.duckdns.org)
|
[DuckDNS.org](https://www.duckdns.org)
|
||||||
[DYNU.com](https://www.dynu.com)
|
[DYNU.com](https://www.dynu.com) (AT THE MOMENT NOT AVAILABLE)
|
||||||
|
|
||||||
When you create a new LetsEncrypt subscription, you will be asked for your subdomain on DuckDNS and the Auth-Token of your DuckDNS account. Then RaspiBlitz tries to setup everything for you. If everything worked, you will find the subscription under `MAINMENU` > `SUBSCRIBE` > `LIST My Subscriptions`, where you can cancel it at any time if you wish.
|
When you create a new LetsEncrypt subscription, you will be asked for your subdomain on DuckDNS and the Auth-Token of your DuckDNS account. Then RaspiBlitz tries to setup everything for you. If everything worked, you will find the subscription under `MAINMENU` > `SUBSCRIBE` > `LIST My Subscriptions`, where you can cancel it at any time if you wish.
|
||||||
|
|
||||||
|
@ -870,6 +884,19 @@ This stops your RaspiBlitz and creates an LND-Rescue ZIP file that you can downl
|
||||||
|
|
||||||
*NOTICE: If you start your RaspiBlitz after this backup again the backup is outdated and using it can risk losing your channel funds.*
|
*NOTICE: If you start your RaspiBlitz after this backup again the backup is outdated and using it can risk losing your channel funds.*
|
||||||
|
|
||||||
|
##### RESET-LND: Delete LND & start a node/wallet
|
||||||
|
|
||||||
|
*THIS WILL DELETE ALL YOUR LND DATA AND CHANNEL FUNDS.
|
||||||
|
Use this only if you have closed all channels and removed all funds.*
|
||||||
|
|
||||||
|
Use this option if you want to start with a fresh LND node id & wallet.
|
||||||
|
|
||||||
|
##### REPAIR-CL: Repair/Backup C-Lightning
|
||||||
|
|
||||||
|
Multiple options to repair/backup your c-lightning node:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
##### MIGRATION: Migrate Blitz Data to new Hardware
|
##### MIGRATION: Migrate Blitz Data to new Hardware
|
||||||
|
|
||||||
This stops your RaspiBlitz and creates a Migration ZIP file you can download/export per SCP to your laptop. This contains all important data of your RaspiBlitz including LND, your Blitz configuration and also data from your installed apps. Can be used to migrate your RaspiBlitz to a new hardware - for example if you want to replace the HDD with a SSD. How to import a Migration File [see here](README.md#import-a-migration-file).
|
This stops your RaspiBlitz and creates a Migration ZIP file you can download/export per SCP to your laptop. This contains all important data of your RaspiBlitz including LND, your Blitz configuration and also data from your installed apps. Can be used to migrate your RaspiBlitz to a new hardware - for example if you want to replace the HDD with a SSD. How to import a Migration File [see here](README.md#import-a-migration-file).
|
||||||
|
@ -886,13 +913,6 @@ Make sure both RaspiBlitzes are connected to the same local network. During setu
|
||||||
|
|
||||||
Use this option if your blockchain data got corrupted. It will keep your LND data. You can even keep your channels open. Just keep in mind that your Lightning node will appear offline to the network until you have re-downloaded the blockchain.
|
Use this option if your blockchain data got corrupted. It will keep your LND data. You can even keep your channels open. Just keep in mind that your Lightning node will appear offline to the network until you have re-downloaded the blockchain.
|
||||||
|
|
||||||
##### RESET-LND: Delete LND data & start new node/wallet
|
|
||||||
|
|
||||||
*THIS WILL DELETE ALL YOUR LND DATA AND CHANNEL FUNDS.
|
|
||||||
Use this only if you have closed all channels and removed all funds.*
|
|
||||||
|
|
||||||
Use this option if you want to start with a fresh LND node id & wallet.
|
|
||||||
|
|
||||||
##### RESET-HDD: Delete HDD data but keep blockchain
|
##### RESET-HDD: Delete HDD data but keep blockchain
|
||||||
|
|
||||||
*THIS WILL DELETE ALL YOUR LND DATA AND CHANNEL FUNDS.
|
*THIS WILL DELETE ALL YOUR LND DATA AND CHANNEL FUNDS.
|
||||||
|
@ -917,12 +937,12 @@ If you had the Bitcoin Transaction Index activated you can use this option to ma
|
||||||
|
|
||||||
#### UPDATE: Check/Prepare RaspiBlitz Update
|
#### UPDATE: Check/Prepare RaspiBlitz Update
|
||||||
|
|
||||||
The `UPDATE` menu gives you options to update your RaspiBlitz
|
The `UPDATE` menu gives you options to update your RaspiBlitz and some apps you might have installed.
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
The options are explained in detail:
|
The options are explained in detail:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
*Please note that the RaspiBlitz does not support Auto-Update, to ensure that there is no remote control of your node from a central server.*
|
*Please note that the RaspiBlitz does not support Auto-Update, to ensure that there is no remote control of your node from a central server.*
|
||||||
|
|
||||||
##### RELEASE: Update RaspiBlitz to a new Version
|
##### RELEASE: Update RaspiBlitz to a new Version
|
||||||
|
@ -951,37 +971,27 @@ A safe way to restart the RaspiBlitz ... have you tried turning it off and on ag
|
||||||
|
|
||||||
A safe way to shutdown the RaspiBlitz.
|
A safe way to shutdown the RaspiBlitz.
|
||||||
|
|
||||||
#### X: Console Terminal
|
#### EXIT: Console Terminal
|
||||||
|
|
||||||
Closes the SSH main menu and exits to the terminal - where the user can make use of the CLI clients `bitcoin-cli` & `lncli` directly.
|
The `EXIT` option next to `OK` closes the SSH main menu and exits to the terminal - where the user can make use of the CLI clients `bitcoin-cli` & `lncli` directly.
|
||||||
|
|
||||||
With the command `raspiblitz`, it's possible to return to the main menu.
|
With the command `raspiblitz`, it's possible to return to the main menu.
|
||||||
|
|
||||||
## Import a Migration File
|
## Import a Migration File
|
||||||
|
|
||||||
As mentioned above you can export a Migration File from your RaspiBlitz with MAINMENU > REPAIR > MIGRATION and store it on your laptop.
|
As mentioned above you can export a Migration File from your RaspiBlitz with `MAINMENU > REPAIR > MIGRATION` and store it on your laptop.
|
||||||
|
|
||||||
A Migration file contains all the important data from your RaspiBlitz, like your LND data, Bitcoin Wallet, raspiblitz.config, Tor/SSH keys .. and also installed apps. You can use this to migrate your RaspiBlitz to new hardware.
|
A Migration file contains all the important data from your RaspiBlitz, like your LND data, Bitcoin Wallet, raspiblitz.config, Tor/SSH keys .. and also installed apps. You can use this to migrate your RaspiBlitz to new hardware.
|
||||||
|
|
||||||
If you want to import it again to a new RaspiBlitz (for example with an updated HDD/SSD), you can choose the `MIGRATION` option on the first setup dialog after the Hardware test (where you normally choose between Bitcoin & Litecoin).
|
If you want to import it again to a new RaspiBlitz (for example with an updated HDD/SSD), you can choose the `FROMBACKUP` option on the first setup dialog of a fresh sd card image.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
If you start MIGRATION you will need to format your HDD/SSD in the next step.
|
If you start MIGRATION you might get asked to use a existing blockchain on the harddrive/ssd and deleting the rest or even formatting the complete drive. Once thats done you get instructions how to upload the migration file (use the password `raspiblitz` when asked on executing the upload command):
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
Normally you choose here the EXT4 format. But you also have the option to choose the BTRFS format which is an experimental feature under RaspiBlitz - see [FAQ for details on BTRFS](FAQ.md#why-use-btrfs-on-raspiblitz).
|
After this you will be asked to set a new PasswordA and your RaspiBlitz will go into recovery/provision process Then RaspiBlitz might give you the option again to self-sync or copy the blockchain from another computer/blitz and after a final reboot.
|
||||||
|
|
||||||
Then you will be asked to upload the Migration Zip file to the RaspiBlitz. Follow the instructions shown to you.
|
|
||||||
|
|
||||||
Then you need to get a copy of the blockchain data again for your RaspiBlitz.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
You have the two options: [SYNC](README.md#1-sync---selfvalidate-all-blocks) and [COPY](README.md#2-copy---copy-from-laptop-or-another-raspiblitz-over-local-network), as mentioned in the normal setup.
|
|
||||||
|
|
||||||
RaspiBlitz will reboot and start the normal recovery process to install all the services defined by the raspiblitz.config from your Migration File.
|
|
||||||
|
|
||||||
Then the blockchain needs to sync up and you should be back to normal.
|
Then the blockchain needs to sync up and you should be back to normal.
|
||||||
|
|
||||||
|
@ -1076,7 +1086,7 @@ Go to your web browser, do the following:
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
Now go back to the 'Settings' tab and under 'OAuth2' click the 'Generate' button. You will now see a long string of letters and numbers appear. This is your **Dropbox-Authtoken**. Make sure to copy the complete token string .. there might be more if you scroll to the right in the token field.
|
Now go back to the 'Settings' tab and under 'OAuth2', choose 'no expiration' under 'Access token expiration' then click the 'Generate' button. You will now see a long string of letters and numbers appear. This is your **Dropbox-Authtoken**. Make sure to copy the complete token string .. there might be more if you scroll to the right in the token field.
|
||||||
|
|
||||||
To test it, try opening or closing a channel, and then check if you can find a copy of `channel.backup` in your Dropbox. You can check the background-script logs to see details on errors: `sudo journalctl -f -u background`
|
To test it, try opening or closing a channel, and then check if you can find a copy of `channel.backup` in your Dropbox. You can check the background-script logs to see details on errors: `sudo journalctl -f -u background`
|
||||||
|
|
||||||
|
@ -1137,7 +1147,7 @@ Now you are ready to start the SD card build script (check the code to see if th
|
||||||
|
|
||||||
As you can see from the URL, you can find the build script in this Git repo under `build_sdcard.sh`. You can check what gets installed and configured in detail. Feel free to post improvements as pull requests.
|
As you can see from the URL, you can find the build script in this Git repo under `build_sdcard.sh`. You can check what gets installed and configured in detail. Feel free to post improvements as pull requests.
|
||||||
|
|
||||||
The whole build process takes a while. At the end the LCD drivers get installed and a reboot is needed. A user `admin` is created during the process. Remember the default password is now `raspiblitz`. You can login per SSH again - this time use admin: `ssh admin@[IP-OF-YOUR-RASPI]`. The install dialog of the RaspiBlitz should automatically start. If you do not want to continue with the installation at this moment and use this sd card as a template for setting up multiple RaspiBlitzes, click `Cancel` and run `/home/admin/XXprepareRelease.sh`. Once you see the LCD going white and the activity LED of the pi starts going dark, you can unplug power and remove the SD card. You have now built your own RaspiBlitz SD card image.
|
The whole build process takes a while. At the end the LCD drivers get installed and a reboot is needed. A user `admin` is created during the process. Remember the default password is now `raspiblitz`. You can login per SSH again - this time use admin: `ssh admin@[IP-OF-YOUR-RASPI]`. The install dialog of the RaspiBlitz schould automatically start. If you do not want to continue with the installation at this moment and use this sd card as a template for setting up multiple RaspiBlitzes, click `Cancel` and run `release`. Once you see the LCD going white and the activity LED of the pi starts going dark, you can unplug power and remove the SD card. You have now built your own RaspiBlitz SD card image.
|
||||||
|
|
||||||
*Note: If you plan to use your self-build sd card as a MASTER copy and distribute it: Use a smaller 8GB card for that. This way it's ensured that it will fit on every 16 GB card recommended for RaspiBlitz later on.*
|
*Note: If you plan to use your self-build sd card as a MASTER copy and distribute it: Use a smaller 8GB card for that. This way it's ensured that it will fit on every 16 GB card recommended for RaspiBlitz later on.*
|
||||||
|
|
||||||
|
@ -1170,4 +1180,4 @@ Also get inspired for a deep-dive with the original "[RaspiBolt](https://stadicu
|
||||||
|
|
||||||
Join me on twitter [@rootzoll](https://twitter.com/rootzoll), visit us at an upcoming [#lightninghackday](https://twitter.com/hashtag/LightningHackday?src=hash) or check by one of our bitcoin meetups in Berlin ... every 1st Thursday evening a month at the room77 bar - feel free to buy me a beer with lightning there :)
|
Join me on twitter [@rootzoll](https://twitter.com/rootzoll), visit us at an upcoming [#lightninghackday](https://twitter.com/hashtag/LightningHackday?src=hash) or check by one of our bitcoin meetups in Berlin ... every 1st Thursday evening a month at the room77 bar - feel free to buy me a beer with lightning there :)
|
||||||
|
|
||||||
* [How can I get further help/support?](#support)
|
* [How can I get further help/support?](#support)
|
|
@ -49,6 +49,7 @@ Ensure that you put quotes around fingerprints containing spaces if importing wi
|
||||||
# Physical Security
|
# Physical Security
|
||||||
|
|
||||||
* The lightning wallet and user interfaces are password protected by default so this has more privacy implications (in the case of physical theft) than security.
|
* The lightning wallet and user interfaces are password protected by default so this has more privacy implications (in the case of physical theft) than security.
|
||||||
|
* Basic hardening measures are applied to all non-root systemd services
|
||||||
* Optional log in through SSH using a hardware wallet.
|
* Optional log in through SSH using a hardware wallet.
|
||||||
* LUKS encryption would be welcome in the future.
|
* LUKS encryption would be welcome in the future.
|
||||||
|
|
||||||
|
|
|
@ -4,11 +4,11 @@ echo "************* Vagrant Provisioning ********************"
|
||||||
|
|
||||||
echo 'Syncing local code with RaspiBlitzVM'
|
echo 'Syncing local code with RaspiBlitzVM'
|
||||||
|
|
||||||
# make sure the latest sync script is in place
|
# make sure the lastest sync script is in place
|
||||||
cp /vagrant/home.admin/XXsyncScripts.sh /home/admin/XXsyncScripts.sh
|
cp /vagrant/home.admin/config.scripts/blitz.github.sh /home/admin/config.scripts/blitz.github.sh
|
||||||
|
|
||||||
# execute 'patch' command to sync laptop with VM
|
# execute 'patch' command to sync laptop with VM
|
||||||
/home/admin/XXsyncScripts.sh -run
|
/home/admin/config.scripts/blitz.github.sh -run
|
||||||
|
|
||||||
source <(/home/admin/config.scripts/internet.sh status)
|
source <(/home/admin/config.scripts/internet.sh status)
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
|
|
||||||
# ⚡️ RaspiBlitz-on-DietPi ⚡️
|
# ⚡️ RaspiBlitz-on-DietPi ⚡️
|
||||||
# For the Odroid HC1 / HC2 / XU3 / XU4
|
# For the Odroid HC1 / HC2 / XU3 / XU4 / MC1
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## There are 3 options provided:
|
## There are 3 options provided:
|
||||||
* a trusted fully prebuilt SDcard image
|
* a trusted fully prebuilt SDcard image
|
||||||
* Automated building process.
|
* Automated building process.
|
||||||
* Build your own SDcard from the image downloaded from [Dietpi.com](dietpi.com#download)
|
* Build your own SDcard from the image downloaded from [dietpi.com](https://dietpi.com/#download)
|
||||||
---
|
---
|
||||||
### Download the fully prebuilt RaspiBlitz-on-DietPi SDcard image
|
### Download the fully prebuilt RaspiBlitz-on-DietPi SDcard image
|
||||||
|
|
||||||
|
@ -30,15 +30,15 @@ The setup continues with the [RaspiBlitz Setup Process](https://github.com/rootz
|
||||||
---
|
---
|
||||||
### The automated building process:
|
### The automated building process:
|
||||||
|
|
||||||
1) Download the DietPi image for the Odroid HC1 / HC2 / XU3 / XU4:
|
1) Download the DietPi image for the Odroid HC1 / HC2 / XU3 / XU4 / MC1:
|
||||||
https://dietpi.com/downloads/images/DietPi_OdroidXU4-ARMv7-Stretch.7z
|
https://dietpi.com/downloads/images/DietPi_OdroidXU4-ARMv7-Buster.7z
|
||||||
2) Burn it to the SD card with [Etcher](https://www.balena.io/etcher/)
|
2) Burn it to the SD card with [Etcher](https://www.balena.io/etcher/)
|
||||||
|
|
||||||
3) Right click and download the following two files: [DietPi.txt](https://raw.githubusercontent.com/rootzoll/raspiblitz/master/alternative.platforms/dietpi/boot/dietpi.txt), [Automation_Custom_Script.sh](https://raw.githubusercontent.com/rootzoll/raspiblitz/dev/alternative.platforms/dietpi/boot/Automation_Custom_Script.sh)
|
3) Right click and download the following two files: [dietpi.txt](https://raw.githubusercontent.com/rootzoll/raspiblitz/master/alternative.platforms/dietpi/boot/dietpi.txt), [Automation_Custom_Script.sh](https://raw.githubusercontent.com/rootzoll/raspiblitz/dev/alternative.platforms/dietpi/boot/Automation_Custom_Script.sh)
|
||||||
|
|
||||||
4) Copy them to the /boot directory of the DietPi SDcard
|
4) Copy them to the /boot directory of the DietPi SDcard
|
||||||
|
|
||||||
[DietPi.txt](https://raw.githubusercontent.com/rootzoll/raspiblitz/master/alternative.platforms/dietpi/boot/dietpi.txt): Overwrites the default dietpi.txt. Modified the settings to automate the DietPi setup. (see the details [here](https://github.com/rootzoll/raspiblitz/tree/dev/alternative.platforms/dietpi#excerpts-from-the-customized-dietpitxt))
|
[dietpi.txt](https://raw.githubusercontent.com/rootzoll/raspiblitz/master/alternative.platforms/dietpi/boot/dietpi.txt): Overwrites the default dietpi.txt. Modified the settings to automate the DietPi setup. (see the details [here](https://github.com/rootzoll/raspiblitz/tree/dev/alternative.platforms/dietpi#excerpts-from-the-customized-dietpitxt))
|
||||||
|
|
||||||
[Automation_Custom_Script.sh](https://raw.githubusercontent.com/rootzoll/raspiblitz/dev/alternative.platforms/dietpi/boot/Automation_Custom_Script.sh): Runs after DietPi installation is completed. Contains the link to download and run the build_sdcard.sh from the dev branch of @rootzoll.
|
[Automation_Custom_Script.sh](https://raw.githubusercontent.com/rootzoll/raspiblitz/dev/alternative.platforms/dietpi/boot/Automation_Custom_Script.sh): Runs after DietPi installation is completed. Contains the link to download and run the build_sdcard.sh from the dev branch of @rootzoll.
|
||||||
(Optionally open the file with a text editor and uncomment (remove the `#` from the front of) the line with the branch you want to build the SDcard from.)
|
(Optionally open the file with a text editor and uncomment (remove the `#` from the front of) the line with the branch you want to build the SDcard from.)
|
||||||
|
@ -53,14 +53,6 @@ https://dietpi.com/downloads/images/DietPi_OdroidXU4-ARMv7-Stretch.7z
|
||||||
`tail -n1000 -f /tmp/DietPi-Update/dietpi-update.log` - follow the dietpi-update process
|
`tail -n1000 -f /tmp/DietPi-Update/dietpi-update.log` - follow the dietpi-update process
|
||||||
`tail -n1000 -f /var/tmp/dietpi/logs/dietpi-automation_custom_script.log` follow the output of the build_sdcard.sh
|
`tail -n1000 -f /var/tmp/dietpi/logs/dietpi-automation_custom_script.log` follow the output of the build_sdcard.sh
|
||||||
|
|
||||||
Starting from a v6.14 DietPi image is causing a bootloop after the first restart. See the issue: https://github.com/MichaIng/DietPi/issues/2495. This will be sorted out once a new image version is uploaded for the Odroids to dietpi.com.
|
|
||||||
To get past it:
|
|
||||||
* Log in with root after the first restart (when the loop is ongoing - without any output to the HDMI screen)
|
|
||||||
* CTRL+C, run `dietpi-update` and update
|
|
||||||
* `reboot` once finished
|
|
||||||
* from then the Automation_Custom_Script.sh is carrying on
|
|
||||||
|
|
||||||
|
|
||||||
6) When the setup is finished log in as `admin`:
|
6) When the setup is finished log in as `admin`:
|
||||||
`ssh admin@[IP-OF-RASPIBLITZ]`
|
`ssh admin@[IP-OF-RASPIBLITZ]`
|
||||||
password: `raspiblitz`
|
password: `raspiblitz`
|
||||||
|
@ -71,12 +63,8 @@ password: `raspiblitz`
|
||||||
|
|
||||||
### Build your own DietPi image:
|
### Build your own DietPi image:
|
||||||
|
|
||||||
Watch out this is an arduous process.
|
* For the Odroid HC1 / HC2 / XU3 / XU4 / MC1 the start is this image:
|
||||||
Updating from a v6.14 DietPi image is causing a bootloop after the first restart. See the issue: https://github.com/MichaIng/DietPi/issues/2495.
|
https://dietpi.com/downloads/images/DietPi_OdroidXU4-ARMv7-Buster.7z
|
||||||
This will be sorted out once a new image version is uploaded for the Odroids to dietpi.com
|
|
||||||
|
|
||||||
* For the Odroid HC1 / HC2 / XU3 / XU4 the start is this image:
|
|
||||||
https://dietpi.com/downloads/images/DietPi_OdroidXU4-ARMv7-Stretch.7z
|
|
||||||
* Burn it to the SD with [Etcher](https://www.balena.io/etcher/)
|
* Burn it to the SD with [Etcher](https://www.balena.io/etcher/)
|
||||||
|
|
||||||
* Insert the SD card, connect the HDD, the network cable and power supply to boot up the Odroid:
|
* Insert the SD card, connect the HDD, the network cable and power supply to boot up the Odroid:
|
||||||
|
@ -84,50 +72,19 @@ https://dietpi.com/downloads/images/DietPi_OdroidXU4-ARMv7-Stretch.7z
|
||||||
* In the desktop terminal on Linux / MacOS or Putty on Windows:
|
* In the desktop terminal on Linux / MacOS or Putty on Windows:
|
||||||
`ssh root@[IP-OF-DIETPI]`
|
`ssh root@[IP-OF-DIETPI]`
|
||||||
password: `dietpi`
|
password: `dietpi`
|
||||||
Getting started with DietPi: https://dietpi.com/phpbb/viewtopic.php?f=8&t=9#p9
|
Getting started with DietPi: https://dietpi.com/docs/install/#4-first-logon-on-dietpi
|
||||||
|
|
||||||
* Ok > Cancel > Cancel
|
|
||||||
automatic apt update & apt upgrade and asks to reboot
|
|
||||||

|
|
||||||
|
|
||||||
* Log back in:
|
|
||||||
`ssh root@[IP-OF-DIETPI]`
|
|
||||||
password: `dietpi`
|
|
||||||
* after the update the ssh keys might change:
|
|
||||||
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
|
|
||||||
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
||||||
run (can be copied from the terminal output):
|
|
||||||
`ssh-keygen -f "/home/[your-linux-username]/.ssh/known_hosts" -R "dietpi.IP"`
|
|
||||||
`ssh root@[IP-OF-DIETPI]`
|
|
||||||
yes >
|
|
||||||
password: `dietpi`
|
|
||||||
|
|
||||||
* At this point if the DietPi OS was not updated from 6.14 it does not manage to save settings going forward.
|
|
||||||
Exit the software installer (press Tab to jump to Exit)
|
|
||||||

|
|
||||||
|
|
||||||
* in the bash prompt run:
|
|
||||||
`dietpi-update`
|
|
||||||
Ok > Cancel the recovery point
|
|
||||||
update > Opt out of survey > Ok
|
|
||||||
Reboots
|
|
||||||
|
|
||||||
* Log back in:
|
|
||||||
`ssh root@[IP-OF-DIETPI]`
|
|
||||||
password: `dietpi`
|
|
||||||
* In the DietPi software menu install fail2ban and make OpenSSH server the default SSH server.
|
* In the DietPi software menu install fail2ban and make OpenSSH server the default SSH server.
|
||||||
Ok > Cancel > Cancel
|
Ok > Cancel > Cancel
|
||||||
Search `fail2ban` > Space to select > Enter
|
Search `fail2ban` > Space to select > Enter
|
||||||
SSH server > switch from Dropbear to the OpenSSH-server
|
SSH server > switch from Dropbear to the OpenSSH-server
|
||||||
Install > Ok
|
Install > Ok
|
||||||
Opt out of survey > Ok
|
|
||||||
Reboots again
|
Reboots again
|
||||||
|
|
||||||
* Log back in:
|
* Log back in:
|
||||||
`ssh root@[IP-OF-DIETPI]`
|
`ssh root@[IP-OF-DIETPI]`
|
||||||
password: `dietpi`
|
password: `dietpi`
|
||||||
Changing the SSH server will change the SSH keys again. To clear:
|
Changing the SSH server will change the SSH keys. To clear:
|
||||||
`ssh-keygen -f "/home/[your-linux-username]/.ssh/known_hosts" -R "dietpi.IP"`
|
`ssh-keygen -f "/home/[your-linux-username]/.ssh/known_hosts" -R "dietpi.IP"`
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,7 @@ During the RaspiBlitz setup process:
|
||||||
`sudo tail -n100 /mnt/hdd/bitcoin/debug.log` - shows the last 100 lines
|
`sudo tail -n100 /mnt/hdd/bitcoin/debug.log` - shows the last 100 lines
|
||||||
`sudo systemctl status lnd` - status of the lnd service
|
`sudo systemctl status lnd` - status of the lnd service
|
||||||
`sudo journalctl -f -u lnd`
|
`sudo journalctl -f -u lnd`
|
||||||
`./home/admin/XXdebugLogs.sh` - debug log collection on the RaspiBlitz
|
`debug` - debug log collection on the RaspiBlitz
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
251
build_sdcard.sh
251
build_sdcard.sh
|
@ -8,15 +8,17 @@
|
||||||
# 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:
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
||||||
|
defaultBranchVersion="v1.7"
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "*****************************************"
|
echo "*****************************************"
|
||||||
echo "* RASPIBLITZ SD CARD IMAGE SETUP v1.7 *"
|
echo "* RASPIBLITZ SD CARD IMAGE SETUP ${defaultBranchVersion}.1 *"
|
||||||
echo "*****************************************"
|
echo "*****************************************"
|
||||||
echo "For details on optional parameters - see build script source code:"
|
echo "For details on optional parameters - see build script source code:"
|
||||||
|
|
||||||
# 1st optional parameter: NO-INTERACTION
|
# 1st optional parameter: NO-INTERACTION
|
||||||
# ----------------------------------------
|
# ----------------------------------------
|
||||||
# When 'true' then no questions will be ask on building .. so it can be used in build scripts
|
# When 'true' then no questions will be asked on building .. so it can be used in build scripts
|
||||||
# for containers or as part of other build scripts (default is false)
|
# for containers or as part of other build scripts (default is false)
|
||||||
|
|
||||||
noInteraction="$1"
|
noInteraction="$1"
|
||||||
|
@ -64,20 +66,23 @@ echo "3) will use GITHUB-USERNAME --> '${githubUser}'"
|
||||||
|
|
||||||
# 4th optional parameter: GITHUB-BRANCH
|
# 4th optional parameter: GITHUB-BRANCH
|
||||||
# -------------------------------------
|
# -------------------------------------
|
||||||
# could be any valid branch of the given GITHUB-USERNAME forked raspiblitz repo - 'dev' is default
|
# could be any valid branch of the given GITHUB-USERNAME forked raspiblitz repo - take ${defaultBranchVersion} is default
|
||||||
githubBranch="$4"
|
githubBranch="$4"
|
||||||
if [ ${#githubBranch} -eq 0 ]; then
|
if [ ${#githubBranch} -eq 0 ]; then
|
||||||
githubBranch="dev"
|
githubBranch="${defaultBranchVersion}"
|
||||||
fi
|
fi
|
||||||
echo "4) will use GITHUB-BRANCH --> '${githubBranch}'"
|
echo "4) will use GITHUB-BRANCH --> '${githubBranch}'"
|
||||||
|
|
||||||
# 5th optional parameter: DISPLAY-CLASS
|
# 5th optional parameter: DISPLAY-CLASS
|
||||||
# ----------------------------------------
|
# ----------------------------------------
|
||||||
# Could be 'hdmi', 'headless' or 'lcd'
|
# Could be 'hdmi', 'headless' or 'lcd' (lcd is default)
|
||||||
# On 'false' the standard video output is used (HDMI) by default.
|
# On 'false' the standard video output is used (HDMI) by default.
|
||||||
# https://github.com/rootzoll/raspiblitz/issues/1265#issuecomment-813369284
|
# https://github.com/rootzoll/raspiblitz/issues/1265#issuecomment-813369284
|
||||||
displayClass="$5"
|
displayClass="$5"
|
||||||
if [ ${#displayClass} -eq 0 ] || [ "${displayClass}" == "false" ]; then
|
if [ ${#displayClass} -eq 0 ]; then
|
||||||
|
displayClass="lcd"
|
||||||
|
fi
|
||||||
|
if [ "${displayClass}" == "false" ]; then
|
||||||
displayClass="hdmi"
|
displayClass="hdmi"
|
||||||
fi
|
fi
|
||||||
if [ "${displayClass}" != "hdmi" ] && [ "${displayClass}" != "lcd" ] && [ "${displayClass}" != "headless" ]; then
|
if [ "${displayClass}" != "hdmi" ] && [ "${displayClass}" != "lcd" ] && [ "${displayClass}" != "headless" ]; then
|
||||||
|
@ -221,7 +226,7 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "*** Install & Enable Tor ***"
|
echo "*** Install & Enable Tor ***"
|
||||||
sudo apt update
|
sudo apt update -y
|
||||||
sudo apt install tor tor-arm torsocks -y
|
sudo apt install tor tor-arm torsocks -y
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
|
@ -257,11 +262,14 @@ if [ "${baseimage}" = "raspbian" ] || [ "${baseimage}" = "dietpi" ] || \
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# remove some (big) packages that are not needed
|
echo "*** Remove not needed packages ***"
|
||||||
sudo apt remove -y --purge libreoffice* oracle-java* chromium-browser nuscratch scratch sonic-pi minecraft-pi plymouth python2 vlc
|
sudo apt remove -y --purge libreoffice* oracle-java* chromium-browser nuscratch scratch sonic-pi minecraft-pi plymouth python2 vlc
|
||||||
sudo apt clean
|
sudo apt clean
|
||||||
sudo apt -y autoremove
|
sudo apt -y autoremove
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "*** Python DEFAULT libs & dependencies ***"
|
||||||
|
|
||||||
if [ -f "/usr/bin/python3.7" ]; then
|
if [ -f "/usr/bin/python3.7" ]; then
|
||||||
# make sure /usr/bin/python exists (and calls Python3.7 in Buster)
|
# make sure /usr/bin/python exists (and calls Python3.7 in Buster)
|
||||||
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.7 1
|
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.7 1
|
||||||
|
@ -277,9 +285,19 @@ else
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# update debian
|
# for setup shell scripts
|
||||||
|
sudo apt -y install dialog bc python3-dialog
|
||||||
|
|
||||||
|
# libs (for global python scripts)
|
||||||
|
sudo -H python3 -m pip install --upgrade pip
|
||||||
|
sudo -H python3 -m pip install grpcio==1.38.1
|
||||||
|
sudo -H python3 -m pip install googleapis-common-protos==1.53.0
|
||||||
|
sudo -H python3 -m pip install toml==0.10.1
|
||||||
|
sudo -H python3 -m pip install j2cli==0.3.10
|
||||||
|
sudo -H python3 -m pip install requests[socks]==2.21.0
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "*** UPDATE ***"
|
echo "*** UPDATE Debian***"
|
||||||
sudo apt update -y
|
sudo apt update -y
|
||||||
sudo apt upgrade -f -y
|
sudo apt upgrade -f -y
|
||||||
|
|
||||||
|
@ -299,6 +317,9 @@ fi
|
||||||
# special prepare when Raspbian
|
# special prepare when Raspbian
|
||||||
if [ "${baseimage}" = "raspbian" ]||[ "${baseimage}" = "raspios_arm64" ]||\
|
if [ "${baseimage}" = "raspbian" ]||[ "${baseimage}" = "raspios_arm64" ]||\
|
||||||
[ "${baseimage}" = "debian_rpi64" ]; then
|
[ "${baseimage}" = "debian_rpi64" ]; then
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "*** PREPARE RASPBIAN ***"
|
||||||
sudo apt install -y raspi-config
|
sudo apt install -y raspi-config
|
||||||
# do memory split (16MB)
|
# do memory split (16MB)
|
||||||
sudo raspi-config nonint do_memory_split 16
|
sudo raspi-config nonint do_memory_split 16
|
||||||
|
@ -357,7 +378,7 @@ fi
|
||||||
|
|
||||||
# special prepare when Nvidia Jetson Nano
|
# special prepare when Nvidia Jetson Nano
|
||||||
if [ ${isNvidia} -eq 1 ] ; then
|
if [ ${isNvidia} -eq 1 ] ; then
|
||||||
# disable GUI on boot
|
echo "Nvidia --> disable GUI on boot"
|
||||||
sudo systemctl set-default multi-user.target
|
sudo systemctl set-default multi-user.target
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -553,6 +574,7 @@ sudo chsh admin -s /bin/bash
|
||||||
echo '%sudo ALL=(ALL) NOPASSWD:ALL' | sudo EDITOR='tee -a' visudo
|
echo '%sudo ALL=(ALL) NOPASSWD:ALL' | sudo EDITOR='tee -a' visudo
|
||||||
|
|
||||||
# WRITE BASIC raspiblitz.info to sdcard
|
# WRITE BASIC raspiblitz.info to sdcard
|
||||||
|
# if further info gets added .. make sure to keep that on: blitz.preparerelease.sh
|
||||||
echo "baseimage=${baseimage}" > /home/admin/raspiblitz.info
|
echo "baseimage=${baseimage}" > /home/admin/raspiblitz.info
|
||||||
echo "cpu=${cpu}" >> /home/admin/raspiblitz.info
|
echo "cpu=${cpu}" >> /home/admin/raspiblitz.info
|
||||||
echo "displayClass=headless" >> /home/admin/raspiblitz.info
|
echo "displayClass=headless" >> /home/admin/raspiblitz.info
|
||||||
|
@ -580,20 +602,7 @@ sudo /usr/sbin/groupadd --force --gid 9706 lndwalletkit
|
||||||
sudo /usr/sbin/groupadd --force --gid 9707 lndrouter
|
sudo /usr/sbin/groupadd --force --gid 9707 lndrouter
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "*** Python DEFAULT libs & dependencies ***"
|
echo "*** SHELL SCRIPTS & ASSETS ***"
|
||||||
|
|
||||||
# for setup shell scripts
|
|
||||||
sudo apt -y install dialog bc python3-dialog
|
|
||||||
|
|
||||||
# libs (for global python scripts)
|
|
||||||
sudo -H python3 -m pip install grpcio==1.36.1
|
|
||||||
sudo -H python3 -m pip install googleapis-common-protos==1.53.0
|
|
||||||
sudo -H python3 -m pip install toml==0.10.1
|
|
||||||
sudo -H python3 -m pip install j2cli==0.3.10
|
|
||||||
sudo -H python3 -m pip install requests[socks]==2.21.0
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "*** SHELL SCRIPTS AND ASSETS ***"
|
|
||||||
|
|
||||||
# copy raspiblitz repo from github
|
# copy raspiblitz repo from github
|
||||||
cd /home/admin/
|
cd /home/admin/
|
||||||
|
@ -607,9 +616,10 @@ sudo -u admin chmod +x *.sh
|
||||||
sudo -u admin cp -r /home/admin/raspiblitz/home.admin/assets /home/admin/
|
sudo -u admin cp -r /home/admin/raspiblitz/home.admin/assets /home/admin/
|
||||||
sudo -u admin cp -r /home/admin/raspiblitz/home.admin/config.scripts /home/admin/
|
sudo -u admin cp -r /home/admin/raspiblitz/home.admin/config.scripts /home/admin/
|
||||||
sudo -u admin chmod +x /home/admin/config.scripts/*.sh
|
sudo -u admin chmod +x /home/admin/config.scripts/*.sh
|
||||||
|
sudo -u admin chmod +x /home/admin/setup.scripts/*.sh
|
||||||
|
|
||||||
# install newest version of BlitzPy
|
# install newest version of BlitzPy
|
||||||
blitzpy_wheel=$(ls -trR /home/admin/raspiblitz/home.admin/BlitzPy/dist | grep -E "*any.whl" | tail -n 1)
|
blitzpy_wheel=$(ls -tR /home/admin/raspiblitz/home.admin/BlitzPy/dist | grep -E "*any.whl" | tail -n 1)
|
||||||
blitzpy_version=$(echo ${blitzpy_wheel} | grep -oE "([0-9]\.[0-9]\.[0-9])")
|
blitzpy_version=$(echo ${blitzpy_wheel} | grep -oE "([0-9]\.[0-9]\.[0-9])")
|
||||||
echo ""
|
echo ""
|
||||||
echo "*** INSTALLING BlitzPy Version: ${blitzpy_version} ***"
|
echo "*** INSTALLING BlitzPy Version: ${blitzpy_version} ***"
|
||||||
|
@ -626,6 +636,12 @@ fi
|
||||||
# add /sbin to path for all
|
# add /sbin to path for all
|
||||||
sudo bash -c "echo 'PATH=\$PATH:/sbin' >> /etc/profile"
|
sudo bash -c "echo 'PATH=\$PATH:/sbin' >> /etc/profile"
|
||||||
|
|
||||||
|
# replace boot splash image when raspbian
|
||||||
|
if [ "${baseimage}" == "raspbian" ]; then
|
||||||
|
echo "* replacing boot splash"
|
||||||
|
sudo cp /home/admin/raspiblitz/pictures/splash.png /usr/share/plymouth/themes/pix/splash.png
|
||||||
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "*** RASPIBLITZ EXTRAS ***"
|
echo "*** RASPIBLITZ EXTRAS ***"
|
||||||
|
|
||||||
|
@ -820,61 +836,53 @@ sudo cp /home/admin/assets/background.service /etc/systemd/system/background.ser
|
||||||
sudo systemctl enable background
|
sudo systemctl enable background
|
||||||
|
|
||||||
# "*** BITCOIN ***"
|
# "*** BITCOIN ***"
|
||||||
# based on https://stadicus.github.io/RaspiBolt/raspibolt_30_bitcoin.html#installation
|
|
||||||
|
|
||||||
echo ""
|
echo
|
||||||
echo "*** PREPARING BITCOIN ***"
|
echo "*** PREPARING BITCOIN ***"
|
||||||
|
|
||||||
# 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.21.0"
|
bitcoinVersion="22.0"
|
||||||
|
|
||||||
# needed to check code signing
|
# needed to check code signing
|
||||||
laanwjPGP="01EA5486DE18A882D4C2684590C8019E36C2E964"
|
# https://github.com/laanwj
|
||||||
|
laanwjPGP="71A3 B167 3540 5025 D447 E8F2 7481 0B01 2346 C9A6"
|
||||||
|
|
||||||
# prepare directories
|
# prepare directories
|
||||||
sudo rm -rf /home/admin/download
|
sudo rm -rf /home/admin/download
|
||||||
sudo -u admin mkdir /home/admin/download
|
sudo -u admin mkdir /home/admin/download
|
||||||
cd /home/admin/download
|
cd /home/admin/download
|
||||||
|
|
||||||
# download, check and import signer key
|
# receive signer key
|
||||||
sudo -u admin wget https://bitcoin.org/laanwj-releases.asc
|
if ! gpg --keyserver hkp://keyserver.ubuntu.com --recv-key "71A3 B167 3540 5025 D447 E8F2 7481 0B01 2346 C9A6"
|
||||||
if [ ! -f "./laanwj-releases.asc" ]
|
|
||||||
then
|
then
|
||||||
echo "!!! FAIL !!! Download laanwj-releases.asc not success."
|
echo "!!! FAIL !!! Couldn't download Wladimir J. van der Laan's PGP pubkey"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
gpg --import --import-options show-only ./laanwj-releases.asc
|
|
||||||
fingerprint=$(gpg ./laanwj-releases.asc 2>/dev/null | grep "${laanwjPGP}" -c)
|
# download signed binary sha256 hash sum file
|
||||||
if [ ${fingerprint} -lt 1 ]; then
|
sudo -u admin wget https://bitcoincore.org/bin/bitcoin-core-${bitcoinVersion}/SHA256SUMS
|
||||||
echo ""
|
|
||||||
echo "!!! BUILD WARNING --> Bitcoin PGP author not as expected"
|
|
||||||
echo "Should contain laanwjPGP: ${laanwjPGP}"
|
|
||||||
echo "PRESS ENTER to TAKE THE RISK if you think all is OK"
|
|
||||||
read key
|
|
||||||
fi
|
|
||||||
gpg --import ./laanwj-releases.asc
|
|
||||||
|
|
||||||
# download signed binary sha256 hash sum file and check
|
# download signed binary sha256 hash sum file and check
|
||||||
sudo -u admin wget https://bitcoin.org/bin/bitcoin-core-${bitcoinVersion}/SHA256SUMS.asc
|
sudo -u admin wget https://bitcoincore.org/bin/bitcoin-core-${bitcoinVersion}/SHA256SUMS.asc
|
||||||
verifyResult=$(gpg --verify SHA256SUMS.asc 2>&1)
|
verifyResult=$(gpg --verify SHA256SUMS.asc 2>&1)
|
||||||
goodSignature=$(echo ${verifyResult} | grep 'Good signature' -c)
|
goodSignature=$(echo ${verifyResult} | grep 'Good signature' -c)
|
||||||
echo "goodSignature(${goodSignature})"
|
echo "goodSignature(${goodSignature})"
|
||||||
correctKey=$(echo ${verifyResult} | grep "using RSA key ${laanwjPGP: -16}" -c)
|
correctKey=$(echo ${verifyResult} | grep "${laanwjPGP}" -c)
|
||||||
echo "correctKey(${correctKey})"
|
echo "correctKey(${correctKey})"
|
||||||
if [ ${correctKey} -lt 1 ] || [ ${goodSignature} -lt 1 ]; then
|
if [ ${correctKey} -lt 1 ] || [ ${goodSignature} -lt 1 ]; then
|
||||||
echo ""
|
echo ""
|
||||||
echo "!!! BUILD FAILED --> PGP Verify not OK / signature(${goodSignature}) verify(${correctKey})"
|
echo "!!! BUILD FAILED --> PGP Verify not OK / signature(${goodSignature}) verify(${correctKey})"
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
echo ""
|
echo
|
||||||
echo "****************************************"
|
echo "****************************************"
|
||||||
echo "OK --> BITCOIN MANIFEST IS CORRECT"
|
echo "OK --> BITCOIN MANIFEST IS CORRECT"
|
||||||
echo "****************************************"
|
echo "****************************************"
|
||||||
echo ""
|
echo
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# get the sha256 value for the corresponding platform from signed hash sum file
|
# bitcoinOSversion
|
||||||
if [ ${isARM} -eq 1 ] ; then
|
if [ ${isARM} -eq 1 ] ; then
|
||||||
bitcoinOSversion="arm-linux-gnueabihf"
|
bitcoinOSversion="arm-linux-gnueabihf"
|
||||||
fi
|
fi
|
||||||
|
@ -884,22 +892,24 @@ fi
|
||||||
if [ ${isX86_64} -eq 1 ] ; then
|
if [ ${isX86_64} -eq 1 ] ; then
|
||||||
bitcoinOSversion="x86_64-linux-gnu"
|
bitcoinOSversion="x86_64-linux-gnu"
|
||||||
fi
|
fi
|
||||||
bitcoinSHA256=$(grep -i "$bitcoinOSversion" SHA256SUMS.asc | cut -d " " -f1)
|
|
||||||
|
|
||||||
echo ""
|
echo
|
||||||
echo "*** BITCOIN v${bitcoinVersion} for ${bitcoinOSversion} ***"
|
echo "*** BITCOIN CORE v${bitcoinVersion} for ${bitcoinOSversion} ***"
|
||||||
|
|
||||||
# download resources
|
# download resources
|
||||||
binaryName="bitcoin-${bitcoinVersion}-${bitcoinOSversion}.tar.gz"
|
binaryName="bitcoin-${bitcoinVersion}-${bitcoinOSversion}.tar.gz"
|
||||||
if [ ! -f "./${binaryName}" ]; then
|
if [ ! -f "./${binaryName}" ]; then
|
||||||
sudo -u admin wget https://bitcoin.org/bin/bitcoin-core-${bitcoinVersion}/${binaryName}
|
sudo -u admin wget https://bitcoincore.org/bin/bitcoin-core-${bitcoinVersion}/${binaryName}
|
||||||
fi
|
fi
|
||||||
if [ ! -f "./${binaryName}" ]; then
|
if [ ! -f "./${binaryName}" ]; then
|
||||||
echo "!!! FAIL !!! Download BITCOIN BINARY not success."
|
echo "!!! FAIL !!! Could not download the BITCOIN BINARY"
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
|
|
||||||
# check binary checksum test
|
# check binary checksum test
|
||||||
echo "- checksum test"
|
echo "- checksum test"
|
||||||
|
# get the sha256 value for the corresponding platform from signed hash sum file
|
||||||
|
bitcoinSHA256=$(grep -i "${binaryName}" SHA256SUMS | cut -d " " -f1)
|
||||||
binaryChecksum=$(sha256sum ${binaryName} | cut -d " " -f1)
|
binaryChecksum=$(sha256sum ${binaryName} | cut -d " " -f1)
|
||||||
echo "Valid SHA256 checksum should be: ${bitcoinSHA256}"
|
echo "Valid SHA256 checksum should be: ${bitcoinSHA256}"
|
||||||
echo "Downloaded binary SHA256 checksum: ${binaryChecksum}"
|
echo "Downloaded binary SHA256 checksum: ${binaryChecksum}"
|
||||||
|
@ -908,12 +918,13 @@ else
|
||||||
rm -v ./${binaryName}
|
rm -v ./${binaryName}
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
echo ""
|
echo
|
||||||
echo "****************************************"
|
echo "********************************************"
|
||||||
echo "OK --> VERIFIED BITCOIN CHECKSUM CORRECT"
|
echo "OK --> VERIFIED BITCOIN CORE BINARY CHECKSUM"
|
||||||
echo "****************************************"
|
echo "********************************************"
|
||||||
|
echo
|
||||||
sleep 10
|
sleep 10
|
||||||
echo ""
|
echo
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -935,20 +946,17 @@ echo "*** PREPARING LIGHTNING ***"
|
||||||
# "*** LND ***"
|
# "*** LND ***"
|
||||||
## based on https://stadicus.github.io/RaspiBolt/raspibolt_40_lnd.html#lightning-lnd
|
## based on https://stadicus.github.io/RaspiBolt/raspibolt_40_lnd.html#lightning-lnd
|
||||||
## see LND releases: https://github.com/lightningnetwork/lnd/releases
|
## see LND releases: https://github.com/lightningnetwork/lnd/releases
|
||||||
lndVersion="0.12.1-beta"
|
## !!!! If you change here - make sure to also change interims version in lnd.update.sh !!!
|
||||||
|
lndVersion="0.13.3-beta"
|
||||||
|
|
||||||
# olaoluwa
|
# olaoluwa
|
||||||
#PGPauthor="roasbeef"
|
PGPauthor="roasbeef"
|
||||||
#PGPpkeys="https://keybase.io/roasbeef/pgp_keys.asc"
|
PGPpkeys="https://keybase.io/roasbeef/pgp_keys.asc"
|
||||||
#PGPcheck="9769140D255C759B1EB77B46A96387A57CAAE94D"
|
PGPcheck="E4D85299674B2D31FAA1892E372CBD7633C61696"
|
||||||
# bitconner
|
# bitconner
|
||||||
PGPauthor="bitconner"
|
#PGPauthor="bitconner"
|
||||||
PGPpkeys="https://keybase.io/bitconner/pgp_keys.asc"
|
#PGPpkeys="https://keybase.io/bitconner/pgp_keys.asc"
|
||||||
PGPcheck="9C8D61868A7C492003B2744EE7D737B67FA592C7"
|
#PGPcheck="9C8D61868A7C492003B2744EE7D737B67FA592C7"
|
||||||
# Joost Jager
|
|
||||||
#PGPauthor="joostjager"
|
|
||||||
#PGPpkeys="https://keybase.io/joostjager/pgp_keys.asc"
|
|
||||||
#PGPcheck="D146D0F68939436268FA9A130E26BB61B76C4D3A"
|
|
||||||
|
|
||||||
# get LND resources
|
# get LND resources
|
||||||
cd /home/admin/download
|
cd /home/admin/download
|
||||||
|
@ -1058,6 +1066,104 @@ fi
|
||||||
sudo chown -R admin /home/admin
|
sudo chown -R admin /home/admin
|
||||||
echo "- OK install of LND done"
|
echo "- OK install of LND done"
|
||||||
|
|
||||||
|
echo "*** C-lightning ***"
|
||||||
|
# https://github.com/ElementsProject/lightning/releases
|
||||||
|
CLVERSION=0.10.1
|
||||||
|
|
||||||
|
# https://github.com/ElementsProject/lightning/tree/master/contrib/keys
|
||||||
|
PGPsigner="rustyrussel"
|
||||||
|
PGPpkeys="https://raw.githubusercontent.com/ElementsProject/lightning/master/contrib/keys/rustyrussell.txt"
|
||||||
|
PGPcheck="D9200E6CD1ADB8F1"
|
||||||
|
|
||||||
|
# prepare download dir
|
||||||
|
sudo rm -rf /home/admin/download/cl
|
||||||
|
sudo -u admin mkdir -p /home/admin/download/cl
|
||||||
|
cd /home/admin/download/cl || exit 1
|
||||||
|
|
||||||
|
sudo -u admin wget -O "pgp_keys.asc" ${PGPpkeys}
|
||||||
|
gpg --import --import-options show-only ./pgp_keys.asc
|
||||||
|
fingerprint=$(gpg "pgp_keys.asc" 2>/dev/null | grep "${PGPcheck}" -c)
|
||||||
|
if [ ${fingerprint} -lt 1 ]; then
|
||||||
|
echo
|
||||||
|
echo "!!! WARNING --> the PGP fingerprint is not as expected for ${PGPsigner}"
|
||||||
|
echo "Should contain PGP: ${PGPcheck}"
|
||||||
|
echo "PRESS ENTER to TAKE THE RISK if you think all is OK"
|
||||||
|
read key
|
||||||
|
fi
|
||||||
|
gpg --import ./pgp_keys.asc
|
||||||
|
|
||||||
|
sudo -u admin wget https://github.com/ElementsProject/lightning/releases/download/v${CLVERSION}/SHA256SUMS
|
||||||
|
sudo -u admin wget https://github.com/ElementsProject/lightning/releases/download/v${CLVERSION}/SHA256SUMS.asc
|
||||||
|
|
||||||
|
verifyResult=$(gpg --verify SHA256SUMS.asc 2>&1)
|
||||||
|
|
||||||
|
goodSignature=$(echo ${verifyResult} | grep 'Good signature' -c)
|
||||||
|
echo "goodSignature(${goodSignature})"
|
||||||
|
correctKey=$(echo ${verifyResult} | tr -d " \t\n\r" | grep "${PGPcheck}" -c)
|
||||||
|
echo "correctKey(${correctKey})"
|
||||||
|
if [ ${correctKey} -lt 1 ] || [ ${goodSignature} -lt 1 ]; then
|
||||||
|
echo
|
||||||
|
echo "!!! BUILD FAILED --> PGP verification not OK / signature(${goodSignature}) verify(${correctKey})"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo
|
||||||
|
echo "****************************************************************"
|
||||||
|
echo "OK --> the PGP signature of the C-lightning SHA256SUMS is correct"
|
||||||
|
echo "****************************************************************"
|
||||||
|
echo
|
||||||
|
fi
|
||||||
|
|
||||||
|
sudo -u admin wget https://github.com/ElementsProject/lightning/releases/download/v${CLVERSION}/clightning-v${CLVERSION}.zip
|
||||||
|
|
||||||
|
hashCheckResult=$(sha256sum -c SHA256SUMS 2>&1)
|
||||||
|
goodHash=$(echo ${hashCheckResult} | grep 'OK' -c)
|
||||||
|
echo "goodHash(${goodHash})"
|
||||||
|
if [ ${goodHash} -lt 1 ]; then
|
||||||
|
echo
|
||||||
|
echo "!!! BUILD FAILED --> Hash check not OK"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo
|
||||||
|
echo "********************************************************************"
|
||||||
|
echo "OK --> the hash of the downloaded C-lightning source code is correct"
|
||||||
|
echo "********************************************************************"
|
||||||
|
echo
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "- Install build dependencies"
|
||||||
|
sudo apt-get install -y \
|
||||||
|
autoconf automake build-essential git libtool libgmp-dev \
|
||||||
|
libsqlite3-dev python3 python3-mako net-tools zlib1g-dev libsodium-dev \
|
||||||
|
gettext unzip
|
||||||
|
|
||||||
|
sudo -u admin unzip clightning-v${CLVERSION}.zip
|
||||||
|
cd clightning-v${CLVERSION} || exit 1
|
||||||
|
|
||||||
|
echo "- Configuring EXPERIMENTAL_FEATURES enabled"
|
||||||
|
sudo -u admin ./configure --enable-experimental-features
|
||||||
|
|
||||||
|
echo "- Building C-lightning from source"
|
||||||
|
sudo -u admin make
|
||||||
|
|
||||||
|
echo "- Install to /usr/local/bin/"
|
||||||
|
sudo make install || exit 1
|
||||||
|
|
||||||
|
installed=$(sudo -u admin lightning-cli --version)
|
||||||
|
if [ ${#installed} -eq 0 ]; then
|
||||||
|
echo
|
||||||
|
echo "!!! BUILD FAILED --> Was not able to install C-lightning"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
correctVersion=$(echo "${installed}" | grep -c "${CLVERSION}")
|
||||||
|
if [ ${correctVersion} -eq 0 ]; then
|
||||||
|
echo
|
||||||
|
echo "!!! BUILD FAILED --> installed C-lightning is not version ${CLVERSION}"
|
||||||
|
sudo -u admin lightning-cli --version
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "- OK the installation of C-lightning v${installed} is done"
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "*** raspiblitz.info ***"
|
echo "*** raspiblitz.info ***"
|
||||||
sudo cat /home/admin/raspiblitz.info
|
sudo cat /home/admin/raspiblitz.info
|
||||||
|
@ -1073,7 +1179,7 @@ echo "Take the chance & look thru the output above if you can spot any errors or
|
||||||
echo ""
|
echo ""
|
||||||
echo "IMPORTANT IF WANT TO MAKE A RELEASE IMAGE FROM THIS BUILD:"
|
echo "IMPORTANT IF WANT TO MAKE A RELEASE IMAGE FROM THIS BUILD:"
|
||||||
echo "1. login fresh --> user:admin password:raspiblitz"
|
echo "1. login fresh --> user:admin password:raspiblitz"
|
||||||
echo "2. run --> ./XXprepareRelease.sh"
|
echo "2. run --> release"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# (do last - because might trigger reboot)
|
# (do last - because might trigger reboot)
|
||||||
|
@ -1081,4 +1187,7 @@ if [ "${displayClass}" != "headless" ] || [ "${baseimage}" = "raspbian" ] || [ "
|
||||||
echo "*** ADDITIONAL DISPLAY OPTIONS ***"
|
echo "*** ADDITIONAL DISPLAY OPTIONS ***"
|
||||||
echo "- calling: blitz.display.sh set-display ${displayClass}"
|
echo "- calling: blitz.display.sh set-display ${displayClass}"
|
||||||
sudo /home/admin/config.scripts/blitz.display.sh set-display ${displayClass}
|
sudo /home/admin/config.scripts/blitz.display.sh set-display ${displayClass}
|
||||||
|
sudo /home/admin/config.scripts/blitz.display.sh rotate 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "# BUILD DONE - see above"
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# 00infoBlitz.sh <cl|lnd> <testnet|mainnet|signet>
|
||||||
|
|
||||||
# load code software version
|
# load code software version
|
||||||
source /home/admin/_version.info
|
source /home/admin/_version.info
|
||||||
|
|
||||||
|
@ -14,6 +16,8 @@ color_gray='\033[0;37m'
|
||||||
source /home/admin/raspiblitz.info 2>/dev/null
|
source /home/admin/raspiblitz.info 2>/dev/null
|
||||||
source /mnt/hdd/raspiblitz.conf 2>/dev/null
|
source /mnt/hdd/raspiblitz.conf 2>/dev/null
|
||||||
|
|
||||||
|
source <(/home/admin/config.scripts/network.aliases.sh getvars $1 $2)
|
||||||
|
|
||||||
## get HDD/SSD info
|
## get HDD/SSD info
|
||||||
source <(sudo /home/admin/config.scripts/blitz.datadrive.sh status)
|
source <(sudo /home/admin/config.scripts/blitz.datadrive.sh status)
|
||||||
hdd="${hddUsedInfo}"
|
hdd="${hddUsedInfo}"
|
||||||
|
@ -45,7 +49,7 @@ if [ ${#network} -eq 0 ]; then
|
||||||
if [ ${litecoinActive} -eq 1 ]; then
|
if [ ${litecoinActive} -eq 1 ]; then
|
||||||
network="litecoin"
|
network="litecoin"
|
||||||
else
|
else
|
||||||
network=`sudo cat /home/admin/.network 2>/dev/null`
|
network=$(sudo cat /home/admin/.network 2>/dev/null)
|
||||||
fi
|
fi
|
||||||
if [ ${#network} -eq 0 ]; then
|
if [ ${#network} -eq 0 ]; then
|
||||||
network="bitcoin"
|
network="bitcoin"
|
||||||
|
@ -62,7 +66,6 @@ if [ ${#chain} -eq 0 ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# set datadir
|
# set datadir
|
||||||
bitcoin_dir="/home/bitcoin/.${network}"
|
|
||||||
lnd_dir="/home/bitcoin/.lnd"
|
lnd_dir="/home/bitcoin/.lnd"
|
||||||
lnd_macaroon_dir="/home/bitcoin/.lnd/data/chain/${network}/${chain}net"
|
lnd_macaroon_dir="/home/bitcoin/.lnd/data/chain/${network}/${chain}net"
|
||||||
|
|
||||||
|
@ -74,9 +77,13 @@ cpu=0
|
||||||
if [ -d "/sys/class/thermal/thermal_zone0/" ]; then
|
if [ -d "/sys/class/thermal/thermal_zone0/" ]; then
|
||||||
cpu=$(cat /sys/class/thermal/thermal_zone0/temp)
|
cpu=$(cat /sys/class/thermal/thermal_zone0/temp)
|
||||||
fi
|
fi
|
||||||
tempC=$((cpu/1000))
|
if [ $cpu = 0 ];then
|
||||||
tempF=$(((tempC * 18 + 325) / 10))
|
tempC=""
|
||||||
|
tempF=""
|
||||||
|
else
|
||||||
|
tempC=$((cpu/1000))
|
||||||
|
tempF=$(((tempC * 18 + 325) / 10))
|
||||||
|
fi
|
||||||
# get memory
|
# get memory
|
||||||
ram_avail=$(free -m | grep Mem | awk '{ print $7 }')
|
ram_avail=$(free -m | grep Mem | awk '{ print $7 }')
|
||||||
ram=$(printf "%sM / %sM" "${ram_avail}" "$(free -m | grep Mem | awk '{ print $2 }')")
|
ram=$(printf "%sM / %sM" "${ram_avail}" "$(free -m | grep Mem | awk '{ print $2 }')")
|
||||||
|
@ -90,17 +97,17 @@ fi
|
||||||
# Bitcoin blockchain
|
# Bitcoin blockchain
|
||||||
btc_path=$(command -v ${network}-cli)
|
btc_path=$(command -v ${network}-cli)
|
||||||
blockInfo="-"
|
blockInfo="-"
|
||||||
if [ -n ${btc_path} ]; then
|
if [ -n "${btc_path}" ]; then
|
||||||
btc_title=$network
|
btc_title=$network
|
||||||
blockchaininfo="$(${network}-cli -datadir=${bitcoin_dir} getblockchaininfo 2>/dev/null)"
|
blockchaininfo="$($bitcoincli_alias getblockchaininfo 2>/dev/null)"
|
||||||
if [ ${#blockchaininfo} -gt 0 ]; then
|
if [ ${#blockchaininfo} -gt 0 ]; then
|
||||||
btc_title="${btc_title} (${chain}net)"
|
btc_title="${btc_title} (${chain}net)"
|
||||||
|
|
||||||
# get sync status
|
# get sync status
|
||||||
block_chain="$(${network}-cli -datadir=${bitcoin_dir} getblockcount 2>/dev/null)"
|
headers="$(echo "${blockchaininfo}" | jq -r '.headers')"
|
||||||
block_verified="$(echo "${blockchaininfo}" | jq -r '.blocks')"
|
block_verified="$(echo "${blockchaininfo}" | jq -r '.blocks')"
|
||||||
block_diff=$(expr ${block_chain} - ${block_verified})
|
block_diff=$(expr ${headers} - ${block_verified})
|
||||||
blockInfo="${block_verified}/${block_chain}"
|
blockInfo="${block_verified}/${headers}"
|
||||||
|
|
||||||
progress="$(echo "${blockchaininfo}" | jq -r '.verificationprogress')"
|
progress="$(echo "${blockchaininfo}" | jq -r '.verificationprogress')"
|
||||||
sync_percentage=$(echo $progress | awk '{printf( "%.2f%%", 100 * $1)}')
|
sync_percentage=$(echo $progress | awk '{printf( "%.2f%%", 100 * $1)}')
|
||||||
|
@ -124,13 +131,12 @@ if [ -n ${btc_path} ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# get last known block
|
# get last known block
|
||||||
last_block="$(${network}-cli -datadir=${bitcoin_dir} getblockcount 2>/dev/null)"
|
|
||||||
if [ ! -z "${last_block}" ]; then
|
if [ ! -z "${last_block}" ]; then
|
||||||
btc_line2="${btc_line2} ${color_gray}(block ${last_block})"
|
btc_line2="${btc_line2} ${color_gray}(block ${last_block})"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# get mem pool transactions
|
# get mem pool transactions
|
||||||
mempool="$(${network}-cli -datadir=${bitcoin_dir} getmempoolinfo 2>/dev/null | jq -r '.size')"
|
mempool="$($bitcoincli_alias getmempoolinfo 2>/dev/null | jq -r '.size')"
|
||||||
|
|
||||||
else
|
else
|
||||||
btc_line2="${color_red}NOT RUNNING\t\t"
|
btc_line2="${color_red}NOT RUNNING\t\t"
|
||||||
|
@ -138,7 +144,7 @@ if [ -n ${btc_path} ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# get IP address & port
|
# get IP address & port
|
||||||
networkInfo=$(${network}-cli -datadir=${bitcoin_dir} getnetworkinfo 2>/dev/null)
|
networkInfo=$($bitcoincli_alias getnetworkinfo 2>/dev/null)
|
||||||
local_ip="${localip}" # from internet.sh
|
local_ip="${localip}" # from internet.sh
|
||||||
public_ip="${cleanip}"
|
public_ip="${cleanip}"
|
||||||
public_port="$(echo ${networkInfo} | jq -r '.localaddresses [0] .port')"
|
public_port="$(echo ${networkInfo} | jq -r '.localaddresses [0] .port')"
|
||||||
|
@ -152,9 +158,14 @@ fi
|
||||||
|
|
||||||
# check if RTL web interface is installed
|
# check if RTL web interface is installed
|
||||||
webinterfaceInfo=""
|
webinterfaceInfo=""
|
||||||
runningRTL=$(sudo ls /etc/systemd/system/RTL.service 2>/dev/null | grep -c 'RTL.service')
|
runningRTL=$(systemctl status ${netprefix}${typeprefix}RTL.service 2>/dev/null | grep -c active)
|
||||||
if [ ${runningRTL} -eq 1 ]; then
|
if [ ${runningRTL} -eq 1 ]; then
|
||||||
webinterfaceInfo="Web admin --> ${color_green}http://${local_ip}:3000"
|
if [ "${lightning}" == "cl" ]; then
|
||||||
|
RTLHTTP=${portprefix}7000
|
||||||
|
elif [ "${lightning}" == "lnd" ];then
|
||||||
|
RTLHTTP=${portprefix}3000
|
||||||
|
fi
|
||||||
|
webinterfaceInfo="Web admin --> ${color_green}http://${local_ip}:${RTLHTTP}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# CHAIN NETWORK
|
# CHAIN NETWORK
|
||||||
|
@ -162,9 +173,8 @@ public_addr_pre="Public "
|
||||||
public_addr="??"
|
public_addr="??"
|
||||||
torInfo=""
|
torInfo=""
|
||||||
# Version
|
# Version
|
||||||
networkVersion=$(${network}-cli -datadir=${bitcoin_dir} -version 2>/dev/null | cut -d ' ' -f6)
|
networkVersion=$($bitcoincli_alias -version 2>/dev/null | cut -d ' ' -f6)
|
||||||
# TOR or IP
|
# TOR or IP
|
||||||
networkInfo=$(${network}-cli -datadir=${bitcoin_dir} getnetworkinfo)
|
|
||||||
networkConnections=$(echo ${networkInfo} | jq -r '.connections')
|
networkConnections=$(echo ${networkInfo} | jq -r '.connections')
|
||||||
networkConnectionsInfo="${color_green}${networkConnections} ${color_gray}connections"
|
networkConnectionsInfo="${color_green}${networkConnections} ${color_gray}connections"
|
||||||
|
|
||||||
|
@ -222,72 +232,187 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# LIGHTNING NETWORK
|
# LIGHTNING NETWORK
|
||||||
|
if [ "${lightning}" == "cl" ]; then
|
||||||
ln_baseInfo="-"
|
ln_getInfo=$($lightningcli_alias getinfo 2>/dev/null)
|
||||||
ln_channelInfo="\n"
|
ln_baseInfo="-"
|
||||||
ln_external="\n"
|
ln_channelInfo="\n"
|
||||||
ln_alias="${hostname}"
|
ln_external="\n"
|
||||||
ln_publicColor=""
|
ln_alias="$(sudo cat "${CLCONF}" | grep "^alias=*" | cut -f2 -d=)"
|
||||||
ln_port=$(sudo cat /mnt/hdd/lnd/lnd.conf | grep "^listen=*" | cut -f2 -d':')
|
if [ ${#ln_alias} -eq 0 ];then
|
||||||
if [ ${#ln_port} -eq 0 ]; then
|
ln_alias=$(echo "${ln_getInfo}" | grep '"alias":' | cut -d '"' -f4)
|
||||||
ln_port="9735"
|
|
||||||
fi
|
|
||||||
|
|
||||||
wallet_unlocked=$(sudo tail -n 1 /mnt/hdd/lnd/logs/${network}/${chain}net/lnd.log 2> /dev/null | grep -c unlock)
|
|
||||||
if [ "$wallet_unlocked" -gt 0 ] ; then
|
|
||||||
alias_color="${color_red}"
|
|
||||||
ln_alias="Wallet Locked"
|
|
||||||
else
|
|
||||||
ln_getInfo=$(sudo -u bitcoin /usr/local/bin/lncli --macaroonpath=${lnd_macaroon_dir}/readonly.macaroon --tlscertpath=${lnd_dir}/tls.cert getinfo 2>/dev/null)
|
|
||||||
ln_external=$(echo "${ln_getInfo}" | grep "uris" -A 1 | tr -d '\n' | cut -d '"' -f4)
|
|
||||||
ln_tor=$(echo "${ln_external}" | grep -c ".onion")
|
|
||||||
if [ ${ln_tor} -eq 1 ]; then
|
|
||||||
ln_publicColor="${color_green}"
|
|
||||||
else
|
|
||||||
public_check=$(nc -z -w6 ${public_ip} ${ln_port} 2>/dev/null; echo $?)
|
|
||||||
if [ $public_check = "0" ] || [ "${ipv6}" == "on" ]; then
|
|
||||||
# only set yellow/normal because netcat can only say that the port is open - not that it points to this device for sure
|
|
||||||
ln_publicColor="${color_amber}"
|
|
||||||
else
|
|
||||||
ln_publicColor="${color_red}"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
alias_color="${color_grey}"
|
if [ ${#ln_alias} -eq 0 ];then
|
||||||
ln_sync=$(echo "${ln_getInfo}" | grep "synced_to_chain" | grep "true" -c)
|
ln_alias=${hostname}
|
||||||
ln_version=$(echo "${ln_getInfo}" | jq -r '.version' | cut -d' ' -f1)
|
fi
|
||||||
if [ ${ln_sync} -eq 0 ]; then
|
ln_publicColor=""
|
||||||
if [ ${#ln_getInfo} -eq 0 ]; then
|
ln_port=$(sudo cat "${CLCONF}" | grep "^bind-addr=*" | cut -f2 -d':')
|
||||||
ln_baseInfo="${color_red} Not Started | Not Ready Yet"
|
if [ ${#ln_port} -eq 0 ]; then
|
||||||
else
|
ln_port=$(echo "${ln_getInfo}" | grep '"port":' | cut -d: -f2 | tail -1 | bc)
|
||||||
ln_baseInfo="${color_amber} Waiting for Chain Sync"
|
fi
|
||||||
fi
|
wallet_unlocked=0 #TODO
|
||||||
|
if [ "$wallet_unlocked" -gt 0 ] ; then
|
||||||
|
ln_alias="Wallet Locked"
|
||||||
|
else
|
||||||
|
pubkey=$(echo "${ln_getInfo}" | grep '"id":' | cut -d '"' -f4)
|
||||||
|
address=$(echo "${ln_getInfo}" | grep '.onion' | cut -d '"' -f4)
|
||||||
|
if [ ${#address} -eq 0 ];then
|
||||||
|
address=$(echo "${ln_getInfo}" | grep '"ipv4"' -A 1 | tail -1 | cut -d '"' -f4)
|
||||||
|
fi
|
||||||
|
ln_external="${pubkey}@${address}"
|
||||||
|
ln_tor=$(echo "${ln_external}" | grep -c ".onion")
|
||||||
|
if [ ${ln_tor} -eq 1 ]; then
|
||||||
|
ln_publicColor="${color_green}"
|
||||||
else
|
else
|
||||||
ln_walletbalance="$(sudo -u bitcoin /usr/local/bin/lncli --macaroonpath=${lnd_macaroon_dir}/readonly.macaroon --tlscertpath=${lnd_dir}/tls.cert walletbalance | jq -r '.confirmed_balance')" 2>/dev/null
|
public_check=$(nc -z -w6 ${public_ip} ${ln_port} 2>/dev/null; echo $?)
|
||||||
ln_walletbalance_wait="$(sudo -u bitcoin /usr/local/bin/lncli --macaroonpath=${lnd_macaroon_dir}/readonly.macaroon --tlscertpath=${lnd_dir}/tls.cert walletbalance | jq -r '.unconfirmed_balance')" 2>/dev/null
|
if [ $public_check = "0" ] || [ "${ipv6}" == "on" ]; then
|
||||||
if [ "${ln_walletbalance_wait}" = "0" ]; then ln_walletbalance_wait=""; fi
|
# only set yellow/normal because netcat can only say that the port is open - not that it points to this device for sure
|
||||||
if [ ${#ln_walletbalance_wait} -gt 0 ]; then ln_walletbalance_wait="(+${ln_walletbalance_wait})"; fi
|
ln_publicColor="${color_amber}"
|
||||||
ln_channelbalance="$(sudo -u bitcoin /usr/local/bin/lncli --macaroonpath=${lnd_macaroon_dir}/readonly.macaroon --tlscertpath=${lnd_dir}/tls.cert channelbalance | jq -r '.balance')" 2>/dev/null
|
else
|
||||||
ln_channelbalance_pending="$(sudo -u bitcoin /usr/local/bin/lncli --macaroonpath=${lnd_macaroon_dir}/readonly.macaroon --tlscertpath=${lnd_dir}/tls.cert channelbalance | jq -r '.pending_open_balance')" 2>/dev/null
|
ln_publicColor="${color_red}"
|
||||||
if [ "${ln_channelbalance_pending}" = "0" ]; then ln_channelbalance_pending=""; fi
|
fi
|
||||||
if [ ${#ln_channelbalance_pending} -gt 0 ]; then ln_channelbalance_pending=" (+${ln_channelbalance_pending})"; fi
|
|
||||||
ln_channels_online="$(echo "${ln_getInfo}" | jq -r '.num_active_channels')" 2>/dev/null
|
|
||||||
ln_channels_total="$(sudo -u bitcoin /usr/local/bin/lncli --macaroonpath=${lnd_macaroon_dir}/readonly.macaroon --tlscertpath=${lnd_dir}/tls.cert listchannels | jq '.[] | length')" 2>/dev/null
|
|
||||||
ln_baseInfo="${color_gray}wallet ${ln_walletbalance} sat ${ln_walletbalance_wait}"
|
|
||||||
ln_peers="$(echo "${ln_getInfo}" | jq -r '.num_peers')" 2>/dev/null
|
|
||||||
ln_channelInfo="${ln_channels_online}/${ln_channels_total} Channels ${ln_channelbalance} sat${ln_channelbalance_pending}"
|
|
||||||
ln_peersInfo="${color_green}${ln_peers} ${color_gray}peers"
|
|
||||||
ln_dailyfees="$(sudo -u bitcoin /usr/local/bin/lncli --macaroonpath=${lnd_macaroon_dir}/readonly.macaroon --tlscertpath=${lnd_dir}/tls.cert feereport | jq -r '.day_fee_sum')" 2>/dev/null
|
|
||||||
ln_weeklyfees="$(sudo -u bitcoin /usr/local/bin/lncli --macaroonpath=${lnd_macaroon_dir}/readonly.macaroon --tlscertpath=${lnd_dir}/tls.cert feereport | jq -r '.week_fee_sum')" 2>/dev/null
|
|
||||||
ln_monthlyfees="$(sudo -u bitcoin /usr/local/bin/lncli --macaroonpath=${lnd_macaroon_dir}/readonly.macaroon --tlscertpath=${lnd_dir}/tls.cert feereport | jq -r '.month_fee_sum')" 2>/dev/null
|
|
||||||
ln_feeReport="Fee Report (D-W-M): ${color_green}${ln_dailyfees}-${ln_weeklyfees}-${ln_monthlyfees} ${color_gray}sat"
|
|
||||||
fi
|
fi
|
||||||
|
BLOCKHEIGHT=$(echo "$blockchaininfo"|grep blocks|awk '{print $2}'|cut -d, -f1)
|
||||||
|
CLHEIGHT=$(echo "${ln_getInfo}" | jq .blockheight)
|
||||||
|
if [ "$BLOCKHEIGHT" == "$CLHEIGHT" ];then
|
||||||
|
ln_sync=1
|
||||||
|
else
|
||||||
|
ln_sync=0
|
||||||
|
fi
|
||||||
|
ln_version=$($lightningcli_alias -V)
|
||||||
|
if [ ${ln_sync} -eq 0 ]; then
|
||||||
|
if [ ${#ln_getInfo} -eq 0 ]; then
|
||||||
|
ln_baseInfo="${color_red} Not Started | Not Ready Yet"
|
||||||
|
else
|
||||||
|
ln_baseInfo="
|
||||||
|
${color_amber}Scanning blocks: ${CLHEIGHT}/${BLOCKHEIGHT}"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
ln_walletbalance=0
|
||||||
|
cl_listfunds=$($lightningcli_alias listfunds 2>/dev/null)
|
||||||
|
for i in $(echo "$cl_listfunds" \
|
||||||
|
|jq .outputs[]|jq 'select(.status=="confirmed")'|grep value|awk '{print $2}'|cut -d, -f1);do
|
||||||
|
ln_walletbalance=$((ln_walletbalance+i))
|
||||||
|
done
|
||||||
|
for i in $(echo "$cl_listfunds" \
|
||||||
|
|jq .outputs[]|jq 'select(.status=="unconfirmed")'|grep value|awk '{print $2}'|cut -d, -f1);do
|
||||||
|
ln_walletbalance_wait=$((ln_walletbalance_wait+i))
|
||||||
|
done
|
||||||
|
# ln_closedchannelbalance: "state": "ONCHAIN" funds in channels
|
||||||
|
for i in $(echo "$cl_listfunds" \
|
||||||
|
|jq .channels[]|jq 'select(.state=="ONCHAIN")'|grep channel_sat|awk '{print $2}'|cut -d, -f1);do
|
||||||
|
ln_closedchannelbalance=$((ln_closedchannelbalance+i))
|
||||||
|
done
|
||||||
|
# ln_pendingonchain: waiting onchain + waiting closed channel funds
|
||||||
|
ln_pendingonchain=$((ln_walletbalance_wait+ln_closedchannelbalance))
|
||||||
|
if [ "${ln_pendingonchain}" = "0" ]; then ln_pendingonchain=""; fi
|
||||||
|
if [ ${#ln_pendingonchain} -gt 0 ]; then ln_pendingonchain="(+${ln_pendingonchain})"; fi
|
||||||
|
# ln_channelbalance: "state": "CHANNELD_NORMAL" funds in channels
|
||||||
|
for i in $(echo "$cl_listfunds" \
|
||||||
|
|jq .channels[]|jq 'select(.state=="CHANNELD_NORMAL")'|grep channel_sat|awk '{print $2}'|cut -d, -f1);do
|
||||||
|
ln_channelbalance=$((ln_channelbalance+i))
|
||||||
|
done
|
||||||
|
if [ ${#ln_channelbalance} -eq 0 ];then
|
||||||
|
ln_channelbalance=0
|
||||||
|
fi
|
||||||
|
# ln_channelbalance_all: all funds in channels
|
||||||
|
for i in $(echo "$cl_listfunds" \
|
||||||
|
|jq .channels[]|grep channel_sat|awk '{print $2}'|cut -d, -f1);do
|
||||||
|
ln_channelbalance_all=$((ln_channelbalance_all+i))
|
||||||
|
done
|
||||||
|
ln_channelbalance_pending=$((ln_channelbalance_all-ln_channelbalance-ln_closedchannelbalance))
|
||||||
|
if [ "${ln_channelbalance_pending}" = "0" ]; then ln_channelbalance_pending=""; fi
|
||||||
|
if [ ${#ln_channelbalance_pending} -gt 0 ]; then ln_channelbalance_pending=" (+${ln_channelbalance_pending})"; fi
|
||||||
|
# - **num_peers** (u32): The total count of peers, connected or with channels
|
||||||
|
# - **num_pending_channels** (u32): The total count of channels being opened
|
||||||
|
# - **num_active_channels** (u32): The total count of channels in normal state
|
||||||
|
# - **num_inactive_channels** (u32): The total count of channels waiting for opening or closing
|
||||||
|
ln_channels_online="$(echo "${ln_getInfo}" | jq -r '.num_active_channels')" 2>/dev/null
|
||||||
|
cl_num_pending_channels="$(echo "${ln_getInfo}" | jq -r '.num_pending_channels')" 2>/dev/null
|
||||||
|
cl_num_inactive_channels="$(echo "${ln_getInfo}" | jq -r '.num_inactive_channels')" 2>/dev/null
|
||||||
|
ln_channels_total=$((ln_channels_online+cl_num_pending_channels+cl_num_inactive_channels))
|
||||||
|
ln_baseInfo="${color_gray}Wallet ${ln_walletbalance} ${netprefix}sat ${ln_pendingonchain}"
|
||||||
|
ln_peers="$(echo "${ln_getInfo}" | jq -r '.num_peers')" 2>/dev/null
|
||||||
|
ln_channelInfo="${ln_channels_online}/${ln_channels_total} Channels ${ln_channelbalance} ${netprefix}sat${ln_channelbalance_pending}"
|
||||||
|
ln_peersInfo="${color_green}${ln_peers} ${color_gray}peers"
|
||||||
|
# - **fees_collected_msat** (msat): Total routing fees collected by this node
|
||||||
|
#ln_dailyfees="$($lncli_alias feereport | jq -r '.day_fee_sum')" 2>/dev/null
|
||||||
|
#ln_weeklyfees="$($lncli_alias feereport | jq -r '.week_fee_sum')" 2>/dev/null
|
||||||
|
#ln_monthlyfees="$($lncli_alias feereport | jq -r '.month_fee_sum')" 2>/dev/null
|
||||||
|
#ln_feeReport="Fee Report (D-W-M): ${color_green}${ln_dailyfees}-${ln_weeklyfees}-${ln_monthlyfees} ${color_gray}sat"
|
||||||
|
ln_feeReport="Fees collected: $(echo "${ln_getInfo}" | jq -r '.fees_collected_msat')"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
elif [ "${lightning}" == "lnd" ];then
|
||||||
|
ln_baseInfo="-"
|
||||||
|
ln_channelInfo="\n"
|
||||||
|
ln_external="\n"
|
||||||
|
ln_alias="$(sudo cat /mnt/hdd/lnd/${netprefix}lnd.conf | grep "^alias=*" | cut -f2 -d=)"
|
||||||
|
if [ ${#ln_alias} -eq 0 ];then
|
||||||
|
ln_alias=${hostname}
|
||||||
|
fi
|
||||||
|
ln_publicColor=""
|
||||||
|
ln_port=$(sudo cat /mnt/hdd/lnd/${netprefix}lnd.conf | grep "^listen=*" | cut -f2 -d':')
|
||||||
|
if [ ${#ln_port} -eq 0 ]; then
|
||||||
|
ln_port="9735"
|
||||||
|
fi
|
||||||
|
wallet_unlocked=$(sudo tail -n 1 /mnt/hdd/lnd/logs/${network}/${chain}net/lnd.log 2> /dev/null | grep -c unlock)
|
||||||
|
if [ "$wallet_unlocked" -gt 0 ] ; then
|
||||||
|
ln_alias="Wallet Locked"
|
||||||
|
else
|
||||||
|
ln_getInfo=$($lncli_alias --macaroonpath=${lnd_macaroon_dir}/readonly.macaroon --tlscertpath=${lnd_dir}/tls.cert getinfo 2>/dev/null)
|
||||||
|
ln_external=$(echo "${ln_getInfo}" | grep "uris" -A 1 | tr -d '\n' | cut -d '"' -f4)
|
||||||
|
ln_tor=$(echo "${ln_external}" | grep -c ".onion")
|
||||||
|
if [ ${ln_tor} -eq 1 ]; then
|
||||||
|
ln_publicColor="${color_green}"
|
||||||
|
else
|
||||||
|
public_check=$(nc -z -w6 ${public_ip} ${ln_port} 2>/dev/null; echo $?)
|
||||||
|
if [ $public_check = "0" ] || [ "${ipv6}" == "on" ]; then
|
||||||
|
# only set yellow/normal because netcat can only say that the port is open - not that it points to this device for sure
|
||||||
|
ln_publicColor="${color_amber}"
|
||||||
|
else
|
||||||
|
ln_publicColor="${color_red}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
ln_sync=$(echo "${ln_getInfo}" | grep "synced_to_chain" | grep "true" -c)
|
||||||
|
ln_version=$(echo "${ln_getInfo}" | jq -r '.version' | cut -d' ' -f1)
|
||||||
|
if [ ${ln_sync} -eq 0 ]; then
|
||||||
|
if [ ${#ln_getInfo} -eq 0 ]; then
|
||||||
|
ln_baseInfo="${color_red} Not Started | Not Ready Yet"
|
||||||
|
else
|
||||||
|
ln_baseInfo="${color_amber} Waiting for Chain Sync"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
lnd_walletbalance=$($lncli_alias --macaroonpath=${lnd_macaroon_dir}/readonly.macaroon --tlscertpath=${lnd_dir}/tls.cert walletbalance 2>/dev/null)
|
||||||
|
ln_walletbalance="$(echo "$lnd_walletbalance" | jq -r '.confirmed_balance')" 2>/dev/null
|
||||||
|
ln_walletbalance_wait="$(echo "$lnd_walletbalance" | jq -r '.unconfirmed_balance')" 2>/dev/null
|
||||||
|
if [ "${ln_walletbalance_wait}" = "0" ]; then ln_walletbalance_wait=""; fi
|
||||||
|
if [ ${#ln_walletbalance_wait} -gt 0 ]; then ln_walletbalance_wait="(+${ln_walletbalance_wait})"; fi
|
||||||
|
lnd_channelbalance=$($lncli_alias --macaroonpath=${lnd_macaroon_dir}/readonly.macaroon --tlscertpath=${lnd_dir}/tls.cert channelbalance 2>/dev/null)
|
||||||
|
ln_channelbalance="$(echo "$lnd_channelbalance" | jq -r '.balance')" 2>/dev/null
|
||||||
|
ln_channelbalance_pending="$(echo "$lnd_channelbalance" | jq -r '.pending_open_balance')" 2>/dev/null
|
||||||
|
if [ "${ln_channelbalance_pending}" = "0" ]; then ln_channelbalance_pending=""; fi
|
||||||
|
if [ ${#ln_channelbalance_pending} -gt 0 ]; then ln_channelbalance_pending=" (+${ln_channelbalance_pending})"; fi
|
||||||
|
ln_channels_online="$(echo "${ln_getInfo}" | jq -r '.num_active_channels')" 2>/dev/null
|
||||||
|
ln_channels_total="$($lncli_alias --macaroonpath=${lnd_macaroon_dir}/readonly.macaroon --tlscertpath=${lnd_dir}/tls.cert listchannels | jq '.[] | length')" 2>/dev/null
|
||||||
|
ln_baseInfo="${color_gray}wallet ${ln_walletbalance} ${netprefix}sat ${ln_walletbalance_wait}"
|
||||||
|
ln_peers="$(echo "${ln_getInfo}" | jq -r '.num_peers')" 2>/dev/null
|
||||||
|
ln_channelInfo="${ln_channels_online}/${ln_channels_total} Channels ${ln_channelbalance} ${netprefix}sat${ln_channelbalance_pending}"
|
||||||
|
ln_peersInfo="${color_green}${ln_peers} ${color_gray}peers"
|
||||||
|
lnd_feereport=$($lncli_alias --macaroonpath=${lnd_macaroon_dir}/readonly.macaroon --tlscertpath=${lnd_dir}/tls.cert feereport 2>/dev/null)
|
||||||
|
ln_dailyfees="$(echo "$lnd_feereport" | jq -r '.day_fee_sum')" 2>/dev/null
|
||||||
|
ln_weeklyfees="$(echo "$lnd_feereport" | jq -r '.week_fee_sum')" 2>/dev/null
|
||||||
|
ln_monthlyfees="$(echo "$lnd_feereport" | jq -r '.month_fee_sum')" 2>/dev/null
|
||||||
|
ln_feeReport="Fee Report (D-W-M): ${color_green}${ln_dailyfees}-${ln_weeklyfees}-${ln_monthlyfees} ${color_gray}sat"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# show JoinMarket stats in place of the LND URI only if the Yield Generator is running
|
# show JoinMarket stats in place of the LND URI only if the Yield Generator is running
|
||||||
|
|
||||||
source /home/joinmarket/joinin.conf 2>/dev/null
|
source /home/joinmarket/joinin.conf 2>/dev/null
|
||||||
if [ "${joinmarket}" = "on" ] && [ $(sudo -u joinmarket pgrep -f "python yg-privacyenhanced.py $YGwallet --wallet-password-stdin" 2>/dev/null | wc -l) -gt 2 ]; then
|
if [ "${joinmarket}" = "on" ] && [ $(sudo -u joinmarket pgrep -f "python yg-privacyenhanced.py $YGwallet --wallet-password-stdin" 2>/dev/null | wc -l) -gt 2 ]; then
|
||||||
JMstats=$(mktemp 2>/dev/null)
|
trap 'rm -f "$JMstats"' EXIT
|
||||||
|
JMstats=$(mktemp -p /dev/shm)
|
||||||
sudo -u joinmarket /home/joinmarket/info.stats.sh > $JMstats
|
sudo -u joinmarket /home/joinmarket/info.stats.sh > $JMstats
|
||||||
JMstatsL1=$(sed -n 1p < "$JMstats")
|
JMstatsL1=$(sed -n 1p < "$JMstats")
|
||||||
JMstatsL2=$(sed -n 2p < "$JMstats")
|
JMstatsL2=$(sed -n 2p < "$JMstats")
|
||||||
|
@ -305,19 +430,38 @@ ${color_yellow}
|
||||||
${color_yellow}${ln_publicColor}${ln_external}${color_gray}"
|
${color_yellow}${ln_publicColor}${ln_external}${color_gray}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "${lightning}" == "cl" ];then
|
||||||
|
LNline="C-LIGHTNING ${color_green}${ln_version}\n ${ln_baseInfo}"
|
||||||
|
elif [ "${lightning}" == "lnd" ];then
|
||||||
|
LNline="LND ${color_green}${ln_version} ${ln_baseInfo}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $cpu = 0 ];then
|
||||||
|
templine="on $(uname -m) VM%s%s"
|
||||||
|
else
|
||||||
|
templine="temp %s°C %s°F"
|
||||||
|
fi
|
||||||
sleep 5
|
sleep 5
|
||||||
|
|
||||||
|
LNinfo=" + Lightning Network"
|
||||||
|
if [ "${lightning}" == "" ]; then
|
||||||
|
LNinfo=""
|
||||||
|
fi
|
||||||
|
|
||||||
## get uptime and current date & time
|
## get uptime and current date & time
|
||||||
uptime=$(uptime --pretty)
|
uptime=$(uptime --pretty)
|
||||||
datetime=$(date -R)
|
datetime=$(date -R)
|
||||||
|
|
||||||
|
stty sane
|
||||||
|
sleep 1
|
||||||
clear
|
clear
|
||||||
|
|
||||||
printf "
|
printf "
|
||||||
${color_yellow}
|
${color_yellow}
|
||||||
${color_yellow}
|
${color_yellow}
|
||||||
${color_yellow}
|
${color_yellow}
|
||||||
${color_yellow} ${color_amber}%s ${color_green} ${ln_alias} ${upsInfo}
|
${color_yellow} ${color_amber}%s ${color_green} ${ln_alias} ${upsInfo}
|
||||||
${color_yellow} ${color_gray}${network^} Fullnode + Lightning Network ${torInfo}
|
${color_yellow} ${color_gray}${network^} Fullnode${LNinfo} ${torInfo}
|
||||||
${color_yellow} ,/ ${color_yellow}%s
|
${color_yellow} ,/ ${color_yellow}%s
|
||||||
${color_yellow} ,'/ ${color_gray}%s
|
${color_yellow} ,'/ ${color_gray}%s
|
||||||
${color_yellow} ,' / ${color_gray}%s, temp %s°C %s°F
|
${color_yellow} ,' / ${color_gray}%s, temp %s°C %s°F
|
||||||
|
@ -327,7 +471,7 @@ ${color_yellow} / ,' ${color_gray}${webinterfaceInfo}
|
||||||
${color_yellow} / ,' ${color_gray}${network} ${color_green}${networkVersion} ${color_gray}${chain}net ${networkConnectionsInfo}
|
${color_yellow} / ,' ${color_gray}${network} ${color_green}${networkVersion} ${color_gray}${chain}net ${networkConnectionsInfo}
|
||||||
${color_yellow} /,' ${color_gray}Blocks ${blockInfo} ${color_gray}Sync ${sync_color}${sync} %s
|
${color_yellow} /,' ${color_gray}Blocks ${blockInfo} ${color_gray}Sync ${sync_color}${sync} %s
|
||||||
${color_yellow} /' ${color_gray}
|
${color_yellow} /' ${color_gray}
|
||||||
${color_yellow} ${color_gray}LND ${color_green}${ln_version} ${ln_baseInfo}
|
${color_yellow} ${color_gray}${LNline}
|
||||||
${color_yellow} ${color_gray}${ln_channelInfo} ${ln_peersInfo}
|
${color_yellow} ${color_gray}${ln_channelInfo} ${ln_peersInfo}
|
||||||
${color_yellow} ${color_gray}${ln_feeReport}
|
${color_yellow} ${color_gray}${ln_feeReport}
|
||||||
$lastLine
|
$lastLine
|
||||||
|
@ -373,57 +517,4 @@ else
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# if running as user "pi":
|
|
||||||
# - write results to a JSON file on RAM disk
|
|
||||||
# - update info.html file
|
|
||||||
if [ "${EUID}" = "$(id -u pi)" ]; then
|
|
||||||
|
|
||||||
json_ln_baseInfo=$(echo "${ln_baseInfo}" | cut -c 11-)
|
|
||||||
|
|
||||||
cat <<EOF > /var/cache/raspiblitz/info.json
|
|
||||||
{
|
|
||||||
"uptime": "${uptime}",
|
|
||||||
"datetime": "${datetime}",
|
|
||||||
"codeVersion": "${codeVersion}",
|
|
||||||
"hostname": "${hostname}",
|
|
||||||
"network": "${network}",
|
|
||||||
"torInfo": "${torInfo}",
|
|
||||||
"load": "${load}",
|
|
||||||
"tempC": "${tempC}",
|
|
||||||
"tempF": "${tempF}",
|
|
||||||
"ram": "${ram}",
|
|
||||||
"hddUsedInfo": "${hddUsedInfo}",
|
|
||||||
"local_ip": "${local_ip}",
|
|
||||||
"network_rx": "${network_rx}",
|
|
||||||
"network_tx": "${network_tx}",
|
|
||||||
"runningRTL": "${runningRTL}",
|
|
||||||
"networkVersion": "${networkVersion}",
|
|
||||||
"chain": "${chain}",
|
|
||||||
"progress": "${progress}",
|
|
||||||
"sync_percentage": "${sync_percentage}",
|
|
||||||
"public_addr_pre": "${public_addr_pre}",
|
|
||||||
"public_addr": "${public_addr}",
|
|
||||||
"public": "${public}",
|
|
||||||
"networkConnections": "${networkConnections}",
|
|
||||||
"mempool": "${mempool}",
|
|
||||||
"ln_sync": "${ln_sync}",
|
|
||||||
"ln_version": "${ln_version}",
|
|
||||||
"ln_baseInfo": "${json_ln_baseInfo}",
|
|
||||||
"ln_peers": "${ln_peers}",
|
|
||||||
"ln_channelInfo": "${ln_channelInfo}",
|
|
||||||
"ln_external": "${ln_external}"
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# use Jinja2 and apply json data to template to produce static html file
|
|
||||||
templateExists=$(sudo ls /var/cache/raspiblitz/info.json 2>/dev/null | grep -c 'info.json')
|
|
||||||
if [ ${templateExists} -gt 0 ]; then
|
|
||||||
res=$(/usr/local/bin/j2 /var/www/blitzweb/info/info.j2 /var/cache/raspiblitz/info.json -o /var/cache/raspiblitz/info.html)
|
|
||||||
if ! [ $? -eq 0 ]; then
|
|
||||||
echo "an error occurred.. maybe JSON syntax is wrong..!"
|
|
||||||
echo "${res}"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
|
||||||
# EOF
|
# EOF
|
||||||
|
|
|
@ -18,8 +18,10 @@ function usage() {
|
||||||
|
|
||||||
# Default Values
|
# Default Values
|
||||||
verbose=0
|
verbose=0
|
||||||
pause=12
|
pause=3
|
||||||
|
|
||||||
|
# this is used by touchscreen and command 'status'
|
||||||
|
# TODO: remove on v1.8
|
||||||
while [[ "$1" == -* ]]; do
|
while [[ "$1" == -* ]]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-h|--help)
|
-h|--help)
|
||||||
|
@ -82,244 +84,40 @@ while :
|
||||||
# CHECK BASIC DATA
|
# CHECK BASIC DATA
|
||||||
###########################
|
###########################
|
||||||
|
|
||||||
# get the local network IP to be displayed on the lCD
|
|
||||||
source <(sudo /home/admin/config.scripts/internet.sh status)
|
|
||||||
|
|
||||||
# waiting for IP in general
|
|
||||||
if [ ${#localip} -eq 0 ]; then
|
|
||||||
l1="Waiting for Network ...\n"
|
|
||||||
l2="Not able to get local IP.\n"
|
|
||||||
l3="LAN cable connected? WIFI lost?\n"
|
|
||||||
dialog --backtitle "RaspiBlitz ${codeVersion}" --infobox "$l1$l2$l3" 5 40
|
|
||||||
sleep 3
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
# waiting for Internet connection
|
|
||||||
if [ ${online} -eq 0 ]; then
|
|
||||||
l1="Waiting for Internet ...\n"
|
|
||||||
l2="Local Network seems OK but no Internet.\n"
|
|
||||||
l3="Is router still online?\n"
|
|
||||||
dialog --backtitle "RaspiBlitz ${codeVersion} ${localip}" --infobox "$l1$l2$l3" 5 45
|
|
||||||
sleep 3
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
# get config info if already available (with state value)
|
# get config info if already available (with state value)
|
||||||
source ${infoFile}
|
source ${infoFile}
|
||||||
configExists=$(ls ${configFile} 2>/dev/null | grep -c '.conf')
|
configExists=$(ls ${configFile} 2>/dev/null | grep -c '.conf')
|
||||||
if [ ${configExists} -eq 1 ]; then
|
if [ ${configExists} -eq 1 ]; then
|
||||||
source ${configFile}
|
source ${configFile}
|
||||||
|
source <(/home/admin/config.scripts/network.aliases.sh getvars)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# reboot info
|
if [ "${setupPhase}" != "done" ] || [ "${state}" == "reboot" ] || [ "${state}" == "shutdown" ] || [ "${state}" == "copytarget" ] || [ "${state}" == "copysource" ] || [ "${state}" == "copystation" ]; then
|
||||||
if [ "${state}" = "reboot" ]; then
|
|
||||||
dialog --backtitle "RaspiBlitz ${codeVersion}" --infobox "Waiting for Reboot ..." 3 30
|
|
||||||
sleep 20
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
# shutdown info
|
# show status info during boot & setup & repair on LCD
|
||||||
if [ "${state}" = "shutdown" ]; then
|
/home/admin/setup.scripts/eventInfoWait.sh "${state}" "${message}" lcd
|
||||||
dialog --backtitle "RaspiBlitz ${codeVersion}" --infobox "Waiting for Shutdown ..." 3 30
|
|
||||||
sleep 20
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
# waiting for DHCP in general
|
|
||||||
if [ "${state}" = "noDHCP" ]; then
|
|
||||||
l1="Waiting for DHCP ...\n"
|
|
||||||
l2="Not able to get local IP.\n"
|
|
||||||
l3="Check you router if constant.\n"
|
|
||||||
dialog --backtitle "RaspiBlitz ${codeVersion} (${localip})" --infobox "$l1$l2$l3" 5 40
|
|
||||||
sleep 1
|
sleep 1
|
||||||
continue
|
continue
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# if no information available from files - set default
|
# TODO: ALSO SEPARATE GUI/ACTION FOR THE SCANNING / WALLET UNLOCK / ERROR DETECTION
|
||||||
if [ ${#setupStep} -eq 0 ]; then
|
# if lightning is syncing or scanning
|
||||||
setupStep=0
|
source <(sudo /home/admin/config.scripts/blitz.statusscan.sh $lightning)
|
||||||
fi
|
if [ "${walletLocked}" == "1" ] || [ "${CLwalletLocked}" == "1" ]; then
|
||||||
|
/home/admin/setup.scripts/eventInfoWait.sh "walletlocked" "" lcd
|
||||||
# before setup even started
|
|
||||||
if [ ${setupStep} -eq 0 ]; then
|
|
||||||
|
|
||||||
# check for internet connection
|
|
||||||
online=$(ping 1.0.0.1 -c 1 -W 2 | grep -c '1 received')
|
|
||||||
if [ ${online} -eq 0 ]; then
|
|
||||||
# re-test with other server
|
|
||||||
online=$(ping 8.8.8.8 -c 1 -W 2 | grep -c '1 received')
|
|
||||||
fi
|
|
||||||
if [ ${online} -eq 0 ]; then
|
|
||||||
# re-test with other server
|
|
||||||
online=$(ping 208.67.222.222 -c 1 -W 2 | grep -c '1 received')
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ${online} -eq 0 ]; then
|
|
||||||
message="no internet connection"
|
|
||||||
|
|
||||||
# when in presync - get more info on progress
|
|
||||||
elif [ "${state}" = "presync" ]; then
|
|
||||||
blockchaininfo="$(sudo -u root bitcoin-cli --conf=/home/admin/assets/bitcoin.conf getblockchaininfo 2>/dev/null)"
|
|
||||||
message="starting"
|
|
||||||
if [ ${#blockchaininfo} -gt 0 ]; then
|
|
||||||
message="$(echo "${blockchaininfo}" | jq -r '.verificationprogress')"
|
|
||||||
message=$(echo $message | awk '{printf( "%.2f%%", 100 * $1)}')
|
|
||||||
fi
|
|
||||||
|
|
||||||
# when old data - improve message
|
|
||||||
elif [ "${state}" = "sdtoosmall" ]; then
|
|
||||||
message="SDCARD TOO SMALL - min 16GB"
|
|
||||||
|
|
||||||
# when no HDD - improve message
|
|
||||||
elif [ "${state}" = "noHDD" ]; then
|
|
||||||
message="Connect external HDD/SSD"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# setup process has not started yet
|
|
||||||
l1="Login to your RaspiBlitz with:\n"
|
|
||||||
l2="ssh admin@${localip}\n"
|
|
||||||
l3="Use password: raspiblitz\n"
|
|
||||||
|
|
||||||
if [ "${state}" = "recovering" ]; then
|
|
||||||
l1="Recovering please wait ..\n"
|
|
||||||
fi
|
|
||||||
|
|
||||||
boxwidth=$((${#localip} + 24))
|
|
||||||
sleep 3
|
|
||||||
dialog --backtitle "RaspiBlitz ${codeVersion} (${state}) - ${message}" --infobox "$l1$l2$l3" 5 ${boxwidth}
|
|
||||||
sleep 5
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
# check if recovering/upgrade is running
|
|
||||||
if [ "${state}" = "recovering" ]; then
|
|
||||||
if [ ${#message} -eq 0 ]; then
|
|
||||||
message="Setup in Progress"
|
|
||||||
fi
|
|
||||||
l1="Upgrade/Recover/Provision\n"
|
|
||||||
l2="---> ${message}\n"
|
|
||||||
l3="Please keep running until reboot."
|
|
||||||
boxwidth=$((${#localip} + 28))
|
|
||||||
dialog --backtitle "RaspiBlitz ${codeVersion} (${state}) ${setupStep} ${localip}" --infobox "$l1$l2$l3" 5 ${boxwidth}
|
|
||||||
sleep 3
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
# if freshly recovered
|
|
||||||
recoveredInfoExists=$(sudo ls /home/admin/recover.flag 2>/dev/null | grep -c '.flag')
|
|
||||||
if [ ${recoveredInfoExists} -gt 0 ]; then
|
|
||||||
l1="FINAL RECOVER LOGIN NEEDED:\n"
|
|
||||||
l2="ssh admin@${localip}\n"
|
|
||||||
l3="Use password: raspiblitz\n"
|
|
||||||
boxwidth=$((${#localip} + 28))
|
|
||||||
dialog --backtitle "RaspiBlitz ${codeVersion} (${state})" --infobox "$l1$l2$l3" 5 ${boxwidth}
|
|
||||||
sleep 3
|
sleep 3
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# if re-indexing
|
if [ "${syncedToChain}" != "1" ]; then
|
||||||
if [ "${state}" = "reindex" ]; then
|
/home/admin/setup.scripts/eventBlockchainSync.sh lcd
|
||||||
l1="REINDEXING BLOCKCHAIN\n"
|
sleep 10
|
||||||
l2="To monitor & detect finish:\n"
|
|
||||||
l3="ssh admin@${localip}\n"
|
|
||||||
boxwidth=$((${#localip} + 28))
|
|
||||||
dialog --backtitle "RaspiBlitz ${codeVersion} (${state})" --infobox "$l1$l2$l3" 5 ${boxwidth}
|
|
||||||
sleep 3
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
# when setup is in progress - password has been changed
|
|
||||||
if [ ${setupStep} -lt 100 ]; then
|
|
||||||
l1="Login to your RaspiBlitz with:\n"
|
|
||||||
l2="ssh admin@${localip}\n"
|
|
||||||
l3="Use your Password A\n"
|
|
||||||
boxwidth=$((${#localip} + 24))
|
|
||||||
sleep 3
|
|
||||||
dialog --backtitle "RaspiBlitz ${codeVersion} ${localip} - Welcome (${setupStep})" --infobox "$l1$l2$l3" 5 ${boxwidth}
|
|
||||||
sleep 7
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
###########################
|
|
||||||
# DISPLAY AFTER SETUP
|
|
||||||
###########################
|
|
||||||
|
|
||||||
if [ "${state}" = "repair" ]; then
|
|
||||||
l1="Repair Mode\n"
|
|
||||||
l2="ssh admin@${localip}\n"
|
|
||||||
l3="Use password: PasswordA\n"
|
|
||||||
boxwidth=$((${#localip} + 28))
|
|
||||||
dialog --backtitle "RaspiBlitz ${codeVersion} (${state}) ${setupStep} ${localip}" --infobox "$l1$l2$l3" 5 ${boxwidth}
|
|
||||||
sleep 3
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "${state}" = "reboot" ]; then
|
|
||||||
l1="Reboot needed.\n"
|
|
||||||
l2="ssh admin@${localip}\n"
|
|
||||||
l3="Use password: PasswordA\n"
|
|
||||||
boxwidth=$((${#localip} + 28))
|
|
||||||
dialog --backtitle "RaspiBlitz ${codeVersion} (${state}) ${setupStep} ${localip}" --infobox "$l1$l2$l3" 5 ${boxwidth}
|
|
||||||
sleep 3
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "${state}" = "retorrent" ]; then
|
|
||||||
l1="Repair Mode- TORRENT\n"
|
|
||||||
l2="ssh admin@${localip}\n"
|
|
||||||
l3="Use password: PasswordA\n"
|
|
||||||
boxwidth=$((${#localip} + 28))
|
|
||||||
dialog --backtitle "RaspiBlitz ${codeVersion} (${state}) ${setupStep} ${localip}" --infobox "$l1$l2$l3" 5 ${boxwidth}
|
|
||||||
sleep 3
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "${state}" = "recopy" ]; then
|
|
||||||
l1="Repair Mode - COPY\n"
|
|
||||||
l2="ssh admin@${localip}\n"
|
|
||||||
l3="Use password: PasswordA\n"
|
|
||||||
boxwidth=$((${#localip} + 28))
|
|
||||||
dialog --backtitle "RaspiBlitz ${codeVersion} (${state}) ${setupStep} ${localip}" --infobox "$l1$l2$l3" 5 ${boxwidth}
|
|
||||||
sleep 3
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "${state}" = "copystation" ]; then
|
|
||||||
l1="COPY STATION MODE\n"
|
|
||||||
l2="${message}"
|
|
||||||
dialog --backtitle "RaspiBlitz ${codeVersion} ${localip}" --infobox "$l1$l2" 6 56
|
|
||||||
sleep 2
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
# if LND is syncing or scanning
|
|
||||||
lndSynced=$(sudo -u bitcoin /usr/local/bin/lncli --chain=${network} --network=${chain}net getinfo 2>/dev/null | jq -r '.synced_to_chain' | grep -c true)
|
|
||||||
if [ ${lndSynced} -eq 0 ]; then
|
|
||||||
/home/admin/80scanLND.sh
|
|
||||||
sleep 20
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
# perform config check
|
|
||||||
configCheck=$(/home/admin/config.scripts/blitz.configcheck.py)
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
configValid=1
|
|
||||||
# echo "Config Valid!"
|
|
||||||
else
|
|
||||||
configValid=0
|
|
||||||
# echo "Config Not Valid!"
|
|
||||||
l1="POTENTIAL CONFIG ERROR FOUND\n"
|
|
||||||
l2="ssh admin@${localip}\n"
|
|
||||||
l3="use Password A\n"
|
|
||||||
l4="Run on Terminal command: check"
|
|
||||||
dialog --backtitle "RaspiBlitz ${codeVersion} cfg-err ${localip}" --infobox "$l1$l2$l3$l4" 6 50
|
|
||||||
sleep 20
|
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# no special case - show status display
|
# no special case - show status display
|
||||||
/home/admin/00infoBlitz.sh
|
/home/admin/00infoBlitz.sh $lightning ${chain}net
|
||||||
sleep 5
|
sleep 5
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
|
@ -40,143 +40,136 @@ confirmation()
|
||||||
# get the local network IP to be displayed on the LCD
|
# get the local network IP to be displayed on the LCD
|
||||||
source <(/home/admin/config.scripts/internet.sh status local)
|
source <(/home/admin/config.scripts/internet.sh status local)
|
||||||
|
|
||||||
|
if [ ${chain} = test ];then
|
||||||
|
netprefix="t"
|
||||||
|
elif [ ${chain} = sig ];then
|
||||||
|
netprefix="s"
|
||||||
|
elif [ ${chain} = main ];then
|
||||||
|
netprefix=""
|
||||||
|
fi
|
||||||
|
|
||||||
# BASIC MENU INFO
|
# BASIC MENU INFO
|
||||||
HEIGHT=19
|
WIDTH=66
|
||||||
WIDTH=64
|
|
||||||
CHOICE_HEIGHT=12
|
|
||||||
BACKTITLE="RaspiBlitz"
|
BACKTITLE="RaspiBlitz"
|
||||||
TITLE=""
|
TITLE=""
|
||||||
MENU="Choose one of the following options:"
|
MENU="Choose one of the following options:"
|
||||||
OPTIONS=()
|
OPTIONS=()
|
||||||
plus=""
|
plus=""
|
||||||
if [ "${runBehindTor}" = "on" ]; then
|
if [ "${runBehindTor}" = "on" ]; then
|
||||||
plus=" / TOR"
|
plus="/ tor"
|
||||||
fi
|
fi
|
||||||
if [ ${#dynDomain} -gt 0 ]; then
|
if [ ${#dynDomain} -gt 0 ]; then
|
||||||
plus="${plus} / ${dynDomain}"
|
plus="/ ${dynDomain} ${plus}"
|
||||||
fi
|
fi
|
||||||
BACKTITLE="${localip} / ${hostname} / ${network} / ${chain}${plus}"
|
if [ ${#lightning} -gt 0 ]; then
|
||||||
|
plus="/ ${lightning} ${plus}"
|
||||||
if [ "${rtlWebinterface}" == "on" ]; then
|
|
||||||
TITLE="Webinterface: http://${localip}:3000"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Put Activated Apps on top
|
|
||||||
if [ "${rtlWebinterface}" == "on" ]; then
|
|
||||||
OPTIONS+=(RTL "RTL Web Node Manager")
|
|
||||||
HEIGHT=$((HEIGHT+1))
|
|
||||||
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
|
|
||||||
fi
|
|
||||||
if [ "${BTCPayServer}" == "on" ]; then
|
|
||||||
OPTIONS+=(BTCPAY "BTCPay Server Info")
|
|
||||||
HEIGHT=$((HEIGHT+1))
|
|
||||||
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
|
|
||||||
fi
|
|
||||||
if [ "${lit}" == "on" ]; then
|
|
||||||
OPTIONS+=(LIT "LIT (loop, pool, faraday)")
|
|
||||||
HEIGHT=$((HEIGHT+1))
|
|
||||||
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
|
|
||||||
fi
|
|
||||||
if [ "${ElectRS}" == "on" ]; then
|
|
||||||
OPTIONS+=(ELECTRS "Electrum Rust Server")
|
|
||||||
HEIGHT=$((HEIGHT+1))
|
|
||||||
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
|
|
||||||
fi
|
|
||||||
if [ "${BTCRPCexplorer}" == "on" ]; then
|
|
||||||
OPTIONS+=(EXPLORE "BTC RPC Explorer")
|
|
||||||
HEIGHT=$((HEIGHT+1))
|
|
||||||
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
|
|
||||||
fi
|
|
||||||
if [ "${LNBits}" == "on" ]; then
|
|
||||||
OPTIONS+=(LNBITS "LNbits Server")
|
|
||||||
HEIGHT=$((HEIGHT+1))
|
|
||||||
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
|
|
||||||
fi
|
|
||||||
if [ "${lndmanage}" == "on" ]; then
|
|
||||||
OPTIONS+=(LNDMANAGE "LND Manage Script")
|
|
||||||
HEIGHT=$((HEIGHT+1))
|
|
||||||
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
|
|
||||||
fi
|
|
||||||
if [ "${loop}" == "on" ]; then
|
|
||||||
OPTIONS+=(LOOP "Loop In/Out Service")
|
|
||||||
HEIGHT=$((HEIGHT+1))
|
|
||||||
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
|
|
||||||
fi
|
|
||||||
if [ "${mempoolExplorer}" == "on" ]; then
|
|
||||||
OPTIONS+=(MEMPOOL "Mempool Space")
|
|
||||||
HEIGHT=$((HEIGHT+1))
|
|
||||||
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
|
|
||||||
fi
|
|
||||||
if [ "${specter}" == "on" ]; then
|
|
||||||
OPTIONS+=(SPECTER "Cryptoadvance Specter")
|
|
||||||
HEIGHT=$((HEIGHT+1))
|
|
||||||
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
|
|
||||||
fi
|
|
||||||
if [ "${joinmarket}" == "on" ]; then
|
|
||||||
OPTIONS+=(JMARKET "JoinMarket")
|
|
||||||
HEIGHT=$((HEIGHT+1))
|
|
||||||
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
|
|
||||||
fi
|
|
||||||
if [ "${faraday}" == "on" ]; then
|
|
||||||
OPTIONS+=(FARADAY "Faraday Channel Management")
|
|
||||||
HEIGHT=$((HEIGHT+1))
|
|
||||||
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
|
|
||||||
fi
|
|
||||||
if [ "${bos}" == "on" ]; then
|
|
||||||
OPTIONS+=(BOS "Balance of Satoshis")
|
|
||||||
HEIGHT=$((HEIGHT+1))
|
|
||||||
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
|
|
||||||
fi
|
|
||||||
if [ "${pyblock}" == "on" ]; then
|
|
||||||
OPTIONS+=(PYBLOCK "PyBlock")
|
|
||||||
HEIGHT=$((HEIGHT+1))
|
|
||||||
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
|
|
||||||
fi
|
|
||||||
if [ "${thunderhub}" == "on" ]; then
|
|
||||||
OPTIONS+=(THUB "ThunderHub")
|
|
||||||
HEIGHT=$((HEIGHT+1))
|
|
||||||
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
|
|
||||||
fi
|
|
||||||
if [ "${zerotier}" == "on" ]; then
|
|
||||||
OPTIONS+=(ZEROTIER "ZeroTier")
|
|
||||||
HEIGHT=$((HEIGHT+1))
|
|
||||||
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
|
|
||||||
fi
|
|
||||||
if [ "${pool}" == "on" ]; then
|
|
||||||
OPTIONS+=(POOL "Lightning Pool")
|
|
||||||
HEIGHT=$((HEIGHT+1))
|
|
||||||
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
|
|
||||||
fi
|
|
||||||
if [ "${sphinxrelay}" == "on" ]; then
|
|
||||||
OPTIONS+=(SPHINX "Sphinx Chat Relay")
|
|
||||||
HEIGHT=$((HEIGHT+1))
|
|
||||||
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
|
|
||||||
fi
|
|
||||||
if [ "${chantools}" == "on" ]; then
|
|
||||||
OPTIONS+=(CHANTOOLS "ChannelTools (Fund Rescue)")
|
|
||||||
HEIGHT=$((HEIGHT+1))
|
|
||||||
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
|
|
||||||
fi
|
|
||||||
if [ "${circuitbreaker}" == "on" ]; then
|
|
||||||
OPTIONS+=(CIRCUIT "Circuitbreaker (LND firewall)")
|
|
||||||
HEIGHT=$((HEIGHT+1))
|
|
||||||
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
|
|
||||||
fi
|
fi
|
||||||
|
BACKTITLE="${localip} / ${hostname} / ${network} ${plus}"
|
||||||
|
|
||||||
# Basic Options
|
# Basic Options
|
||||||
OPTIONS+=(INFO "RaspiBlitz Status Screen")
|
OPTIONS+=(INFO "RaspiBlitz Status Screen")
|
||||||
OPTIONS+=(LIGHTNING "LND Wallet Options")
|
|
||||||
|
# if LND is active
|
||||||
|
if [ "${lightning}" == "lnd" ] || [ "${lnd}" == "on" ]; then
|
||||||
|
OPTIONS+=(LND "LND Wallet Options")
|
||||||
|
fi
|
||||||
|
|
||||||
|
# if C-Lightning is active
|
||||||
|
if [ "${lightning}" == "cl" ] || [ "${cl}" == "on" ]; then
|
||||||
|
OPTIONS+=(CL "C-lightning Wallet Options")
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Activated Apps/Services
|
||||||
|
if [ "${rtlWebinterface}" == "on" ]; then
|
||||||
|
OPTIONS+=(LRTL "LND RTL Webinterface")
|
||||||
|
fi
|
||||||
|
if [ "${crtlWebinterface}" == "on" ]; then
|
||||||
|
OPTIONS+=(CRTL "C-Lightning RTL Webinterface")
|
||||||
|
fi
|
||||||
|
if [ "${BTCPayServer}" == "on" ]; then
|
||||||
|
OPTIONS+=(BTCPAY "BTCPay Server Info")
|
||||||
|
fi
|
||||||
|
if [ "${lit}" == "on" ]; then
|
||||||
|
OPTIONS+=(LIT "LIT (loop, pool, faraday)")
|
||||||
|
fi
|
||||||
|
if [ "${sparko}" == "on" ]; then
|
||||||
|
OPTIONS+=(SPARKO "Sparko Webwallet")
|
||||||
|
fi
|
||||||
|
if [ "${spark}" == "on" ]; then
|
||||||
|
OPTIONS+=(SPARK "Spark Wallet")
|
||||||
|
fi
|
||||||
|
if [ "${ElectRS}" == "on" ]; then
|
||||||
|
OPTIONS+=(ELECTRS "Electrum Rust Server")
|
||||||
|
fi
|
||||||
|
if [ "${BTCRPCexplorer}" == "on" ]; then
|
||||||
|
OPTIONS+=(EXPLORE "BTC RPC Explorer")
|
||||||
|
fi
|
||||||
|
if [ "${LNBits}" == "on" ]; then
|
||||||
|
OPTIONS+=(LNBITS "LNbits Server")
|
||||||
|
fi
|
||||||
|
if [ "${lndmanage}" == "on" ]; then
|
||||||
|
OPTIONS+=(LNDMANAGE "LND Manage Script")
|
||||||
|
fi
|
||||||
|
if [ "${loop}" == "on" ]; then
|
||||||
|
OPTIONS+=(LOOP "Loop In/Out Service")
|
||||||
|
fi
|
||||||
|
if [ "${mempoolExplorer}" == "on" ]; then
|
||||||
|
OPTIONS+=(MEMPOOL "Mempool Space")
|
||||||
|
fi
|
||||||
|
if [ "${specter}" == "on" ]; then
|
||||||
|
OPTIONS+=(SPECTER "Specter Desktop")
|
||||||
|
fi
|
||||||
|
if [ "${joinmarket}" == "on" ]; then
|
||||||
|
OPTIONS+=(JM "JoinMarket with JoininBox")
|
||||||
|
fi
|
||||||
|
if [ "${faraday}" == "on" ]; then
|
||||||
|
OPTIONS+=(FARADAY "Faraday Channel Management")
|
||||||
|
fi
|
||||||
|
if [ "${bos}" == "on" ]; then
|
||||||
|
OPTIONS+=(BOS "Balance of Satoshis")
|
||||||
|
fi
|
||||||
|
if [ "${pyblock}" == "on" ]; then
|
||||||
|
OPTIONS+=(PYBLOCK "PyBlock")
|
||||||
|
fi
|
||||||
|
if [ "${thunderhub}" == "on" ]; then
|
||||||
|
OPTIONS+=(THUB "ThunderHub")
|
||||||
|
fi
|
||||||
|
if [ "${zerotier}" == "on" ]; then
|
||||||
|
OPTIONS+=(ZEROTIER "ZeroTier")
|
||||||
|
fi
|
||||||
|
if [ "${pool}" == "on" ]; then
|
||||||
|
OPTIONS+=(POOL "Lightning Pool")
|
||||||
|
fi
|
||||||
|
if [ "${sphinxrelay}" == "on" ]; then
|
||||||
|
OPTIONS+=(SPHINX "Sphinx Chat Relay")
|
||||||
|
fi
|
||||||
|
if [ "${chantools}" == "on" ]; then
|
||||||
|
OPTIONS+=(CHANTOOLS "ChannelTools (Fund Rescue)")
|
||||||
|
fi
|
||||||
|
if [ "${circuitbreaker}" == "on" ]; then
|
||||||
|
OPTIONS+=(CIRCUIT "Circuitbreaker (LND firewall)")
|
||||||
|
fi
|
||||||
|
|
||||||
|
# dont offer to switch to "testnet view for now" - so no wswitch back to mainnet needed
|
||||||
|
#if [ ${chain} != "main" ]; then
|
||||||
|
# OPTIONS+=(MAINNET "Mainnet Service Options")
|
||||||
|
#fi
|
||||||
|
|
||||||
|
if [ "${testnet}" == "on" ]; then
|
||||||
|
OPTIONS+=(TESTNETS "Testnet/Signet Options")
|
||||||
|
fi
|
||||||
|
|
||||||
OPTIONS+=(SETTINGS "Node Settings & Options")
|
OPTIONS+=(SETTINGS "Node Settings & Options")
|
||||||
OPTIONS+=(SERVICES "Additional Apps & Services")
|
OPTIONS+=(SERVICES "Additional Apps & Services")
|
||||||
OPTIONS+=(SYSTEM "Monitoring & Configuration")
|
OPTIONS+=(SYSTEM "Monitoring & Configuration")
|
||||||
OPTIONS+=(CONNECT "Connect Apps & Show Credentials")
|
OPTIONS+=(CONNECT "Connect Apps & Show Credentials")
|
||||||
OPTIONS+=(SUBSCRIBE "Manage Subscriptions")
|
if [ "${lightning}" == "lnd" ] || [ "${lnd}" == "on" ]; then
|
||||||
|
OPTIONS+=(SUBSCRIBE "Manage Subscriptions")
|
||||||
|
fi
|
||||||
OPTIONS+=(PASSWORD "Change Passwords")
|
OPTIONS+=(PASSWORD "Change Passwords")
|
||||||
|
|
||||||
if [ "${touchscreen}" == "1" ]; then
|
if [ "${touchscreen}" == "1" ]; then
|
||||||
OPTIONS+=(SCREEN "Touchscreen Calibration")
|
OPTIONS+=(SCREEN "Touchscreen Calibration")
|
||||||
HEIGHT=$((HEIGHT+1))
|
|
||||||
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# final Options
|
# final Options
|
||||||
|
@ -185,6 +178,8 @@ OPTIONS+=(UPDATE "Check/Prepare RaspiBlitz Update")
|
||||||
OPTIONS+=(REBOOT "Reboot RaspiBlitz")
|
OPTIONS+=(REBOOT "Reboot RaspiBlitz")
|
||||||
OPTIONS+=(OFF "PowerOff RaspiBlitz")
|
OPTIONS+=(OFF "PowerOff RaspiBlitz")
|
||||||
|
|
||||||
|
CHOICE_HEIGHT=$(("${#OPTIONS[@]}/2+1"))
|
||||||
|
HEIGHT=$((CHOICE_HEIGHT+6))
|
||||||
CHOICE=$(dialog --clear \
|
CHOICE=$(dialog --clear \
|
||||||
--backtitle "$BACKTITLE" \
|
--backtitle "$BACKTITLE" \
|
||||||
--title "$TITLE" \
|
--title "$TITLE" \
|
||||||
|
@ -198,49 +193,48 @@ CHOICE=$(dialog --clear \
|
||||||
case $CHOICE in
|
case $CHOICE in
|
||||||
INFO)
|
INFO)
|
||||||
echo "Gathering Information (please wait) ..."
|
echo "Gathering Information (please wait) ..."
|
||||||
walletLocked=$(lncli getinfo 2>&1 | grep -c "Wallet is encrypted")
|
while :
|
||||||
if [ ${walletLocked} -eq 0 ]; then
|
do
|
||||||
while :
|
|
||||||
do
|
|
||||||
|
|
||||||
# show the same info as on LCD screen
|
# show the same info as on LCD screen
|
||||||
/home/admin/00infoBlitz.sh
|
/home/admin/00infoBlitz.sh ${lightning} ${chain}net
|
||||||
|
|
||||||
# wait 6 seconds for user exiting loop
|
# wait 6 seconds for user exiting loop
|
||||||
|
echo ""
|
||||||
|
echo -en "Screen is updating in a loop .... press 'x' now to get back to menu."
|
||||||
|
read -n 1 -t 6 keyPressed
|
||||||
|
echo -en "\rGathering information to update info ... please wait. \n"
|
||||||
|
|
||||||
|
# check if user wants to abort session
|
||||||
|
if [ "${keyPressed}" = "x" ]; then
|
||||||
echo ""
|
echo ""
|
||||||
echo -en "Screen is updating in a loop .... press 'x' now to get back to menu."
|
echo "Returning to menu ....."
|
||||||
read -n 1 -t 6 keyPressed
|
sleep 4
|
||||||
echo -en "\rGathering information to update info ... please wait. \n"
|
break
|
||||||
|
fi
|
||||||
# check if user wants to abort session
|
done
|
||||||
if [ "${keyPressed}" = "x" ]; then
|
|
||||||
echo ""
|
|
||||||
echo "Returning to menu ....."
|
|
||||||
sleep 4
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
else
|
|
||||||
/home/admin/00raspiblitz.sh
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
LIGHTNING)
|
LND)
|
||||||
/home/admin/99lightningMenu.sh
|
/home/admin/99lndMenu.sh
|
||||||
|
;;
|
||||||
|
CL)
|
||||||
|
/home/admin/99clMenu.sh ${chain}net
|
||||||
;;
|
;;
|
||||||
CONNECT)
|
CONNECT)
|
||||||
/home/admin/99connectMenu.sh
|
/home/admin/99connectMenu.sh
|
||||||
;;
|
;;
|
||||||
SYSTEM)
|
SYSTEM)
|
||||||
/home/admin/99systemMenu.sh
|
/home/admin/99systemMenu.sh ${chain}net
|
||||||
;;
|
;;
|
||||||
SCREEN)
|
SCREEN)
|
||||||
dialog --title 'Touchscreen Calibration' --msgbox 'Choose OK and then follow the instructions on touchscreen for calibration.\n\nBest is to use a stylus for accurate touchscreen interaction.' 9 48
|
dialog --title 'Touchscreen Calibration' --msgbox 'Choose OK and then follow the instructions on touchscreen for calibration.\n\nBest is to use a stylus for accurate touchscreen interaction.' 9 48
|
||||||
/home/admin/config.scripts/blitz.touchscreen.sh calibrate
|
/home/admin/config.scripts/blitz.touchscreen.sh calibrate
|
||||||
;;
|
;;
|
||||||
RTL)
|
LRTL)
|
||||||
/home/admin/config.scripts/bonus.rtl.sh menu
|
/home/admin/config.scripts/bonus.rtl.sh menu lnd mainnet
|
||||||
|
;;
|
||||||
|
CRTL)
|
||||||
|
/home/admin/config.scripts/bonus.rtl.sh menu cl mainnet
|
||||||
;;
|
;;
|
||||||
BTCPAY)
|
BTCPAY)
|
||||||
/home/admin/config.scripts/bonus.btcpayserver.sh menu
|
/home/admin/config.scripts/bonus.btcpayserver.sh menu
|
||||||
|
@ -254,6 +248,12 @@ case $CHOICE in
|
||||||
LIT)
|
LIT)
|
||||||
/home/admin/config.scripts/bonus.lit.sh menu
|
/home/admin/config.scripts/bonus.lit.sh menu
|
||||||
;;
|
;;
|
||||||
|
SPARKO)
|
||||||
|
/home/admin/config.scripts/cl-plugin.sparko.sh menu mainnet
|
||||||
|
;;
|
||||||
|
SPARK)
|
||||||
|
/home/admin/config.scripts/cl.spark.sh menu mainnet
|
||||||
|
;;
|
||||||
LNBITS)
|
LNBITS)
|
||||||
/home/admin/config.scripts/bonus.lnbits.sh menu
|
/home/admin/config.scripts/bonus.lnbits.sh menu
|
||||||
;;
|
;;
|
||||||
|
@ -267,9 +267,9 @@ case $CHOICE in
|
||||||
/home/admin/config.scripts/bonus.mempool.sh menu
|
/home/admin/config.scripts/bonus.mempool.sh menu
|
||||||
;;
|
;;
|
||||||
SPECTER)
|
SPECTER)
|
||||||
/home/admin/config.scripts/bonus.cryptoadvance-specter.sh menu
|
/home/admin/config.scripts/bonus.specter.sh menu
|
||||||
;;
|
;;
|
||||||
JMARKET)
|
JM)
|
||||||
sudo /home/admin/config.scripts/bonus.joinmarket.sh menu
|
sudo /home/admin/config.scripts/bonus.joinmarket.sh menu
|
||||||
;;
|
;;
|
||||||
FARADAY)
|
FARADAY)
|
||||||
|
@ -298,7 +298,10 @@ case $CHOICE in
|
||||||
;;
|
;;
|
||||||
CIRCUIT)
|
CIRCUIT)
|
||||||
sudo /home/admin/config.scripts/bonus.circuitbreaker.sh menu
|
sudo /home/admin/config.scripts/bonus.circuitbreaker.sh menu
|
||||||
;;
|
;;
|
||||||
|
TESTNETS)
|
||||||
|
/home/admin/00parallelChainsMenu.sh
|
||||||
|
;;
|
||||||
SUBSCRIBE)
|
SUBSCRIBE)
|
||||||
/home/admin/config.scripts/blitz.subscriptions.py
|
/home/admin/config.scripts/blitz.subscriptions.py
|
||||||
;;
|
;;
|
||||||
|
@ -310,9 +313,6 @@ 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
|
||||||
|
@ -321,44 +321,41 @@ case $CHOICE in
|
||||||
/home/admin/99updateMenu.sh
|
/home/admin/99updateMenu.sh
|
||||||
;;
|
;;
|
||||||
REBOOT)
|
REBOOT)
|
||||||
clear
|
clear
|
||||||
confirmation "Are you sure?" "Reboot" "Cancel" true 7 40
|
confirmation "Are you sure?" "Reboot" "Cancel" true 7 40
|
||||||
confirmationReboot=$?
|
confirmationReboot=$?
|
||||||
if [ $confirmationReboot -eq 0 ]; then
|
if [ $confirmationReboot -eq 0 ]; then
|
||||||
clear
|
clear
|
||||||
echo ""
|
echo ""
|
||||||
sudo /home/admin/XXshutdown.sh reboot
|
sudo /home/admin/config.scripts/blitz.shutdown.sh reboot
|
||||||
exit 0
|
exit 1
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
OFF)
|
OFF)
|
||||||
clear
|
clear
|
||||||
confirmation "Are you sure?" "PowerOff" "Cancel" true 7 40
|
confirmation "Are you sure?" "PowerOff" "Cancel" true 7 40
|
||||||
confirmationShutdown=$?
|
confirmationShutdown=$?
|
||||||
if [ $confirmationShutdown -eq 0 ]; then
|
if [ $confirmationShutdown -eq 0 ]; then
|
||||||
clear
|
clear
|
||||||
echo ""
|
echo ""
|
||||||
sudo /home/admin/XXshutdown.sh
|
sudo /home/admin/config.scripts/blitz.shutdown.sh
|
||||||
exit 0
|
exit 1
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
DELETE)
|
DELETE)
|
||||||
sudo /home/admin/XXcleanHDD.sh
|
sudo /home/admin/XXcleanHDD.sh
|
||||||
sudo /home/admin/XXshutdown.sh reboot
|
sudo /home/admin/config.scripts/blitz.shutdown.sh reboot
|
||||||
exit 0
|
exit 1
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
clear
|
clear
|
||||||
echo "***********************************"
|
exit 1
|
||||||
echo "* RaspiBlitz Commandline"
|
|
||||||
echo "* Here be dragons .. have fun :)"
|
|
||||||
echo "***********************************"
|
|
||||||
echo "Bitcoin command line options: bitcoin-cli help"
|
|
||||||
echo "LND command line options: lncli -h"
|
|
||||||
echo "Back to main menu use command: raspiblitz"
|
|
||||||
echo
|
|
||||||
exit 0
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# go into loop - start script from beginning to load config/sate fresh
|
# forward exit code of submenu to outside loop
|
||||||
/home/admin/00mainMenu.sh
|
# 0 = continue loop / everything else = break loop and exit to terminal
|
||||||
|
exitCodeOfSubmenu=$?
|
||||||
|
if [ "${exitCodeOfSubmenu}" != "0" ]; then
|
||||||
|
echo "# submenu signaled exit code '${exitCodeOfSubmenu}' --> forward to outside loop"
|
||||||
|
fi
|
||||||
|
exit ${exitCodeOfSubmenu}
|
72
home.admin/00parallelChainsMenu.sh
Normal file
72
home.admin/00parallelChainsMenu.sh
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# For now just list all testnet/signet options available
|
||||||
|
# injecting specific perspectives can be done later
|
||||||
|
|
||||||
|
source /home/admin/raspiblitz.info
|
||||||
|
source /mnt/hdd/raspiblitz.conf
|
||||||
|
|
||||||
|
# get the local network IP to be displayed on the LCD
|
||||||
|
source <(/home/admin/config.scripts/internet.sh status local)
|
||||||
|
|
||||||
|
# BASIC MENU INFO
|
||||||
|
WIDTH=64
|
||||||
|
BACKTITLE="RaspiBlitz"
|
||||||
|
TITLE=" Testnet/Signet Options "
|
||||||
|
MENU="Choose one of the following options:"
|
||||||
|
OPTIONS=()
|
||||||
|
plus=""
|
||||||
|
|
||||||
|
if [ "${testnet}" == "on" ]; then
|
||||||
|
OPTIONS+=(tSYS "TESTNET Monitoring & Configuration")
|
||||||
|
if [ "${lightning}" == "lnd" ] || [ "${lnd}" == "on" ]; then OPTIONS+=(tLND "TESTNET LND Wallet Options"); fi
|
||||||
|
if [ "${lightning}" == "cl" ] || [ "${cl}" == "on" ]; then OPTIONS+=(tCL "TESTNET C-Lightning Wallet Options"); fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# just an optical splitter - ignored on select
|
||||||
|
OPTIONS+=(--- "----------------------------------")
|
||||||
|
|
||||||
|
if [ "${signet}" == "on" ]; then
|
||||||
|
OPTIONS+=(sSYS "SIGNET Monitoring & Configuration")
|
||||||
|
if [ "${lightning}" == "cl" ] || [ "${cl}" == "on" ]; then OPTIONS+=(sCL "SIGNET C-Lightning Wallet Options"); fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# DONT OFFER SERVICES FOR TESTNET RIGHT NOW
|
||||||
|
# OPTIONS+=(RTL "RTL Web Node Manager for LND ${CHAIN}")
|
||||||
|
# OPTIONS+=(SERVICES "Additional Apps & Services on ${CHAIN}")
|
||||||
|
|
||||||
|
# MAYBE LATER
|
||||||
|
# OPTIONS+=(CONNECT "Connect Apps & Show Credentials")
|
||||||
|
|
||||||
|
CHOICE_HEIGHT=$(("${#OPTIONS[@]}/2+1"))
|
||||||
|
HEIGHT=$((CHOICE_HEIGHT+6))
|
||||||
|
CHOICE=$(dialog --clear \
|
||||||
|
--backtitle "$BACKTITLE" \
|
||||||
|
--title "$TITLE" \
|
||||||
|
--ok-label "Select" \
|
||||||
|
--cancel-label "Back" \
|
||||||
|
--menu "$MENU" \
|
||||||
|
$HEIGHT $WIDTH $CHOICE_HEIGHT \
|
||||||
|
"${OPTIONS[@]}" \
|
||||||
|
2>&1 >/dev/tty)
|
||||||
|
|
||||||
|
case $CHOICE in
|
||||||
|
tSYS)
|
||||||
|
/home/admin/99systemMenu.sh testnet
|
||||||
|
;;
|
||||||
|
sSYS)
|
||||||
|
/home/admin/99systemMenu.sh signet
|
||||||
|
;;
|
||||||
|
tLND)
|
||||||
|
/home/admin/99lndMenu.sh testnet
|
||||||
|
;;
|
||||||
|
sLND)
|
||||||
|
/home/admin/99lndMenu.sh signet
|
||||||
|
;;
|
||||||
|
tCL)
|
||||||
|
/home/admin/99clMenu.sh testnet
|
||||||
|
;;
|
||||||
|
sCL)
|
||||||
|
/home/admin/99clMenu.sh signet
|
||||||
|
;;
|
||||||
|
esac
|
203
home.admin/00parallelMainnetServices.sh
Normal file
203
home.admin/00parallelMainnetServices.sh
Normal file
|
@ -0,0 +1,203 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# get raspiblitz config
|
||||||
|
echo "get raspiblitz config"
|
||||||
|
source /home/admin/raspiblitz.info
|
||||||
|
source /mnt/hdd/raspiblitz.conf
|
||||||
|
|
||||||
|
CHAIN=mainnet
|
||||||
|
|
||||||
|
# for testnet
|
||||||
|
echo "services default values"
|
||||||
|
if [ ${#rtlWebinterface} -eq 0 ]; then rtlWebinterface="off"; fi
|
||||||
|
if [ ${#lnd} -eq 0 ]; then lnd="off"; fi
|
||||||
|
if [ ${#cl} -eq 0 ]; then cl="off"; fi
|
||||||
|
if [ ${#crtlWebinterface} -eq 0 ]; then crtlWebinterface="off"; fi
|
||||||
|
if [ ${#sparko} -eq 0 ]; then sparko="off"; fi
|
||||||
|
if [ ${#spark} -eq 0 ]; then spark="off"; fi
|
||||||
|
|
||||||
|
# show select dialog
|
||||||
|
echo "run dialog ..."
|
||||||
|
|
||||||
|
OPTIONS=()
|
||||||
|
OPTIONS+=(l "LND on $CHAIN" ${lnd})
|
||||||
|
OPTIONS+=(r "RTL for LND $CHAIN" ${rtlWebinterface})
|
||||||
|
OPTIONS+=(c "C-lightning on $CHAIN" ${cl})
|
||||||
|
OPTIONS+=(t "RTL for CL on $CHAIN" ${crtlWebinterface})
|
||||||
|
OPTIONS+=(s "Sparko for CL on $CHAIN" ${sparko})
|
||||||
|
OPTIONS+=(m "Spark for CL on $CHAIN" ${spark})
|
||||||
|
|
||||||
|
CHOICES=$(dialog --title ' Additional Services ' \
|
||||||
|
--checklist ' use spacebar to activate/de-activate ' \
|
||||||
|
12 45 5 "${OPTIONS[@]}" 2>&1 >/dev/tty)
|
||||||
|
|
||||||
|
dialogcancel=$?
|
||||||
|
echo "done dialog"
|
||||||
|
clear
|
||||||
|
|
||||||
|
# check if user canceled dialog
|
||||||
|
echo "dialogcancel(${dialogcancel})"
|
||||||
|
if [ ${dialogcancel} -eq 1 ]; then
|
||||||
|
echo "user canceled"
|
||||||
|
exit 0
|
||||||
|
elif [ ${dialogcancel} -eq 255 ]; then
|
||||||
|
echo "ESC pressed"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
needsReboot=0
|
||||||
|
anychange=0
|
||||||
|
|
||||||
|
# lnd process choice
|
||||||
|
choice="off"; check=$(echo "${CHOICES}" | grep -c "l")
|
||||||
|
if [ ${check} -eq 1 ]; then choice="on"; fi
|
||||||
|
if [ "${lnd}" != "${choice}" ]; then
|
||||||
|
echo "# LND on $CHAIN Setting changed .."
|
||||||
|
anychange=1
|
||||||
|
/home/admin/config.scripts/lnd.install.sh ${choice} $CHAIN
|
||||||
|
errorOnInstall=$?
|
||||||
|
if [ "${choice}" = "on" ]; then
|
||||||
|
if [ ${errorOnInstall} -eq 0 ]; then
|
||||||
|
echo "# Successfully installed LND on $CHAIN"
|
||||||
|
else
|
||||||
|
l1="# !!! FAIL on LND on $CHAIN install !!!"
|
||||||
|
l2="# Try manual install on terminal after reboot with:"
|
||||||
|
l3="/home/admin/config.scripts/lnd.install.sh on $CHAIN"
|
||||||
|
dialog --title 'FAIL' --msgbox "${l1}\n${l2}\n${l3}" 7 65
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "# LND on $CHAIN Setting unchanged."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# cl process choice
|
||||||
|
choice="off"; check=$(echo "${CHOICES}" | grep -c "c")
|
||||||
|
if [ ${check} -eq 1 ]; then choice="on"; fi
|
||||||
|
if [ "${cl}" != "${choice}" ]; then
|
||||||
|
echo "# CL on $CHAIN Setting changed .."
|
||||||
|
anychange=1
|
||||||
|
/home/admin/config.scripts/cl.install.sh ${choice} $CHAIN
|
||||||
|
errorOnInstall=$?
|
||||||
|
if [ "${choice}" = "on" ]; then
|
||||||
|
if [ ${errorOnInstall} -eq 0 ]; then
|
||||||
|
echo "# Successfully installed CL on $CHAIN"
|
||||||
|
else
|
||||||
|
l1="# !!! FAIL on CL on $CHAIN install !!!"
|
||||||
|
l2="# Try manual install on terminal after reboot with:"
|
||||||
|
l3="/home/admin/config.scripts/cl.install.sh on $CHAIN"
|
||||||
|
dialog --title 'FAIL' --msgbox "${l1}\n${l2}\n${l3}" 7 65
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "# CL on $CHAIN Setting unchanged."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# RTL process choice
|
||||||
|
choice="off"; check=$(echo "${CHOICES}" | grep -c "r")
|
||||||
|
if [ ${check} -eq 1 ]; then choice="on"; fi
|
||||||
|
if [ "${rtlWebinterface}" != "${choice}" ]; then
|
||||||
|
echo "# RTL for LND $CHAIN Setting changed .."
|
||||||
|
anychange=1
|
||||||
|
/home/admin/config.scripts/bonus.rtl.sh ${choice} lnd $CHAIN
|
||||||
|
errorOnInstall=$?
|
||||||
|
if [ "${choice}" = "on" ]; then
|
||||||
|
if [ ${errorOnInstall} -eq 0 ]; then
|
||||||
|
sudo systemctl start RTL
|
||||||
|
echo "# waiting 10 secs .."
|
||||||
|
sleep 10
|
||||||
|
/home/admin/config.scripts/bonus.rtl.sh menu lnd $CHAIN
|
||||||
|
else
|
||||||
|
l1="# !!! FAIL on RTL for LND $CHAIN install !!!"
|
||||||
|
l2="# Try manual install on terminal after reboot with:"
|
||||||
|
l3="/home/admin/config.scripts/bonus.rtl.sh on lnd $CHAIN"
|
||||||
|
dialog --title 'FAIL' --msgbox "${l1}\n${l2}\n${l3}" 7 65
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "# RTL for LND $CHAIN Setting unchanged."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# cRTL process choice
|
||||||
|
choice="off"; check=$(echo "${CHOICES}" | grep -c "t")
|
||||||
|
if [ ${check} -eq 1 ]; then choice="on"; fi
|
||||||
|
if [ "${crtlWebinterface}" != "${choice}" ]; then
|
||||||
|
echo "RTL for CL $CHAIN Setting changed .."
|
||||||
|
anychange=1
|
||||||
|
/home/admin/config.scripts/bonus.rtl.sh ${choice} cl $CHAIN
|
||||||
|
errorOnInstall=$?
|
||||||
|
if [ "${choice}" = "on" ]; then
|
||||||
|
if [ ${errorOnInstall} -eq 0 ]; then
|
||||||
|
sudo systemctl start cRTL
|
||||||
|
echo "waiting 10 secs .."
|
||||||
|
sleep 10
|
||||||
|
/home/admin/config.scripts/bonus.rtl.sh menu cl $CHAIN
|
||||||
|
else
|
||||||
|
l1="!!! FAIL on RTL for CL $CHAIN install !!!"
|
||||||
|
l2="Try manual install on terminal after reboot with:"
|
||||||
|
l3="/home/admin/config.scripts/bonus.rtl.sh on cl $CHAIN"
|
||||||
|
dialog --title 'FAIL' --msgbox "${l1}\n${l2}\n${l3}" 7 65
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "RTL for CL $CHAIN Setting unchanged."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# sparko process choice
|
||||||
|
choice="off"; check=$(echo "${CHOICES}" | grep -c "s")
|
||||||
|
if [ ${check} -eq 1 ]; then choice="on"; fi
|
||||||
|
if [ "${sparko}" != "${choice}" ]; then
|
||||||
|
echo "# Sparko on $CHAIN Setting changed .."
|
||||||
|
anychange=1
|
||||||
|
/home/admin/config.scripts/cl-plugin.sparko.sh ${choice} $CHAIN
|
||||||
|
errorOnInstall=$?
|
||||||
|
if [ "${choice}" = "on" ]; then
|
||||||
|
if [ ${errorOnInstall} -eq 0 ]; then
|
||||||
|
/home/admin/config.scripts/cl-plugin.sparko.sh menu $CHAIN
|
||||||
|
else
|
||||||
|
l1="# !!! FAIL on Sparko on $CHAIN install !!!"
|
||||||
|
l2="# Try manual install on terminal after reboot with:"
|
||||||
|
l3="/home/admin/config.scripts/cl-plugin.sparko.sh on $CHAIN"
|
||||||
|
dialog --title 'FAIL' --msgbox "${l1}\n${l2}\n${l3}" 7 65
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "# Sparko on $CHAIN Setting unchanged."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# spark process choice
|
||||||
|
choice="off"; check=$(echo "${CHOICES}" | grep -c "m")
|
||||||
|
if [ ${check} -eq 1 ]; then choice="on"; fi
|
||||||
|
if [ "${spark}" != "${choice}" ]; then
|
||||||
|
echo "# Spark Wallet on $CHAIN Setting changed .."
|
||||||
|
anychange=1
|
||||||
|
/home/admin/config.scripts/cl.spark.sh ${choice} $CHAIN
|
||||||
|
errorOnInstall=$?
|
||||||
|
if [ "${choice}" = "on" ]; then
|
||||||
|
if [ ${errorOnInstall} -eq 0 ]; then
|
||||||
|
/home/admin/config.scripts/cl.spark.sh menu $CHAIN
|
||||||
|
else
|
||||||
|
l1="# !!! FAIL on Spark Wallet on $CHAIN install !!!"
|
||||||
|
l2="# Try manual install on terminal after reboot with:"
|
||||||
|
l3="/home/admin/config.scripts/cl.spark.sh on $CHAIN"
|
||||||
|
dialog --title 'FAIL' --msgbox "${l1}\n${l2}\n${l3}" 7 65
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "# Spark Wallet on $CHAIN Setting unchanged."
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ${anychange} -eq 0 ]; then
|
||||||
|
dialog --msgbox "NOTHING CHANGED!\nUse Spacebar to check/uncheck services." 8 58
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ${needsReboot} -eq 1 ]; then
|
||||||
|
sleep 2
|
||||||
|
dialog --pause "OK. System will reboot to activate changes." 8 58 8
|
||||||
|
clear
|
||||||
|
echo "rebooting .. (please wait)"
|
||||||
|
# stop bitcoind
|
||||||
|
sudo -u bitcoin ${network}-cli stop
|
||||||
|
sleep 4
|
||||||
|
sudo /home/admin/config.scripts/blitz.shutdown.sh reboot
|
||||||
|
fi
|
203
home.admin/00parallelTestnetServices.sh
Normal file
203
home.admin/00parallelTestnetServices.sh
Normal file
|
@ -0,0 +1,203 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# get raspiblitz config
|
||||||
|
echo "get raspiblitz config"
|
||||||
|
source /home/admin/raspiblitz.info
|
||||||
|
source /mnt/hdd/raspiblitz.conf
|
||||||
|
|
||||||
|
CHAIN=testnet
|
||||||
|
|
||||||
|
# for testnet
|
||||||
|
echo "services default values"
|
||||||
|
if [ ${#trtlWebinterface} -eq 0 ]; then trtlWebinterface="off"; fi
|
||||||
|
if [ ${#tlnd} -eq 0 ]; then tlnd="off"; fi
|
||||||
|
if [ ${#tcrtlWebinterface} -eq 0 ]; then tcrtlWebinterface="off"; fi
|
||||||
|
if [ ${#tcl} -eq 0 ]; then tcl="off"; fi
|
||||||
|
if [ ${#tsparko} -eq 0 ]; then tsparko="off"; fi
|
||||||
|
if [ ${#tspark} -eq 0 ]; then tspark="off"; fi
|
||||||
|
|
||||||
|
# show select dialog
|
||||||
|
echo "run dialog ..."
|
||||||
|
|
||||||
|
OPTIONS=()
|
||||||
|
OPTIONS+=(l "LND on $CHAIN" ${tlnd})
|
||||||
|
OPTIONS+=(r "RTL for LND $CHAIN" ${trtlWebinterface})
|
||||||
|
OPTIONS+=(c "C-lightning on $CHAIN" ${tcl})
|
||||||
|
OPTIONS+=(t "RTL for CL on $CHAIN" ${tcrtlWebinterface})
|
||||||
|
OPTIONS+=(s "Sparko for CL on $CHAIN" ${tsparko})
|
||||||
|
OPTIONS+=(m "Spark Wallet fro CL on $CHAIN" ${tspark})
|
||||||
|
|
||||||
|
CHOICES=$(dialog --title ' Additional Services ' \
|
||||||
|
--checklist ' use spacebar to activate/de-activate ' \
|
||||||
|
12 45 5 "${OPTIONS[@]}" 2>&1 >/dev/tty)
|
||||||
|
|
||||||
|
dialogcancel=$?
|
||||||
|
echo "done dialog"
|
||||||
|
clear
|
||||||
|
|
||||||
|
# check if user canceled dialog
|
||||||
|
echo "dialogcancel(${dialogcancel})"
|
||||||
|
if [ ${dialogcancel} -eq 1 ]; then
|
||||||
|
echo "user canceled"
|
||||||
|
exit 0
|
||||||
|
elif [ ${dialogcancel} -eq 255 ]; then
|
||||||
|
echo "ESC pressed"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
needsReboot=0
|
||||||
|
anychange=0
|
||||||
|
|
||||||
|
# tlnd process choice
|
||||||
|
choice="off"; check=$(echo "${CHOICES}" | grep -c "l")
|
||||||
|
if [ ${check} -eq 1 ]; then choice="on"; fi
|
||||||
|
if [ "${tlnd}" != "${choice}" ]; then
|
||||||
|
echo "# LND on $CHAIN Setting changed .."
|
||||||
|
anychange=1
|
||||||
|
/home/admin/config.scripts/lnd.install.sh ${choice} $CHAIN
|
||||||
|
errorOnInstall=$?
|
||||||
|
if [ "${choice}" = "on" ]; then
|
||||||
|
if [ ${errorOnInstall} -eq 0 ]; then
|
||||||
|
echo "# Successfully installed LND on $CHAIN"
|
||||||
|
else
|
||||||
|
l1="# !!! FAIL on LND on $CHAIN install !!!"
|
||||||
|
l2="# Try manual install on terminal after reboot with:"
|
||||||
|
l3="/home/admin/config.scripts/lnd.install.sh on $CHAIN"
|
||||||
|
dialog --title 'FAIL' --msgbox "${l1}\n${l2}\n${l3}" 7 65
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "# LND on $CHAIN Setting unchanged."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# tcl process choice
|
||||||
|
choice="off"; check=$(echo "${CHOICES}" | grep -c "c")
|
||||||
|
if [ ${check} -eq 1 ]; then choice="on"; fi
|
||||||
|
if [ "${tcl}" != "${choice}" ]; then
|
||||||
|
echo "# CL on $CHAIN Setting changed .."
|
||||||
|
anychange=1
|
||||||
|
/home/admin/config.scripts/cl.install.sh ${choice} $CHAIN
|
||||||
|
errorOnInstall=$?
|
||||||
|
if [ "${choice}" = "on" ]; then
|
||||||
|
if [ ${errorOnInstall} -eq 0 ]; then
|
||||||
|
echo "# Successfully installed CL on $CHAIN"
|
||||||
|
else
|
||||||
|
l1="# !!! FAIL on CL on $CHAIN install !!!"
|
||||||
|
l2="# Try manual install on terminal after reboot with:"
|
||||||
|
l3="/home/admin/config.scripts/cl.install.sh on $CHAIN"
|
||||||
|
dialog --title 'FAIL' --msgbox "${l1}\n${l2}\n${l3}" 7 65
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "# CL on $CHAIN Setting unchanged."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# tRTL process choice
|
||||||
|
choice="off"; check=$(echo "${CHOICES}" | grep -c "r")
|
||||||
|
if [ ${check} -eq 1 ]; then choice="on"; fi
|
||||||
|
if [ "${trtlWebinterface}" != "${choice}" ]; then
|
||||||
|
echo "# RTL for LND $CHAIN Setting changed .."
|
||||||
|
anychange=1
|
||||||
|
/home/admin/config.scripts/bonus.rtl.sh ${choice} lnd $CHAIN
|
||||||
|
errorOnInstall=$?
|
||||||
|
if [ "${choice}" = "on" ]; then
|
||||||
|
if [ ${errorOnInstall} -eq 0 ]; then
|
||||||
|
sudo systemctl start tRTL
|
||||||
|
echo "# waiting 10 secs .."
|
||||||
|
sleep 10
|
||||||
|
/home/admin/config.scripts/bonus.rtl.sh menu lnd $CHAIN
|
||||||
|
else
|
||||||
|
l1="# !!! FAIL on RTL for LND $CHAIN install !!!"
|
||||||
|
l2="# Try manual install on terminal after reboot with:"
|
||||||
|
l3="/home/admin/config.scripts/bonus.rtl.sh on lnd $CHAIN"
|
||||||
|
dialog --title 'FAIL' --msgbox "${l1}\n${l2}\n${l3}" 7 65
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "# RTL for LND $CHAIN Setting unchanged."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# ctRTL process choice
|
||||||
|
choice="off"; check=$(echo "${CHOICES}" | grep -c "t")
|
||||||
|
if [ ${check} -eq 1 ]; then choice="on"; fi
|
||||||
|
if [ "${tcrtlWebinterface}" != "${choice}" ]; then
|
||||||
|
echo "RTL for CL $CHAIN Setting changed .."
|
||||||
|
anychange=1
|
||||||
|
/home/admin/config.scripts/bonus.rtl.sh ${choice} cl $CHAIN
|
||||||
|
errorOnInstall=$?
|
||||||
|
if [ "${choice}" = "on" ]; then
|
||||||
|
if [ ${errorOnInstall} -eq 0 ]; then
|
||||||
|
sudo systemctl start tcRTL
|
||||||
|
echo "waiting 10 secs .."
|
||||||
|
sleep 10
|
||||||
|
/home/admin/config.scripts/bonus.rtl.sh menu cl $CHAIN
|
||||||
|
else
|
||||||
|
l1="!!! FAIL on RTL for CL $CHAIN install !!!"
|
||||||
|
l2="Try manual install on terminal after reboot with:"
|
||||||
|
l3="/home/admin/config.scripts/bonus.rtl.sh on cl $CHAIN"
|
||||||
|
dialog --title 'FAIL' --msgbox "${l1}\n${l2}\n${l3}" 7 65
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "RTL for CL $CHAIN Setting unchanged."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# tsparko process choice
|
||||||
|
choice="off"; check=$(echo "${CHOICES}" | grep -c "s")
|
||||||
|
if [ ${check} -eq 1 ]; then choice="on"; fi
|
||||||
|
if [ "${tsparko}" != "${choice}" ]; then
|
||||||
|
echo "# Sparko on $CHAIN Setting changed .."
|
||||||
|
anychange=1
|
||||||
|
/home/admin/config.scripts/cl-plugin.sparko.sh ${choice} $CHAIN
|
||||||
|
errorOnInstall=$?
|
||||||
|
if [ "${choice}" = "on" ]; then
|
||||||
|
if [ ${errorOnInstall} -eq 0 ]; then
|
||||||
|
/home/admin/config.scripts/cl-plugin.sparko.sh menu $CHAIN
|
||||||
|
else
|
||||||
|
l1="# !!! FAIL on Sparko on $CHAIN install !!!"
|
||||||
|
l2="# Try manual install on terminal after reboot with:"
|
||||||
|
l3="/home/admin/config.scripts/cl-plugin.sparko.sh on $CHAIN"
|
||||||
|
dialog --title 'FAIL' --msgbox "${l1}\n${l2}\n${l3}" 7 65
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "# Sparko on $CHAIN Setting unchanged."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# tspark process choice
|
||||||
|
choice="off"; check=$(echo "${CHOICES}" | grep -c "m")
|
||||||
|
if [ ${check} -eq 1 ]; then choice="on"; fi
|
||||||
|
if [ "${tspark}" != "${choice}" ]; then
|
||||||
|
echo "# Spark Wallet on $CHAIN Setting changed .."
|
||||||
|
anychange=1
|
||||||
|
/home/admin/config.scripts/cl.spark.sh ${choice} $CHAIN
|
||||||
|
errorOnInstall=$?
|
||||||
|
if [ "${choice}" = "on" ]; then
|
||||||
|
if [ ${errorOnInstall} -eq 0 ]; then
|
||||||
|
/home/admin/config.scripts/cl.spark.sh menu $CHAIN
|
||||||
|
else
|
||||||
|
l1="# !!! FAIL on Spark Wallet on $CHAIN install !!!"
|
||||||
|
l2="# Try manual install on terminal after reboot with:"
|
||||||
|
l3="/home/admin/config.scripts/cl.spark.sh on $CHAIN"
|
||||||
|
dialog --title 'FAIL' --msgbox "${l1}\n${l2}\n${l3}" 7 65
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "# Spark Wallet on $CHAIN Setting unchanged."
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ${anychange} -eq 0 ]; then
|
||||||
|
dialog --msgbox "NOTHING CHANGED!\nUse Spacebar to check/uncheck services." 8 58
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ${needsReboot} -eq 1 ]; then
|
||||||
|
sleep 2
|
||||||
|
dialog --pause "OK. System will reboot to activate changes." 8 58 8
|
||||||
|
clear
|
||||||
|
echo "rebooting .. (please wait)"
|
||||||
|
# stop bitcoind
|
||||||
|
sudo -u bitcoin ${network}-cli stop
|
||||||
|
sleep 4
|
||||||
|
sudo /home/admin/config.scripts/blitz.shutdown.sh reboot
|
||||||
|
fi
|
|
@ -1,29 +1,237 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
echo "For debug logs CTRL+C and: tail -n1000 -f raspiblitz.log"
|
|
||||||
echo "or call the command 'debug' to see bigger report."
|
#######################################
|
||||||
echo "Starting the main menu ..."
|
# SSH USER INTERFACE
|
||||||
|
# gets called when user logins per SSH
|
||||||
|
# or calls 'raspiblitz' on the terminal
|
||||||
|
#######################################
|
||||||
|
echo "Starting SSH user interface ... (please wait)"
|
||||||
|
|
||||||
# CONFIGFILE - configuration of RaspiBlitz
|
# CONFIGFILE - configuration of RaspiBlitz
|
||||||
configFile="/mnt/hdd/raspiblitz.conf"
|
configFile="/mnt/hdd/raspiblitz.conf"
|
||||||
|
source ${configFile} 2>/dev/null
|
||||||
|
|
||||||
# INFOFILE - state data from bootstrap
|
# INFOFILE - state data from bootstrap
|
||||||
infoFile="/home/admin/raspiblitz.info"
|
infoFile="/home/admin/raspiblitz.info"
|
||||||
|
|
||||||
# use blitz.datadrive.sh to analyse HDD situation
|
# check if raspiblitz.info exists
|
||||||
source <(sudo /home/admin/config.scripts/blitz.datadrive.sh status)
|
systemInfoExists=$(ls ${infoFile} | grep -c "${infoFile}")
|
||||||
if [ "${error}" != "" ]; then
|
if [ "${systemInfoExists}" != "1" ]; then
|
||||||
echo "# FAIL blitz.datadrive.sh status --> ${error}"
|
echo "systemInfoExists(${systemInfoExists})"
|
||||||
echo "# Please report issue to the raspiblitz github."
|
echo "FAIL: ${infoFile} does not exist .. which it should at this point."
|
||||||
|
echo "Check logs & bootstrap.service for errors and report to devs."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check if HDD is connected
|
# get system state information raspiblitz.info
|
||||||
if [ "${isMounted}" == "0" ] && [ ${#hddCandidate} -eq 0 ]; then
|
source ${infoFile}
|
||||||
|
|
||||||
|
# check that basic system phase/state information is available
|
||||||
|
if [ "${setupPhase}" == "" ] || [ "${state}" == "" ]; then
|
||||||
|
echo "setupPhase(${setupPhase}) state(${state})"
|
||||||
|
echo "FAIL: ${infoFile} does not exist or missing state."
|
||||||
|
echo "Check logs & bootstrap.service for errors and report to devs."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# special state: copysource
|
||||||
|
if [ "${state}" = "stop" ]; then
|
||||||
|
echo "OK ready for manual provision - run 'release' at the end."
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
# special state: copysource
|
||||||
|
if [ "${state}" = "copysource" ]; then
|
||||||
|
echo "***********************************************************"
|
||||||
|
echo "INFO: You lost connection during copying the blockchain"
|
||||||
|
echo "You have the following options:"
|
||||||
|
echo "a) continue/check progress with command: sourcemode"
|
||||||
|
echo "b) return to normal mode with command: restart"
|
||||||
|
echo "***********************************************************"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
# special state: copytarget
|
||||||
|
source <(/home/admin/config.scripts/blitz.copychain.sh status)
|
||||||
|
if [ "${copyInProgress}" = "1" ]; then
|
||||||
|
echo "Detected interrupted COPY blochain process ..."
|
||||||
|
/home/admin/config.scripts/blitz.copychain.sh target
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
# special state: reindex was triggered
|
||||||
|
if [ "${state}" = "reindex" ]; then
|
||||||
|
echo "Re-Index in progress ... start monitoring:"
|
||||||
|
/home/admin/config.scripts/network.reindex.sh
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
# special state: copystation
|
||||||
|
if [ "${state}" = "copystation" ]; then
|
||||||
|
echo "Copy Station is Running ..."
|
||||||
|
echo "reboot to return to normal"
|
||||||
|
sudo /home/admin/XXcopyStation.sh
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
# prepare status file
|
||||||
|
# TODO: this is to be replaced and unified together with raspiblitz.info
|
||||||
|
# when we move to a background monitoring thread & redis for WebUI with v1.8
|
||||||
|
sudo touch /var/cache/raspiblitz/raspiblitz.status
|
||||||
|
sudo chown admin:admin /var/cache/raspiblitz/raspiblitz.status
|
||||||
|
sudo chmod 740 /var/cache/raspiblitz/raspiblitz.status
|
||||||
|
|
||||||
|
#####################################
|
||||||
|
# SSH MENU LOOP
|
||||||
|
# this loop runs until user exits or
|
||||||
|
# an error drops user to terminal
|
||||||
|
#####################################
|
||||||
|
|
||||||
|
echo "# start ssh menu loop"
|
||||||
|
exitMenuLoop=0
|
||||||
|
doneIBD=0
|
||||||
|
while [ ${exitMenuLoop} -eq 0 ]
|
||||||
|
do
|
||||||
|
|
||||||
|
#####################################
|
||||||
|
# Access fresh system info on every loop
|
||||||
|
|
||||||
|
# refresh system state information
|
||||||
|
source ${infoFile}
|
||||||
|
|
||||||
|
# gather fresh status scan and store results in memory
|
||||||
|
# TODO: move this into background loop and unify with redis data storage later
|
||||||
|
#echo "# blitz.statusscan.sh"
|
||||||
|
|
||||||
|
firstStatusScanExists=$(ls /var/cache/raspiblitz/raspiblitz.status | grep -c "raspiblitz.status")
|
||||||
|
#echo "firstStatusScanExists(${firstStatusScanExists})"
|
||||||
|
if [ ${firstStatusScanExists} -eq 1 ]; then
|
||||||
|
|
||||||
|
# run statusscan with timeout - if status scan was not killed it will copy over the
|
||||||
|
timeout 15 /home/admin/config.scripts/blitz.statusscan.sh ${lightning} > /var/cache/raspiblitz/raspiblitz.status.tmp
|
||||||
|
result=$?
|
||||||
|
#echo "result(${result})"
|
||||||
|
if [ "${result}" == "0" ]; then
|
||||||
|
# statusscan finished in under 10 seconds - use results
|
||||||
|
cp /var/cache/raspiblitz/raspiblitz.status.tmp /var/cache/raspiblitz/raspiblitz.status
|
||||||
|
else
|
||||||
|
# statusscan blocked and was killed - fallback to old results
|
||||||
|
echo "statusscan blocked (${result}) - fallback to old results"
|
||||||
|
sleep 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
# first time run statusscan without timeout
|
||||||
|
echo "# running statusscan for the first time ... can take time"
|
||||||
|
/home/admin/config.scripts/blitz.statusscan.sh ${lightning} > /var/cache/raspiblitz/raspiblitz.status
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
# load statusscan results
|
||||||
|
source /var/cache/raspiblitz/raspiblitz.status 2>/dev/null
|
||||||
|
|
||||||
|
#####################################
|
||||||
|
# ALWAYS: Handle System States
|
||||||
|
#####################################
|
||||||
|
|
||||||
|
############################
|
||||||
|
# LND Wallet Unlock
|
||||||
|
|
||||||
|
if [ "${lndActive}" == "1" ] && [ "${walletLocked}" == "1" ] && [ "${state}" == "ready" ] && [ "${setupPhase}" == "done" ]; then
|
||||||
|
#echo "# lnd.unlock.sh"
|
||||||
|
/home/admin/config.scripts/lnd.unlock.sh
|
||||||
|
fi
|
||||||
|
|
||||||
|
# CL Wallet Unlock
|
||||||
|
if [ "${CLwalletLocked}" == "1" ] && [ "${state}" == "ready" ] && [ "${setupPhase}" == "done" ]; then
|
||||||
|
/home/admin/config.scripts/cl.hsmtool.sh unlock
|
||||||
|
sleep 5
|
||||||
|
fi
|
||||||
|
|
||||||
|
#####################################
|
||||||
|
# SETUP MENU
|
||||||
|
#####################################
|
||||||
|
|
||||||
|
# when is needed & bootstrap process signals that it waits for user dialog
|
||||||
|
if [ "${setupPhase}" != "done" ] && [ "${state}" == "waitsetup" ]; then
|
||||||
|
# push user to main menu
|
||||||
|
echo "# controlSetupDialog.sh"
|
||||||
|
/home/admin/setup.scripts/controlSetupDialog.sh
|
||||||
|
# use the exit code from setup menu as signal if menu loop should exited
|
||||||
|
# 0 = continue loop / everything else = break loop and exit to terminal
|
||||||
|
exitMenuLoop=$?
|
||||||
|
if [ "${exitMenuLoop}" != "0" ]; then break; fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
#####################################
|
||||||
|
# SETUP DONE DIALOGS
|
||||||
|
#####################################
|
||||||
|
|
||||||
|
# when is needed & bootstrap process signals that it waits for user dialog
|
||||||
|
if [ "${setupPhase}" != "done" ] && [ "${state}" == "waitfinal" ]; then
|
||||||
|
# push to final setup gui dialogs
|
||||||
|
#echo "# controlFinalDialog.sh"
|
||||||
|
/home/admin/setup.scripts/controlFinalDialog.sh
|
||||||
|
# exit because controller will reboot at the end
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# exit loop/script in case if system shutting down
|
||||||
|
if [ "${state}" == "reboot" ] || [ "${state}" == "shutdown" ]; then
|
||||||
|
dialog --pause " Prepare Reboot ..." 8 58 4
|
||||||
|
clear
|
||||||
echo "***********************************************************"
|
echo "***********************************************************"
|
||||||
echo "WARNING: NO HDD FOUND -> Shutdown, connect HDD and restart."
|
echo "RaspiBlitz going to ${state}"
|
||||||
echo "***********************************************************"
|
echo "***********************************************************"
|
||||||
vagrant=$(df | grep -c "/vagrant")
|
if [ "${state}" == "reboot" ]; then
|
||||||
if [ ${vagrant} -gt 0 ]; then
|
echo "SSH again into system with:"
|
||||||
|
echo "ssh admin@${localip}"
|
||||||
|
echo "Use your password A"
|
||||||
|
echo "***********************************************************"
|
||||||
|
fi
|
||||||
|
sleep 10
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
#####################################
|
||||||
|
# INITIAL BLOCKCHAIN SYNC (SUBLOOP)
|
||||||
|
#####################################
|
||||||
|
if [ "${lightning}" == "" ]; then syncedToChain=1; fi
|
||||||
|
if [ "${setupPhase}" == "done" ] && [ "${state}" == "ready" ] && [ "${syncedToChain}" != "1" ]; then
|
||||||
|
/home/admin/setup.scripts/eventBlockchainSync.sh ssh
|
||||||
|
sleep 10
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
#####################################
|
||||||
|
# MAIN MENU or BLOCKCHAIN SYNC
|
||||||
|
#####################################
|
||||||
|
|
||||||
|
# when setup is done & state is ready .. jump to main menu
|
||||||
|
if [ "${setupPhase}" == "done" ] && [ "${state}" == "ready" ]; then
|
||||||
|
# MAIN MENU
|
||||||
|
echo "# 00mainMenu.sh"
|
||||||
|
/home/admin/00mainMenu.sh
|
||||||
|
# use the exit code from main menu as signal if menu loop should exited
|
||||||
|
# 0 = continue loop / everything else = break loop and exit to terminal
|
||||||
|
exitMenuLoop=$?
|
||||||
|
if [ "${exitMenuLoop}" != "0" ]; then break; fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
#####################################
|
||||||
|
# DURING SETUP: Handle System States
|
||||||
|
#####################################
|
||||||
|
|
||||||
|
if [ "${setupPhase}" != "done" ]; then
|
||||||
|
|
||||||
|
#echo "# DURING SETUP: Handle System State (${state})"
|
||||||
|
|
||||||
|
# when no HDD on Vagrant - just print info & exit (admin info & exit)
|
||||||
|
if [ "${state}" == "noHDD" ] && [ ${vagrant} -gt 0 ]; then
|
||||||
|
echo "***********************************************************"
|
||||||
|
echo "VAGRANT INFO"
|
||||||
|
echo "***********************************************************"
|
||||||
echo "To connect a HDD data disk to your VagrantVM:"
|
echo "To connect a HDD data disk to your VagrantVM:"
|
||||||
echo "- shutdown VM with command: off"
|
echo "- shutdown VM with command: off"
|
||||||
echo "- open your VirtualBox GUI and select RaspiBlitzVM"
|
echo "- open your VirtualBox GUI and select RaspiBlitzVM"
|
||||||
|
@ -35,436 +243,91 @@ if [ "${isMounted}" == "0" ] && [ ${#hddCandidate} -eq 0 ]; then
|
||||||
echo "a VDI with a presynced blockchain to speed up setup. If you dont have 900GB"
|
echo "a VDI with a presynced blockchain to speed up setup. If you dont have 900GB"
|
||||||
echo "space on your laptop you can store the VDI file on an external drive."
|
echo "space on your laptop you can store the VDI file on an external drive."
|
||||||
echo "***********************************************************"
|
echo "***********************************************************"
|
||||||
fi
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
# check if HDD is from another fullnode OS and offer migration
|
|
||||||
if [ "${hddGotMigrationData}" != "" ] && [ "${hddGotMigrationData}" != "none" ]; then
|
|
||||||
nodenameUpperCase=$(echo "${hddGotMigrationData}" | tr "[a-z]" "[A-Z]")
|
|
||||||
whiptail --title " ${nodenameUpperCase} --> RASPIBLITZ " --yes-button "Start Migration" --no-button "Ignore" --yesno "RaspiBlitz found data from ${nodenameUpperCase}
|
|
||||||
|
|
||||||
You can migrate your blockchain & LND data (funds & channels) over to RaspiBlitz.
|
|
||||||
|
|
||||||
Please make sure to have your ${nodenameUpperCase} seed words & static channel backup file (just in case). Also any data of additional apps you had installed on ${nodenameUpperCase} might get lost.
|
|
||||||
|
|
||||||
Do you want to start migration to RaspiBlitz now?
|
|
||||||
" 16 58
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
err=""
|
|
||||||
echo "**************************************************"
|
|
||||||
echo "MIGRATION FROM ${nodenameUpperCase} TO RASPIBLITZ"
|
|
||||||
echo "**************************************************"
|
|
||||||
echo "- started ..."
|
|
||||||
source <(sudo /home/admin/config.scripts/blitz.migration.sh migration-${hddGotMigrationData})
|
|
||||||
if [ "${err}" != "" ]; then
|
|
||||||
echo "MIGRATION FAILED: ${err}"
|
|
||||||
echo "Format data disk on laptop & recover funds with fresh sd card using seed words + static channel backup."
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# if free space is lower than 100GB (100000000) delete backup files
|
# for all critical errors (admin info & exit)
|
||||||
if [ "${hddDataFreeKB}" != "" ] && [ ${hddDataFreeKB} -lt 407051412 ]; then
|
if [ "${state}" == "error" ] || [ "${state}" == "errorHDD" ]; then
|
||||||
echo "- free space of data disk is low ... deleting 'backup_migration'"
|
clear
|
||||||
sudo rm -R /mnt/hdd/backup_migration
|
echo "###########################################################"
|
||||||
|
echo "# /home/admin/raspiblitz.log"
|
||||||
|
cat /home/admin/raspiblitz.log
|
||||||
|
if [ "${state}" == "errorHDD" ]; then
|
||||||
|
# print some debug detail info on HDD/SSD error
|
||||||
|
echo "###########################################################"
|
||||||
|
echo "# blitz.datadrive.sh status"
|
||||||
|
sudo /home/admin/config.scripts/blitz.datadrive.sh status
|
||||||
|
fi
|
||||||
|
if [ "${message}" == "_provision.setup.sh fail" ]; then
|
||||||
|
echo "# /home/admin/raspiblitz.provision-setup.log"
|
||||||
|
cat /home/admin/raspiblitz.provision-setup.log
|
||||||
|
fi
|
||||||
|
echo "***********************************************************"
|
||||||
|
echo "ERROR - please report to development team"
|
||||||
|
echo "***********************************************************"
|
||||||
|
echo "state(${state}) message(${message})"
|
||||||
|
echo "https://github.com/rootzoll/raspiblitz#support"
|
||||||
|
echo "command to shutdown --> off"
|
||||||
|
exit 1
|
||||||
else
|
else
|
||||||
echo "- old data of ${nodenameUpperCase} can be found in '/mnt/hdd/backup_migration'"
|
# every other state just push as event to SSH frontend
|
||||||
|
/home/admin/setup.scripts/eventInfoWait.sh "${state}" "${message}"
|
||||||
fi
|
fi
|
||||||
sleep 3
|
|
||||||
|
|
||||||
# kick into reboot
|
|
||||||
echo "******************************************************"
|
|
||||||
echo "OK MIGRATION --> will now reboot and update/recover"
|
|
||||||
echo "******************************************************"
|
|
||||||
sudo shutdown -h -r now
|
|
||||||
sleep 100
|
|
||||||
exit 0
|
|
||||||
else
|
|
||||||
echo "******************************************************"
|
|
||||||
echo "MIGRATION SKIPPED ... starting fresh RaspiBlitz Setup"
|
|
||||||
echo "******************************************************"
|
|
||||||
sleep 6
|
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
# check data from _bootstrap.sh that was running on device setup
|
done
|
||||||
bootstrapInfoExists=$(ls $infoFile | grep -c '.info')
|
|
||||||
if [ ${bootstrapInfoExists} -eq 0 ]; then
|
|
||||||
echo "***********************************************************"
|
|
||||||
echo "WARNING: NO raspiblitz.info FOUND -> bootstrap not running?"
|
|
||||||
echo "***********************************************************"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
# load the data from the info file (will get produced on every startup)
|
echo "# menu loop received exit code ${exitMenuLoop} --> exit to terminal"
|
||||||
source ${infoFile}
|
echo
|
||||||
|
echo " -==@@@====@===-- --===@====@@@==- "
|
||||||
if [ "${state}" = "recovering" ]; then
|
echo " -@@=====-----=-===@@=====@@=====-----=====@@- -==@- "
|
||||||
echo "***********************************************************"
|
echo " -@@------==---------@@@@@=--------==------@@- --=@@@@= "
|
||||||
echo "WARNING: bootstrap still updating - close SSH, login later"
|
echo " @@=------======-----@@@-----======------=@@=@@===@@= "
|
||||||
echo "To monitor progress --> tail -n1000 -f raspiblitz.log"
|
echo " =@@=---------=======@@@=======-----===@@@==- =@@- "
|
||||||
echo "***********************************************************"
|
echo " -=@@==@@=----------=@@@@@@@@@=----==@@@==-- -=@@- "
|
||||||
exit
|
echo " -@@@=----=@@===--====@@@@@@@@@@@@@@@@=-- -=@@@@= "
|
||||||
fi
|
echo " =@@=--------@@@@@@@@@@@@@@@@@@@@@=-- -@@=---=@@- "
|
||||||
|
echo " -@@=-------=@@@=====@@@@@@@@@@=-- =@@=-------@@@ "
|
||||||
if [ "${state}" = "copysource" ]; then
|
echo " =@@=-------=@@====@@@@@@@@==- -=@@@@=--------=@@- "
|
||||||
echo "***********************************************************"
|
echo " =@@---------@@==@@@@@@==- -=@@@=@@@---------=@@ "
|
||||||
echo "INFO: You lost connection during copying the blockchain"
|
echo " -@@=--------=@@@@@@=- -@@@@@@@@@@=---------=@@ "
|
||||||
echo "You have the following options:"
|
echo " @@=-------@@@@@@@@@=- =@@@===@@@@=@@@@--------@@- "
|
||||||
echo "a) continue/check progress with command: sourcemode"
|
echo " -@@=------@@====@@@=@@@=- -=@@@======@@====@@@-------=@@ "
|
||||||
echo "b) return to normal mode with command: restart"
|
echo " -@@------@@@====@@@====@@@=- =@@@======@@@=====@@=------=@@ "
|
||||||
echo "***********************************************************"
|
echo " -@@------=@@====@@@@@=====@@@=- -=@@@=@@@@@@===@@@=------=@@ "
|
||||||
exit
|
echo " -@@-------@@@=@@@@@@@@@@@@@@@=- -=@@@@@@@@=@@@=-------=@@ "
|
||||||
fi
|
echo " @@=-------=@@@@@@@@@@@@@@@= -=@@@=@@@@=--------@@= "
|
||||||
|
echo " -@@--------=@@======@@@@- -=@@@@@@=--------=@@ "
|
||||||
# check if copy blockchain over LAN to this RaspiBlitz was running
|
echo " =@@--------@@@===@@@=- --=@@@@@@=@@@--------=@@- "
|
||||||
source <(/home/admin/config.scripts/blitz.copyblockchain.sh status)
|
echo " =@@--------@@@@@@=- -==@@@@@=====@@@--------=@@- "
|
||||||
if [ "${copyInProgress}" = "1" ]; then
|
echo " =@@=-------@@@= -==@@@@@@@=====@@@@=--------=@@- "
|
||||||
echo "Detected interrupted COPY blockchain process ..."
|
echo " -@@=----=@@- -==@@@@@@@@@@@@@@@@@==---------=@@= "
|
||||||
/home/admin/50copyHDD.sh
|
echo " =@@==@@- -==@@@@@=========@@@@@=-----------=@@@- "
|
||||||
exit
|
echo " -@@=- --=@@@==-=@@@@@@@@@@@@@=-------------=@@=- "
|
||||||
fi
|
echo " -@@= --=@@@==----------=======-------------==@@@= "
|
||||||
|
echo " -@@=-==@==-=@@@===------------------------==@@@@= "
|
||||||
# signal that after bootstrap recover user dialog is needed
|
echo " =@@@@==- -==@@@@@======----======@@@@@=-- "
|
||||||
recoveredInfoExists=$(sudo ls /home/admin/recover.flag 2>/dev/null | grep -c '.flag')
|
echo " =@@=-- --===@@@@@@@@@@@===-- "
|
||||||
if [ ${recoveredInfoExists} -gt 0 ]; then
|
echo
|
||||||
echo "System recovered - needs final user settings"
|
echo "***********************************"
|
||||||
/home/admin/20recoverDialog.sh
|
echo "* RaspiBlitz Commandline"
|
||||||
exit 1
|
echo "* Here be dragons .. have fun :)"
|
||||||
fi
|
echo "***********************************"
|
||||||
|
if [ "${setupPhase}" == "done" ]; then
|
||||||
# signal that a reindex was triggered
|
echo "Bitcoin command line options: ${network}-cli help"
|
||||||
if [ "${state}" = "reindex" ]; then
|
if [ "${lightning}" == "lnd" ]; then
|
||||||
echo "Re-Index in progress ... start monitoring:"
|
echo "LND command line options: lncli -h"
|
||||||
/home/admin/config.scripts/network.reindex.sh
|
fi
|
||||||
exit 1
|
if [ "${lightning}" == "cl" ]; then
|
||||||
fi
|
echo "C-Lightning command line options: lightning-cli help"
|
||||||
|
|
||||||
# signal that copystation is running
|
|
||||||
if [ "${state}" = "copystation" ]; then
|
|
||||||
echo "Copy Station is Running ..."
|
|
||||||
echo "reboot to return to normal"
|
|
||||||
sudo /home/admin/XXcopyStation.sh
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
# if state=ready -> setup is done or started
|
|
||||||
if [ "${state}" = "ready" ]; then
|
|
||||||
configExists=$(ls ${configFile} | grep -c '.conf')
|
|
||||||
if [ ${configExists} -eq 1 ]; then
|
|
||||||
echo "loading config data"
|
|
||||||
source ${configFile}
|
|
||||||
else
|
|
||||||
echo "setup still in progress - setupStep(${setupStep})"
|
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
## default menu settings
|
|
||||||
# to fit the main menu without scrolling:
|
|
||||||
HEIGHT=13
|
|
||||||
WIDTH=64
|
|
||||||
CHOICE_HEIGHT=6
|
|
||||||
BACKTITLE="RaspiBlitz"
|
|
||||||
TITLE=""
|
|
||||||
MENU="Choose one of the following options:"
|
|
||||||
OPTIONS=()
|
|
||||||
|
|
||||||
# check if RTL web interface is installed
|
|
||||||
runningRTL=$(sudo ls /etc/systemd/system/RTL.service 2>/dev/null | grep -c 'RTL.service')
|
|
||||||
|
|
||||||
# function to use later
|
|
||||||
waitUntilChainNetworkIsReady()
|
|
||||||
{
|
|
||||||
source ${configFile}
|
|
||||||
echo "checking ${network}d - please wait .."
|
|
||||||
echo "can take longer if device was off or first time"
|
|
||||||
|
|
||||||
# check for error on network
|
|
||||||
sudo -u bitcoin ${network}-cli -datadir=/home/bitcoin/.${network} getblockchaininfo 1>/dev/null 2>error.tmp
|
|
||||||
clienterror=`cat error.tmp`
|
|
||||||
rm error.tmp
|
|
||||||
|
|
||||||
# check for missing blockchain data
|
|
||||||
if [ "${network}" = "bitcoin" ]; then
|
|
||||||
if [ "${chain}" = "main" ]; then
|
|
||||||
minSize=210000000000
|
|
||||||
else
|
|
||||||
minSize=27000000000
|
|
||||||
fi
|
|
||||||
elif [ "${network}" = "litecoin" ]; then
|
|
||||||
if [ "${chain}" = "main" ]; then
|
|
||||||
minSize=20000000000
|
|
||||||
else
|
|
||||||
minSize=27000000000
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
minSize=210000000000000
|
|
||||||
fi
|
|
||||||
isSyncing=$(sudo ls -la /mnt/hdd/${network}/blocks/.selfsync 2>/dev/null | grep -c '.selfsync')
|
|
||||||
blockchainsize=$(sudo du -shbc /mnt/hdd/${network}/ 2>/dev/null | head -n1 | awk '{print $1;}')
|
|
||||||
if [ ${#blockchainsize} -gt 0 ]; then
|
|
||||||
if [ ${blockchainsize} -lt ${minSize} ]; then
|
|
||||||
if [ ${isSyncing} -eq 0 ]; then
|
|
||||||
echo "blockchainsize(${blockchainsize})"
|
|
||||||
echo "Missing Blockchain Data (<${minSize}) ..."
|
|
||||||
clienterror="missing blockchain"
|
|
||||||
sleep 3
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ${#clienterror} -gt 0 ]; then
|
|
||||||
#echo "clienterror(${clienterror})"
|
|
||||||
|
|
||||||
# analyse LOGS for possible reindex
|
|
||||||
reindex=$(sudo cat /mnt/hdd/${network}/debug.log 2>/dev/null | grep -c 'Please restart with -reindex or -reindex-chainstate to recover')
|
|
||||||
if [ ${reindex} -gt 0 ]; then
|
|
||||||
# dismiss if its just a date thing
|
|
||||||
futureBlock=$(sudo tail /mnt/hdd/${network}/debug.log 2>/dev/null | grep "Please restart with -reindex or -reindex-chainstate to recover" | grep -c "block database contains a block which appears to be from the future")
|
|
||||||
if [ ${futureBlock} -gt 0 ]; then
|
|
||||||
blockchainBroken=0
|
|
||||||
echo "-> Ignore reindex - its just a future block"
|
|
||||||
fi
|
|
||||||
if [ ${isSyncing} -gt 0 ]; then
|
|
||||||
reindex=0
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
if [ ${reindex} -gt 0 ] || [ "${clienterror}" = "missing blockchain" ]; then
|
|
||||||
|
|
||||||
if [ ${reindex} -gt 0 ]; then
|
|
||||||
echo "!! DETECTED NEED FOR RE-INDEX in debug.log ... starting repair options."
|
|
||||||
sudo sed -i "s/^state=.*/state=repair/g" /home/admin/raspiblitz.info
|
|
||||||
sleep 3
|
|
||||||
fi
|
|
||||||
|
|
||||||
whiptail --title "Blockchain not Complete" --yes-button "DELETE+REPAIR" --no-button "Continue Sync" --yesno "Your blockchain data is not complete (yet).
|
|
||||||
|
|
||||||
You can try to sync the chain further but if your stuck
|
|
||||||
this can be due to power problems or a failing HDD.
|
|
||||||
For more info see: https://raspiblitz.org -> FAQ
|
|
||||||
|
|
||||||
If you choose to DELETE+REPAIR the old blockchain gets
|
|
||||||
deleted but your Lightning funds & channel not be touched.
|
|
||||||
|
|
||||||
How do you want to continue?
|
|
||||||
" 15 65
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
#delete+repair
|
|
||||||
clear
|
|
||||||
echo "***********************************************************"
|
|
||||||
echo "DELETE+REPAIR blockchain ..."
|
|
||||||
echo "***********************************************************"
|
|
||||||
/home/admin/XXcleanHDD.sh -blockchain -force
|
|
||||||
/home/admin/98repairBlockchain.sh
|
|
||||||
/home/admin/00raspiblitz.sh
|
|
||||||
exit
|
|
||||||
else
|
|
||||||
# ignore - just delete blockchain logfile
|
|
||||||
clear
|
|
||||||
echo "***********************************************************"
|
|
||||||
echo "CONTINUE SYNC blockchain ..."
|
|
||||||
echo "***********************************************************"
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
# let 80scanLND script to the info to use
|
|
||||||
/home/admin/80scanLND.sh
|
|
||||||
if [ $? -gt 0 ]; then
|
|
||||||
echo "${network} error: ${clienterror}"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
while :
|
|
||||||
do
|
|
||||||
|
|
||||||
locked=$(sudo -u bitcoin /usr/local/bin/lncli --chain=${network} --network=${chain}net getinfo 2>&1 | grep -c unlock)
|
|
||||||
if [ ${locked} -gt 0 ]; then
|
|
||||||
uptime=$(awk '{printf("%d\n",$1 + 0.5)}' /proc/uptime)
|
|
||||||
if [ "${autoUnlock}" == "on" ] && [ ${uptime} -lt 300 ]; then
|
|
||||||
# give autounlock 5 min after startup to react
|
|
||||||
sleep 1
|
|
||||||
else
|
|
||||||
# check how many times LND was restarted
|
|
||||||
source <(sudo /home/admin/config.scripts/blitz.statusscan.sh)
|
|
||||||
if [ ${startcountLightning} -lt 4 ]; then
|
|
||||||
/home/admin/config.scripts/lnd.unlock.sh
|
|
||||||
echo "Starting up Wallet ... (10sec)"
|
|
||||||
sleep 5
|
|
||||||
sleep 5
|
|
||||||
echo "please wait ... update to next screen can be slow"
|
|
||||||
else
|
|
||||||
/home/admin/80scanLND.sh lightning-error
|
|
||||||
sudo rm /home/admin/systemd.lightning.log
|
|
||||||
echo "(exit after too much restarts/unlocks - restart to try again)"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
lndSynced=$(sudo -u bitcoin /usr/local/bin/lncli --chain=${network} --network=${chain}net getinfo 2>/dev/null | jq -r '.synced_to_chain' | grep -c true)
|
|
||||||
if [ ${lndSynced} -eq 0 ]; then
|
|
||||||
/home/admin/80scanLND.sh
|
|
||||||
if [ $? -gt 0 ]; then
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
# everything is ready - return from loop
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
sleep 5
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
if [ ${#setupStep} -eq 0 ]; then
|
|
||||||
echo "WARN: no setup step found in raspiblitz.info"
|
|
||||||
setupStep=0
|
|
||||||
fi
|
|
||||||
if [ ${setupStep} -eq 0 ]; then
|
|
||||||
|
|
||||||
|
|
||||||
# start setup
|
|
||||||
BACKTITLE="RaspiBlitz - Setup"
|
|
||||||
TITLE="⚡ Welcome to your RaspiBlitz ⚡"
|
|
||||||
MENU="\nChoose how you want to setup your RaspiBlitz: \n "
|
|
||||||
OPTIONS+=(BITCOIN "Setup BITCOIN and Lightning (DEFAULT)" \
|
|
||||||
LITECOIN "Setup LITECOIN and Lightning (EXPERIMENTAL)" \
|
|
||||||
MIGRATION "Upload a Migration File from old RaspiBlitz" )
|
|
||||||
HEIGHT=12
|
|
||||||
|
|
||||||
elif [ ${setupStep} -lt 100 ]; then
|
|
||||||
|
|
||||||
# continue setup
|
|
||||||
BACKTITLE="${hostname} / ${network} / ${chain}"
|
|
||||||
TITLE="⚡ Welcome to your RaspiBlitz ⚡"
|
|
||||||
MENU="\nThe setup process is not finished yet: \n "
|
|
||||||
OPTIONS+=(CONTINUE "Continue Setup of your RaspiBlitz")
|
|
||||||
HEIGHT=10
|
|
||||||
|
|
||||||
else
|
else
|
||||||
|
echo "Your setup is not finished."
|
||||||
# check if LND needs re-setup
|
echo "For setup logs: cat raspiblitz.log"
|
||||||
source <(sudo /home/admin/config.scripts/lnd.check.sh basic-setup)
|
echo "or call the command 'debug' to see bigger report."
|
||||||
if [ "${wallet}" == "0" ] || [ "${macaroon}" == "0" ] || [ "${config}" == "0" ] || [ "${tls}" == "0" ]; then
|
|
||||||
echo "WARN: LND needs re-setup"
|
|
||||||
/home/admin/70initLND.sh
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# wait all is synced and ready
|
|
||||||
waitUntilChainNetworkIsReady
|
|
||||||
|
|
||||||
# check if there is a channel.backup to activate
|
|
||||||
gotSCB=$(ls /home/admin/channel.backup 2>/dev/null | grep -c 'channel.backup')
|
|
||||||
if [ ${gotSCB} -eq 1 ]; then
|
|
||||||
|
|
||||||
echo "*** channel.backup Recovery ***"
|
|
||||||
lncli --chain=${network} restorechanbackup --multi_file=/home/admin/channel.backup 2>/home/admin/.error.tmp
|
|
||||||
error=`cat /home/admin/.error.tmp`
|
|
||||||
rm /home/admin/.error.tmp 2>/dev/null
|
|
||||||
|
|
||||||
if [ ${#error} -gt 0 ]; then
|
|
||||||
|
|
||||||
# output error message
|
|
||||||
echo ""
|
|
||||||
echo "!!! FAIL !!! SOMETHING WENT WRONG:"
|
|
||||||
echo "${error}"
|
|
||||||
|
|
||||||
# check if its possible to give background info on the error
|
|
||||||
notMachtingSeed=$(echo $error | grep -c 'unable to unpack chan backup')
|
|
||||||
if [ ${notMachtingSeed} -gt 0 ]; then
|
|
||||||
echo "--> ERROR BACKGROUND:"
|
|
||||||
echo "The WORD SEED is not matching the channel.backup file."
|
|
||||||
echo "Either there was an error in the word seed list or"
|
|
||||||
echo "or the channel.backup file is from another RaspiBlitz."
|
|
||||||
echo
|
|
||||||
fi
|
|
||||||
|
|
||||||
# basic info on error
|
|
||||||
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
|
||||||
echo
|
|
||||||
echo "You can try after full setup to restore channel.backup file again with:"
|
|
||||||
echo "lncli --chain=${network} restorechanbackup --multi_file=/home/admin/channel.backup"
|
|
||||||
echo
|
|
||||||
echo "Press ENTER to continue for now ..."
|
|
||||||
read key
|
|
||||||
else
|
|
||||||
mv /home/admin/channel.backup /home/admin/channel.backup.done
|
|
||||||
dialog --title " OK channel.backup IMPORT " --msgbox "
|
|
||||||
LND accepted the channel.backup file you uploaded.
|
|
||||||
It will now take around a hour until you can see,
|
|
||||||
if LND was able to recover funds from your channels.
|
|
||||||
" 9 56
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
# check if DNS is working (if not it will trigger dialog)
|
|
||||||
sudo /home/admin/config.scripts/internet.dns.sh test
|
|
||||||
|
|
||||||
#forward to main menu
|
|
||||||
/home/admin/00mainMenu.sh
|
|
||||||
exit 0
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
echo "Blitz command line options: blitzhelp"
|
||||||
CHOICE=$(dialog --clear \
|
echo "Back to menus use command: raspiblitz"
|
||||||
--backtitle "$BACKTITLE" \
|
echo
|
||||||
--title "$TITLE" \
|
exit 0
|
||||||
--menu "$MENU" \
|
|
||||||
$HEIGHT $WIDTH $CHOICE_HEIGHT \
|
|
||||||
"${OPTIONS[@]}" \
|
|
||||||
2>&1 >/dev/tty)
|
|
||||||
|
|
||||||
clear
|
|
||||||
case $CHOICE in
|
|
||||||
CLOSE)
|
|
||||||
exit 1;
|
|
||||||
;;
|
|
||||||
BITCOIN)
|
|
||||||
# set network info
|
|
||||||
sed -i "s/^network=.*/network=bitcoin/g" ${infoFile}
|
|
||||||
sed -i "s/^chain=.*/chain=main/g" ${infoFile}
|
|
||||||
###### OPTIMIZE IF RAM >1GB
|
|
||||||
kbSizeRAM=$(cat /proc/meminfo | grep "MemTotal" | sed 's/[^0-9]*//g')
|
|
||||||
if [ ${kbSizeRAM} -gt 1500000 ]; then
|
|
||||||
echo "Detected RAM >1GB --> optimizing ${network}.conf"
|
|
||||||
sudo sed -i "s/^dbcache=.*/dbcache=512/g" /home/admin/assets/bitcoin.conf
|
|
||||||
sudo sed -i "s/^maxmempool=.*/maxmempool=300/g" /home/admin/assets/bitcoin.conf
|
|
||||||
fi
|
|
||||||
/home/admin/10setupBlitz.sh
|
|
||||||
exit 1;
|
|
||||||
;;
|
|
||||||
LITECOIN)
|
|
||||||
/home/admin/config.scripts/blitz.litecoin.sh on
|
|
||||||
/home/admin/10setupBlitz.sh
|
|
||||||
exit 1;
|
|
||||||
;;
|
|
||||||
MANUAL)
|
|
||||||
echo "************************************************************************************"
|
|
||||||
echo "PLEASE go to RaspiBlitz FAQ:"
|
|
||||||
echo "https://github.com/rootzoll/raspiblitz"
|
|
||||||
echo "And check: How can I recover my coins from a failing RaspiBlitz?"
|
|
||||||
echo "************************************************************************************"
|
|
||||||
exit 0
|
|
||||||
;;
|
|
||||||
MIGRATION)
|
|
||||||
sudo /home/admin/config.scripts/blitz.migration.sh "import-gui"
|
|
||||||
# on error clean & repeat
|
|
||||||
if [ "$?" = "1" ]; then
|
|
||||||
echo
|
|
||||||
echo "# clean and unmount for next try"
|
|
||||||
sudo rm -f ${defaultZipPath}/raspiblitz-*.tar.gz 2>/dev/null
|
|
||||||
sudo umount /mnt/hdd 2>/dev/null
|
|
||||||
sudo umount /mnt/storage 2>/dev/null
|
|
||||||
sudo umount /mnt/temp 2>/dev/null
|
|
||||||
sleep 2
|
|
||||||
/home/admin/00raspiblitz.sh
|
|
||||||
fi
|
|
||||||
exit 0
|
|
||||||
;;
|
|
||||||
CONTINUE)
|
|
||||||
/home/admin/10setupBlitz.sh
|
|
||||||
exit 1;
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
|
@ -9,31 +9,47 @@ echo "services default values"
|
||||||
if [ ${#autoPilot} -eq 0 ]; then autoPilot="off"; fi
|
if [ ${#autoPilot} -eq 0 ]; then autoPilot="off"; fi
|
||||||
if [ ${#autoUnlock} -eq 0 ]; then autoUnlock="off"; fi
|
if [ ${#autoUnlock} -eq 0 ]; then autoUnlock="off"; fi
|
||||||
if [ ${#runBehindTor} -eq 0 ]; then runBehindTor="off"; fi
|
if [ ${#runBehindTor} -eq 0 ]; then runBehindTor="off"; fi
|
||||||
if [ ${#chain} -eq 0 ]; then chain="main"; fi
|
|
||||||
if [ ${#autoNatDiscovery} -eq 0 ]; then autoNatDiscovery="off"; fi
|
if [ ${#autoNatDiscovery} -eq 0 ]; then autoNatDiscovery="off"; fi
|
||||||
if [ ${#networkUPnP} -eq 0 ]; then networkUPnP="off"; fi
|
if [ ${#networkUPnP} -eq 0 ]; then networkUPnP="off"; fi
|
||||||
if [ ${#touchscreen} -eq 0 ]; then touchscreen=0; fi
|
if [ ${#touchscreen} -eq 0 ]; then touchscreen=0; fi
|
||||||
if [ ${#lcdrotate} -eq 0 ]; then lcdrotate=0; fi
|
if [ ${#lcdrotate} -eq 0 ]; then lcdrotate=0; fi
|
||||||
if [ ${#zerotier} -eq 0 ]; then zerotier="off"; fi
|
if [ ${#zerotier} -eq 0 ]; then zerotier="off"; fi
|
||||||
if [ ${#circuitbreaker} -eq 0 ]; then circuitbreaker="off"; fi
|
if [ ${#circuitbreaker} -eq 0 ]; then circuitbreaker="off"; fi
|
||||||
|
if [ ${#clboss} -eq 0 ]; then clboss="off"; fi
|
||||||
|
if [ ${#clEncryptedHSM} -eq 0 ]; then clEncryptedHSM="off"; fi
|
||||||
|
if [ ${#clAutoUnlock} -eq 0 ]; then clAutoUnlock="off"; fi
|
||||||
|
|
||||||
echo "map dropboxbackup to on/off"
|
echo "# map LND to on/off"
|
||||||
DropboxBackup="off"
|
lndNode="off"
|
||||||
if [ ${#dropboxBackupTarget} -gt 0 ]; then DropboxBackup="on"; fi
|
if [ "${lightning}" == "lnd" ] || [ "${lnd}" == "on" ]; then
|
||||||
|
lndNode="on"
|
||||||
|
fi
|
||||||
|
|
||||||
echo "map localbackup to on/off"
|
echo "# map CL to on/off"
|
||||||
|
clNode="off"
|
||||||
|
if [ "${lightning}" == "cl" ] || [ "${cl}" == "on" ]; then
|
||||||
|
clNode="on"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "map nextcloudbackup to on/off"
|
||||||
|
NextcloudBackup="off"
|
||||||
|
if [ $nextcloudBackupServer ] && [ $nextcloudBackupUser ] && [ $nextcloudBackupPassword ]; then NextcloudBackup="on"; fi
|
||||||
|
|
||||||
|
echo "# map localbackup to on/off"
|
||||||
LocalBackup="off"
|
LocalBackup="off"
|
||||||
if [ ${#localBackupDeviceUUID} -gt 0 ] && [ "${localBackupDeviceUUID}" != "off" ]; then LocalBackup="on"; fi
|
if [ ${#localBackupDeviceUUID} -gt 0 ] && [ "${localBackupDeviceUUID}" != "off" ]; then LocalBackup="on"; fi
|
||||||
|
|
||||||
echo "map zerotier to on/off"
|
echo "# map zerotier to on/off"
|
||||||
zerotierSwitch="off"
|
zerotierSwitch="off"
|
||||||
if [ "${zerotier}" != "off" ]; then zerotierSwitch="on"; fi
|
if [ "${zerotier}" != "off" ]; then zerotierSwitch="on"; fi
|
||||||
|
|
||||||
echo "map chain to on/off"
|
echo "# map parallel testnets to on/off"
|
||||||
chainValue="off"
|
parallelTestnets="off"
|
||||||
if [ "${chain}" = "test" ]; then chainValue="on"; fi
|
if [ "${testnet}" == "on" ] || [ "${signet}" == "on" ]; then
|
||||||
|
parallelTestnets="on"
|
||||||
|
fi
|
||||||
|
|
||||||
echo "map domain to on/off"
|
echo "# map domain to on/off"
|
||||||
domainValue="off"
|
domainValue="off"
|
||||||
dynDomainMenu='DynamicDNS'
|
dynDomainMenu='DynamicDNS'
|
||||||
if [ ${#dynDomain} -gt 0 ]; then
|
if [ ${#dynDomain} -gt 0 ]; then
|
||||||
|
@ -41,175 +57,118 @@ if [ ${#dynDomain} -gt 0 ]; then
|
||||||
dynDomainMenu="${dynDomain}"
|
dynDomainMenu="${dynDomain}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "map lcdrotate to on/off"
|
echo "# map lcdrotate to on/off"
|
||||||
lcdrotateMenu='off'
|
lcdrotateMenu='off'
|
||||||
if [ ${lcdrotate} -gt 0 ]; then
|
if [ ${lcdrotate} -gt 0 ]; then
|
||||||
lcdrotateMenu='on'
|
lcdrotateMenu='on'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "map touchscreen to on/off"
|
echo "# map touchscreen to on/off"
|
||||||
touchscreenMenu='off'
|
touchscreenMenu='off'
|
||||||
if [ ${touchscreen} -gt 0 ]; then
|
if [ ${touchscreen} -gt 0 ]; then
|
||||||
touchscreenMenu='on'
|
touchscreenMenu='on'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "check autopilot by lnd.conf"
|
echo "# map autopilot to on/off"
|
||||||
lndAutoPilotOn=$(sudo cat /mnt/hdd/lnd/lnd.conf | grep -c 'autopilot.active=1')
|
lndAutoPilotOn=$(sudo cat /mnt/hdd/lnd/lnd.conf 2>/dev/null | grep -c 'autopilot.active=1')
|
||||||
if [ ${lndAutoPilotOn} -eq 1 ]; then
|
if [ ${lndAutoPilotOn} -eq 1 ]; then
|
||||||
autoPilot="on"
|
autoPilot="on"
|
||||||
else
|
else
|
||||||
autoPilot="off"
|
autoPilot="off"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "map keysend to on/off"
|
echo "# map keysend to on/off"
|
||||||
keysend="on"
|
keysend="on"
|
||||||
source <(sudo /home/admin/config.scripts/lnd.keysend.sh status)
|
source <(sudo /home/admin/config.scripts/lnd.keysend.sh status)
|
||||||
if [ ${keysendOn} -eq 0 ]; then
|
if [ ${keysendOn} -eq 0 ]; then
|
||||||
keysend="off"
|
keysend="off"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "# map clboss to on/off"
|
||||||
|
clbossMenu='off'
|
||||||
|
if [ "${clboss}" == "on" ]; then
|
||||||
|
clbossMenu='on'
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "# map clEncryptedHSM to on/off"
|
||||||
|
clEncryptedHSMMenu='off'
|
||||||
|
if [ "${clEncryptedHSM}" == "on" ]; then
|
||||||
|
clEncryptedHSMMenu='on'
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "# map clAutoUnlock to on/off"
|
||||||
|
clAutoUnlockMenu='off'
|
||||||
|
if [ "${clAutoUnlock}" == "on" ]; then
|
||||||
|
clAutoUnlockMenu='on'
|
||||||
|
fi
|
||||||
|
|
||||||
# show select dialog
|
# show select dialog
|
||||||
echo "run dialog ..."
|
echo "run dialog ..."
|
||||||
|
|
||||||
|
|
||||||
# BASIC MENU INFO
|
# BASIC MENU INFO
|
||||||
HEIGHT=19 # add 6 to CHOICE_HEIGHT + MENU lines
|
|
||||||
WIDTH=45
|
|
||||||
CHOICE_HEIGHT=11 # 1 line / OPTIONS
|
|
||||||
OPTIONS=()
|
OPTIONS=()
|
||||||
|
|
||||||
OPTIONS+=(t 'Run behind TOR' ${runBehindTor})
|
# LCD options (only when running with LCD screen)
|
||||||
if [ "${displayClass}" == "lcd" ]; then
|
if [ "${displayClass}" == "lcd" ]; then
|
||||||
OPTIONS+=(s 'Touchscreen' ${touchscreenMenu})
|
OPTIONS+=(s 'Touchscreen' ${touchscreenMenu})
|
||||||
OPTIONS+=(r 'LCD Rotate' ${lcdrotateMenu})
|
OPTIONS+=(r 'LCD Rotate' ${lcdrotateMenu})
|
||||||
fi
|
fi
|
||||||
OPTIONS+=(a 'Channel Autopilot' ${autoPilot})
|
|
||||||
OPTIONS+=(k 'Accept Keysend' ${keysend})
|
# Important basic options
|
||||||
OPTIONS+=(n 'Testnet' ${chainValue})
|
OPTIONS+=(t 'Run behind Tor' ${runBehindTor})
|
||||||
OPTIONS+=(c 'Circuitbreaker (LND firewall)' ${circuitbreaker})
|
|
||||||
OPTIONS+=(u 'LND Auto-Unlock' ${autoUnlock})
|
|
||||||
OPTIONS+=(d 'StaticChannelBackup on DropBox' ${DropboxBackup})
|
|
||||||
OPTIONS+=(e 'StaticChannelBackup on USB Drive' ${LocalBackup})
|
|
||||||
OPTIONS+=(z 'ZeroTier' ${zerotierSwitch})
|
OPTIONS+=(z 'ZeroTier' ${zerotierSwitch})
|
||||||
|
|
||||||
if [ ${#runBehindTor} -eq 0 ] || [ "${runBehindTor}" = "off" ]; then
|
if [ ${#runBehindTor} -eq 0 ] || [ "${runBehindTor}" = "off" ]; then
|
||||||
OPTIONS+=(y ${dynDomainMenu} ${domainValue})
|
OPTIONS+=(y ${dynDomainMenu} ${domainValue})
|
||||||
OPTIONS+=(b 'BTC UPnP (AutoNAT)' ${networkUPnP})
|
OPTIONS+=(b 'BTC UPnP (AutoNAT)' ${networkUPnP})
|
||||||
OPTIONS+=(l 'LND UPnP (AutoNAT)' ${autoNatDiscovery})
|
fi
|
||||||
fi
|
OPTIONS+=(p 'Parallel Testnet/Signet' ${parallelTestnets})
|
||||||
|
|
||||||
CHOICES=$(dialog \
|
# LND & options (only when running LND)
|
||||||
--title ' Node Settings & Options ' \
|
OPTIONS+=(m 'LND LIGHTNING LABS NODE' ${lndNode})
|
||||||
--checklist ' use spacebar to activate/de-activate ' \
|
if [ "${lndNode}" == "on" ]; then
|
||||||
$HEIGHT $WIDTH $CHOICE_HEIGHT \
|
OPTIONS+=(a '-LND Channel Autopilot' ${autoPilot})
|
||||||
"${OPTIONS[@]}" 2>&1 >/dev/tty)
|
OPTIONS+=(k '-LND Accept Keysend' ${keysend})
|
||||||
|
OPTIONS+=(c '-LND Circuitbreaker (firewall)' ${circuitbreaker})
|
||||||
|
OPTIONS+=(u '-LND Auto-Unlock' ${autoUnlock})
|
||||||
|
OPTIONS+=(x '-LND StaticChannelBackup on Nextcloud' ${NextcloudBackup})
|
||||||
|
OPTIONS+=(e '-LND StaticChannelBackup USB Drive' ${LocalBackup})
|
||||||
|
OPTIONS+=(l '-LND UPnP (AutoNAT)' ${autoNatDiscovery})
|
||||||
|
fi
|
||||||
|
|
||||||
|
# C-Lightning & options/PlugIns
|
||||||
|
OPTIONS+=(n 'CL C-LIGHTNING NODE' ${clNode})
|
||||||
|
if [ "${clNode}" == "on" ]; then
|
||||||
|
OPTIONS+=(o '-CL CLBOSS Automatic Node Manager' ${clbossMenu})
|
||||||
|
OPTIONS+=(h '-CL Wallet Encryption' ${clEncryptedHSMMenu})
|
||||||
|
if [ "${clEncryptedHSM}" == "on" ]; then
|
||||||
|
OPTIONS+=(q '-CL Auto-Unlock' ${clAutoUnlockMenu})
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
CHOICE_HEIGHT=$(("${#OPTIONS[@]}/2+1"))
|
||||||
|
HEIGHT=$((CHOICE_HEIGHT+6))
|
||||||
|
CHOICES=$(dialog --title ' Node Settings & Options ' --checklist ' use spacebar to activate/de-activate ' $HEIGHT 55 $CHOICE_HEIGHT "${OPTIONS[@]}" 2>&1 >/dev/tty)
|
||||||
dialogcancel=$?
|
dialogcancel=$?
|
||||||
echo "done dialog"
|
|
||||||
clear
|
clear
|
||||||
|
|
||||||
# check if user canceled dialog
|
# check if user canceled dialog
|
||||||
echo "dialogcancel(${dialogcancel})"
|
echo "dialogcancel(${dialogcancel}) (${CHOICE_HEIGHT})"
|
||||||
if [ ${dialogcancel} -eq 1 ]; then
|
if [ ${dialogcancel} -eq 1 ]; then
|
||||||
echo "user canceled"
|
echo "user canceled"
|
||||||
exit 1
|
exit 0
|
||||||
elif [ ${dialogcancel} -eq 255 ]; then
|
elif [ ${dialogcancel} -eq 255 ]; then
|
||||||
echo "ESC pressed"
|
echo "ESC pressed"
|
||||||
exit 1
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
needsReboot=0
|
needsReboot=0
|
||||||
anychange=0
|
anychange=0
|
||||||
|
|
||||||
# TESTNET process choice - KEEP FIRST IN ORDER
|
# LND AUTOPILOT process choice
|
||||||
choice="main"; check=$(echo "${CHOICES}" | grep -c "n")
|
|
||||||
if [ ${check} -eq 1 ]; then choice="test"; fi
|
|
||||||
if [ "${chain}" != "${choice}" ]; then
|
|
||||||
if [ "${network}" = "litecoin" ] && [ "${choice}"="test" ]; then
|
|
||||||
dialog --title 'FAIL' --msgbox 'Litecoin-Testnet not available.' 5 25
|
|
||||||
elif [ "${BTCRPCexplorer}" = "on" ]; then
|
|
||||||
dialog --title 'NOTICE' --msgbox 'Please turn off BTC-RPC-Explorer FIRST\nbefore changing testnet.' 6 45
|
|
||||||
exit 1
|
|
||||||
elif [ "${BTCPayServer}" = "on" ]; then
|
|
||||||
dialog --title 'NOTICE' --msgbox 'Please turn off BTC-Pay-Server FIRST\nbefore changing testnet.' 6 45
|
|
||||||
exit 1
|
|
||||||
elif [ "${ElectRS}" = "on" ]; then
|
|
||||||
dialog --title 'NOTICE' --msgbox 'Please turn off Electrum-Rust-Server FIRST\nbefore changing testnet.' 6 48
|
|
||||||
exit 1
|
|
||||||
elif [ "${loop}" = "on" ]; then
|
|
||||||
dialog --title 'NOTICE' --msgbox 'Please turn off Loop-Service FIRST\nbefore changing testnet.' 6 48
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
echo "Testnet Setting changed .."
|
|
||||||
anychange=1
|
|
||||||
sudo /home/admin/config.scripts/network.chain.sh ${choice}net
|
|
||||||
walletExists=$(sudo ls /mnt/hdd/lnd/data/chain/${network}/${choice}net/wallet.db 2>/dev/null | grep -c 'wallet.db')
|
|
||||||
if [ ${walletExists} -eq 0 ]; then
|
|
||||||
echo "Need to creating a new wallet ... wait 20secs"
|
|
||||||
sudo systemctl start lnd
|
|
||||||
sleep 20
|
|
||||||
tryAgain=1
|
|
||||||
while [ ${tryAgain} -eq 1 ]
|
|
||||||
do
|
|
||||||
echo "****************************************************************************"
|
|
||||||
echo "Creating a new LND Wallet for ${network}/${choice}net"
|
|
||||||
echo "****************************************************************************"
|
|
||||||
echo "A) For 'Wallet Password' use your PASSWORD C --> !! minimum 8 characters !!"
|
|
||||||
echo "B) Answer 'n' because you don't have a 'cipher seed mnemonic' (24 words) yet"
|
|
||||||
echo "C) For 'passphrase' to encrypt your 'cipher seed' use PASSWORD D (optional)"
|
|
||||||
echo "****************************************************************************"
|
|
||||||
sudo -u bitcoin /usr/local/bin/lncli --chain=${network} --network=${chain}net create 2>error.out
|
|
||||||
error=`sudo cat error.out`
|
|
||||||
if [ ${#error} -eq 0 ]; then
|
|
||||||
sleep 2
|
|
||||||
# WIN
|
|
||||||
tryAgain=0
|
|
||||||
echo "!!! Make sure to write down the 24 words (cipher seed mnemonic) !!!"
|
|
||||||
echo "If you are ready. Press ENTER."
|
|
||||||
else
|
|
||||||
# FAIL
|
|
||||||
tryAgain=1
|
|
||||||
echo "!!! FAIL ---> SOMETHING WENT WRONG !!!"
|
|
||||||
echo "${error}"
|
|
||||||
echo "Press ENTER to retry ... or CTRL-c to EXIT"
|
|
||||||
fi
|
|
||||||
read key
|
|
||||||
done
|
|
||||||
echo "Check for Macaroon .. (10sec)"
|
|
||||||
sleep 10
|
|
||||||
macaroonExists=$(sudo ls /home/bitcoin/.lnd/data/chain/${network}/${choice}net/admin.macaroon | grep -c 'admin.macaroon')
|
|
||||||
if [ ${macaroonExists} -eq 0 ]; then
|
|
||||||
echo "*** PLEASE UNLOCK your wallet with PASSWORD C to create macaroon"
|
|
||||||
lncli unlock 2>/dev/null
|
|
||||||
sleep 6
|
|
||||||
fi
|
|
||||||
macaroonExists=$(sudo ls /home/bitcoin/.lnd/data/chain/${network}/${choice}net/admin.macaroon | grep -c 'admin.macaroon')
|
|
||||||
if [ ${macaroonExists} -eq 0 ]; then
|
|
||||||
echo "FAIL --> Was not able to create macaroon"
|
|
||||||
echo "Please report problem."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "stopping lnd again"
|
|
||||||
sleep 5
|
|
||||||
sudo systemctl stop lnd
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Update Admin Macaroon"
|
|
||||||
sudo rm -r /home/admin/.lnd/data/chain/${network}/${choice}net 2>/dev/null
|
|
||||||
sudo mkdir /home/admin/.lnd/data/chain/${network}/${choice}net
|
|
||||||
sudo cp /home/bitcoin/.lnd/data/chain/${network}/${choice}net/admin.macaroon /home/admin/.lnd/data/chain/${network}/${choice}net
|
|
||||||
sudo chown -R admin:admin /home/admin/.lnd/
|
|
||||||
|
|
||||||
needsReboot=1
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "Testnet Setting unchanged."
|
|
||||||
fi
|
|
||||||
|
|
||||||
# AUTOPILOT process choice
|
|
||||||
choice="off"; check=$(echo "${CHOICES}" | grep -c "a")
|
choice="off"; check=$(echo "${CHOICES}" | grep -c "a")
|
||||||
if [ ${check} -eq 1 ]; then choice="on"; fi
|
if [ ${check} -eq 1 ]; then choice="on"; fi
|
||||||
if [ "${autoPilot}" != "${choice}" ]; then
|
if [ "${autoPilot}" != "${choice}" ] && [ "${lndNode}" == "on" ]; then
|
||||||
echo "Autopilot Setting changed .."
|
echo "Autopilot Setting changed .."
|
||||||
anychange=1
|
anychange=1
|
||||||
sudo /home/admin/config.scripts/lnd.autopilot.sh ${choice}
|
sudo /home/admin/config.scripts/lnd.autopilot.sh ${choice}
|
||||||
|
@ -251,10 +210,10 @@ else
|
||||||
echo "BTC UPnP Setting unchanged."
|
echo "BTC UPnP Setting unchanged."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# AutoNAT
|
# LND AutoNAT
|
||||||
choice="off"; check=$(echo "${CHOICES}" | grep -c "l")
|
choice="off"; check=$(echo "${CHOICES}" | grep -c "l")
|
||||||
if [ ${check} -eq 1 ]; then choice="on"; fi
|
if [ ${check} -eq 1 ]; then choice="on"; fi
|
||||||
if [ "${autoNatDiscovery}" != "${choice}" ]; then
|
if [ "${autoNatDiscovery}" != "${choice}" ] && [ "${lndNode}" == "on" ]; then
|
||||||
echo "AUTO NAT Setting changed .."
|
echo "AUTO NAT Setting changed .."
|
||||||
anychange=1
|
anychange=1
|
||||||
if [ "${choice}" = "on" ]; then
|
if [ "${choice}" = "on" ]; then
|
||||||
|
@ -272,20 +231,20 @@ else
|
||||||
echo "LND AUTONAT Setting unchanged."
|
echo "LND AUTONAT Setting unchanged."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# TOR process choice
|
# Tor process choice
|
||||||
choice="off"; check=$(echo "${CHOICES}" | grep -c "t")
|
choice="off"; check=$(echo "${CHOICES}" | grep -c "t")
|
||||||
if [ ${check} -eq 1 ]; then choice="on"; fi
|
if [ ${check} -eq 1 ]; then choice="on"; fi
|
||||||
if [ "${runBehindTor}" != "${choice}" ]; then
|
if [ "${runBehindTor}" != "${choice}" ]; then
|
||||||
echo "TOR Setting changed .."
|
echo "Tor Setting changed .."
|
||||||
|
|
||||||
# special actions if TOR is turned on
|
# special actions if Tor is turned on
|
||||||
if [ "${choice}" = "on" ]; then
|
if [ "${choice}" = "on" ]; then
|
||||||
|
|
||||||
# inform user about privacy risk
|
# inform user about privacy risk
|
||||||
whiptail --title " PRIVACY NOTICE " --msgbox "
|
whiptail --title " PRIVACY NOTICE " --msgbox "
|
||||||
RaspiBlitz will now install/activate TOR & after reboot run behind it.
|
RaspiBlitz will now install/activate Tor & after reboot run behind it.
|
||||||
|
|
||||||
Please keep in mind that thru your LND node id & your previous IP history with your internet provider your lightning node could still be linked to your personal id even when running behind TOR. To unlink you from that IP history its recommended that after the switch/reboot to TOR you also use the REPAIR > RESET-LND option to create a fresh LND wallet. That might involve closing all channels & move your funds out of RaspiBlitz before that RESET-LND.
|
Please keep in mind that thru your LND node id & your previous IP history with your internet provider your lightning node could still be linked to your personal id even when running behind Tor. To unlink you from that IP history its recommended that after the switch/reboot to Tor you also use the REPAIR > RESET-LND option to create a fresh LND wallet. That might involve closing all channels & move your funds out of RaspiBlitz before that RESET-LND.
|
||||||
" 16 76
|
" 16 76
|
||||||
|
|
||||||
# make sure AutoNAT & UPnP is off
|
# make sure AutoNAT & UPnP is off
|
||||||
|
@ -293,19 +252,19 @@ Please keep in mind that thru your LND node id & your previous IP history with y
|
||||||
/home/admin/config.scripts/network.upnp.sh off
|
/home/admin/config.scripts/network.upnp.sh off
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# change TOR
|
# change Tor
|
||||||
anychange=1
|
anychange=1
|
||||||
sudo /home/admin/config.scripts/internet.tor.sh ${choice}
|
sudo /home/admin/config.scripts/internet.tor.sh ${choice}
|
||||||
needsReboot=1
|
needsReboot=1
|
||||||
|
|
||||||
else
|
else
|
||||||
echo "TOR Setting unchanged."
|
echo "Tor Setting unchanged."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# LND Auto-Unlock
|
# LND Auto-Unlock
|
||||||
choice="off"; check=$(echo "${CHOICES}" | grep -c "u")
|
choice="off"; check=$(echo "${CHOICES}" | grep -c "u")
|
||||||
if [ ${check} -eq 1 ]; then choice="on"; fi
|
if [ ${check} -eq 1 ]; then choice="on"; fi
|
||||||
if [ "${autoUnlock}" != "${choice}" ]; then
|
if [ "${autoUnlock}" != "${choice}" ] && [ "${lndNode}" == "on" ]; then
|
||||||
echo "LND Autounlock Setting changed .."
|
echo "LND Autounlock Setting changed .."
|
||||||
anychange=1
|
anychange=1
|
||||||
sudo /home/admin/config.scripts/lnd.autounlock.sh ${choice}
|
sudo /home/admin/config.scripts/lnd.autounlock.sh ${choice}
|
||||||
|
@ -348,10 +307,10 @@ else
|
||||||
echo "Touchscreen Setting unchanged."
|
echo "Touchscreen Setting unchanged."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# circuitbreaker
|
# LND circuitbreaker
|
||||||
choice="off"; check=$(echo "${CHOICES}" | grep -c "c")
|
choice="off"; check=$(echo "${CHOICES}" | grep -c "c")
|
||||||
if [ ${check} -eq 1 ]; then choice="on"; fi
|
if [ ${check} -eq 1 ]; then choice="on"; fi
|
||||||
if [ "${circuitbreaker}" != "${choice}" ]; then
|
if [ "${circuitbreaker}" != "${choice}" ] && [ "${lndNode}" == "on" ]; then
|
||||||
echo "Circuitbreaker Setting changed .."
|
echo "Circuitbreaker Setting changed .."
|
||||||
anychange=1
|
anychange=1
|
||||||
sudo /home/admin/config.scripts/bonus.circuitbreaker.sh ${choice}
|
sudo /home/admin/config.scripts/bonus.circuitbreaker.sh ${choice}
|
||||||
|
@ -359,20 +318,20 @@ else
|
||||||
echo "Circuitbreaker Setting unchanged."
|
echo "Circuitbreaker Setting unchanged."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# DropBox process choice
|
# Nextcloud process choice
|
||||||
choice="off"; check=$(echo "${CHOICES}" | grep -c "d")
|
choice="off"; check=$(echo "${CHOICES}" | grep -c "x")
|
||||||
if [ ${check} -eq 1 ]; then choice="on"; fi
|
if [ ${check} -eq 1 ]; then choice="on"; fi
|
||||||
if [ "${DropboxBackup}" != "${choice}" ]; then
|
if [ "${NextcloudBackup}" != "${choice}" ]; then
|
||||||
echo "DropBox Setting changed .."
|
echo "Nextcloud Setting changed .."
|
||||||
anychange=1
|
anychange=1
|
||||||
sudo -u admin /home/admin/config.scripts/dropbox.upload.sh ${choice}
|
sudo -u admin /home/admin/config.scripts/nextcloud.upload.sh ${choice}
|
||||||
if [ "${choice}" = "on" ]; then
|
if [ "${choice}" = "on" ]; then
|
||||||
# doing initial upload so that user can see result
|
# doing initial upload so that user can see result
|
||||||
source /mnt/hdd/raspiblitz.conf
|
source /mnt/hdd/raspiblitz.conf
|
||||||
sudo /home/admin/config.scripts/dropbox.upload.sh upload ${dropboxBackupTarget} /mnt/hdd/lnd/data/chain/${network}/${chain}net/channel.backup
|
sudo /home/admin/config.scripts/nextcloud.upload.sh upload /mnt/hdd/lnd/data/chain/${network}/${chain}net/channel.backup
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "Dropbox backup setting unchanged."
|
echo "Nextcloud backup setting unchanged."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# LocalBackup process choice
|
# LocalBackup process choice
|
||||||
|
@ -386,15 +345,16 @@ else
|
||||||
echo "BackupdDevice setting unchanged."
|
echo "BackupdDevice setting unchanged."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Keysend process choice
|
# LND Keysend process choice
|
||||||
choice="off"; check=$(echo "${CHOICES}" | grep -c "k")
|
choice="off"; check=$(echo "${CHOICES}" | grep -c "k")
|
||||||
if [ ${check} -eq 1 ]; then choice="on"; fi
|
if [ ${check} -eq 1 ]; then choice="on"; fi
|
||||||
if [ "${keysend}" != "${choice}" ]; then
|
if [ "${keysend}" != "${choice}" ] && [ "${lndNode}" == "on" ]; then
|
||||||
echo "keysend setting changed .."
|
echo "keysend setting changed .."
|
||||||
anychange=1
|
anychange=1
|
||||||
needsReboot=1
|
|
||||||
sudo -u admin /home/admin/config.scripts/lnd.keysend.sh ${choice}
|
sudo -u admin /home/admin/config.scripts/lnd.keysend.sh ${choice}
|
||||||
dialog --msgbox "Accept Keysend is now ${choice} after Reboot." 5 46
|
sudo systemctl restart lnd
|
||||||
|
dialog --msgbox "Accept Keysend on LND mainnet is now ${choice}.\n\nLND restarted - you might need to unlock wallet." 7 52
|
||||||
|
sudo -u admin /home/admin/config.scripts/lnd.unlock.sh
|
||||||
else
|
else
|
||||||
echo "keysend setting unchanged."
|
echo "keysend setting unchanged."
|
||||||
fi
|
fi
|
||||||
|
@ -423,6 +383,134 @@ else
|
||||||
echo "ZeroTier setting unchanged."
|
echo "ZeroTier setting unchanged."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# LND choice
|
||||||
|
choice="off"; check=$(echo "${CHOICES}" | grep -c "m")
|
||||||
|
if [ ${check} -eq 1 ]; then choice="on"; fi
|
||||||
|
if [ "${lndNode}" != "${choice}" ]; then
|
||||||
|
anychange=1
|
||||||
|
echo "# LND NODE Setting changed .."
|
||||||
|
if [ "${choice}" = "on" ]; then
|
||||||
|
echo "# turning ON"
|
||||||
|
/home/admin/config.scripts/lnd.install.sh on mainnet initwallet
|
||||||
|
sudo /home/admin/config.scripts/lnd.install.sh display-seed mainnet delete
|
||||||
|
if [ "${testnet}" == "on" ]; then
|
||||||
|
/home/admin/config.scripts/lnd.install.sh on testnet initwallet
|
||||||
|
fi
|
||||||
|
if [ "${signet}" == "on" ]; then
|
||||||
|
/home/admin/config.scripts/lnd.install.sh on signet initwallet
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "# turning OFF"
|
||||||
|
/home/admin/config.scripts/lnd.install.sh off mainnet
|
||||||
|
/home/admin/config.scripts/lnd.install.sh off testnet
|
||||||
|
/home/admin/config.scripts/lnd.install.sh off signet
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "LND NODE setting unchanged."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# CL choice
|
||||||
|
choice="off"; check=$(echo "${CHOICES}" | grep -c "n")
|
||||||
|
if [ ${check} -eq 1 ]; then choice="on"; fi
|
||||||
|
if [ "${clNode}" != "${choice}" ]; then
|
||||||
|
anychange=1
|
||||||
|
echo "# C-Lightning NODE Setting changed .."
|
||||||
|
if [ "${choice}" = "on" ]; then
|
||||||
|
echo "# turning ON"
|
||||||
|
/home/admin/config.scripts/cl.install.sh on mainnet
|
||||||
|
sudo /home/admin/config.scripts/cl.install.sh display-seed mainnet
|
||||||
|
if [ "${testnet}" == "on" ]; then
|
||||||
|
/home/admin/config.scripts/cl.install.sh on testnet
|
||||||
|
fi
|
||||||
|
if [ "${signet}" == "on" ]; then
|
||||||
|
/home/admin/config.scripts/cl.install.sh on signet
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "# turning OFF"
|
||||||
|
/home/admin/config.scripts/cl.install.sh off mainnet
|
||||||
|
/home/admin/config.scripts/cl.install.sh off testnet
|
||||||
|
/home/admin/config.scripts/cl.install.sh off signet
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "C-Lightning NODE setting unchanged."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# CLBOSS process choice
|
||||||
|
choice="off"; check=$(echo "${CHOICES}" | grep -c "o")
|
||||||
|
if [ ${check} -eq 1 ]; then choice="on"; fi
|
||||||
|
if [ "${clboss}" != "${choice}" ] && [ "${clNode}" == "on" ]; then
|
||||||
|
echo "CLBOSS Setting changed .."
|
||||||
|
anychange=1
|
||||||
|
sudo /home/admin/config.scripts/cl-plugin.clboss.sh ${choice}
|
||||||
|
needsReboot=0
|
||||||
|
else
|
||||||
|
echo "CLBOSS Setting unchanged."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# clEncryptedHSM process choice
|
||||||
|
choice="off"; check=$(echo "${CHOICES}" | grep -c "h")
|
||||||
|
if [ ${check} -eq 1 ]; then choice="on"; fi
|
||||||
|
if [ "${clEncryptedHSM}" != "${choice}" ] && [ "${clNode}" == "on" ]; then
|
||||||
|
echo "clEncryptedHSM Setting changed .."
|
||||||
|
anychange=1
|
||||||
|
if [ "${choice}" == "on" ]; then
|
||||||
|
/home/admin/config.scripts/cl.hsmtool.sh encrypt mainnet
|
||||||
|
else
|
||||||
|
/home/admin/config.scripts/cl.hsmtool.sh decrypt mainnet
|
||||||
|
fi
|
||||||
|
needsReboot=0
|
||||||
|
else
|
||||||
|
echo "clEncryptedHSM Setting unchanged."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# clAutoUnlock process choice
|
||||||
|
choice="off"; check=$(echo "${CHOICES}" | grep -c "q")
|
||||||
|
if [ ${check} -eq 1 ]; then choice="on"; fi
|
||||||
|
if [ "${clAutoUnlock}" != "${choice}" ] && [ "${clNode}" == "on" ]; then
|
||||||
|
echo "clAutoUnlock Setting changed .."
|
||||||
|
anychange=1
|
||||||
|
if [ "${choice}" == "on" ]; then
|
||||||
|
/home/admin/config.scripts/cl.hsmtool.sh autounlock-on mainnet
|
||||||
|
else
|
||||||
|
/home/admin/config.scripts/cl.hsmtool.sh autounlock-off mainnet
|
||||||
|
fi
|
||||||
|
needsReboot=0
|
||||||
|
else
|
||||||
|
echo "clAutoUnlock Setting unchanged."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# parallel testnet process choice
|
||||||
|
choice="off"; check=$(echo "${CHOICES}" | grep -c "p")
|
||||||
|
if [ ${check} -eq 1 ]; then choice="on"; fi
|
||||||
|
if [ "${testnet}" != "${choice}" ]; then
|
||||||
|
echo "# Parallel Testnets Setting changed .."
|
||||||
|
anychange=1
|
||||||
|
if [ "${choice}" = "on" ]; then
|
||||||
|
/home/admin/config.scripts/bitcoin.install.sh on testnet
|
||||||
|
/home/admin/config.scripts/bitcoin.install.sh on signet
|
||||||
|
if [ "${lightning}" == "lnd" ] || [ "${lnd}" == "on" ]; then
|
||||||
|
/home/admin/config.scripts/lnd.install.sh on testnet initwallet
|
||||||
|
/home/admin/config.scripts/lnd.install.sh on signet initwallet
|
||||||
|
fi
|
||||||
|
if [ "${lightning}" == "cl" ] || [ "${cl}" == "on" ]; then
|
||||||
|
/home/admin/config.scripts/cl.install.sh on testnet
|
||||||
|
/home/admin/config.scripts/cl.install.sh on signet
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# just turn al lightning testnets off (even if not on before)
|
||||||
|
/home/admin/config.scripts/lnd.install.sh off testnet
|
||||||
|
/home/admin/config.scripts/lnd.install.sh off signet
|
||||||
|
/home/admin/config.scripts/cl.install.sh off testnet
|
||||||
|
/home/admin/config.scripts/cl.install.sh off signet
|
||||||
|
/home/admin/config.scripts/bitcoin.install.sh off testnet
|
||||||
|
/home/admin/config.scripts/bitcoin.install.sh off signet
|
||||||
|
fi
|
||||||
|
# make sure to reboot - nodes that people activate testnets can take a reboot
|
||||||
|
needsReboot=1
|
||||||
|
else
|
||||||
|
echo "# Testnet Setting unchanged."
|
||||||
|
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
|
||||||
|
@ -436,5 +524,5 @@ if [ ${needsReboot} -eq 1 ]; then
|
||||||
# stop bitcoind
|
# stop bitcoind
|
||||||
sudo -u bitcoin ${network}-cli stop
|
sudo -u bitcoin ${network}-cli stop
|
||||||
sleep 4
|
sleep 4
|
||||||
sudo /home/admin/XXshutdown.sh reboot
|
sudo /home/admin/config.scripts/blitz.shutdown.sh reboot
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -6,7 +6,9 @@ source /home/admin/raspiblitz.info
|
||||||
source /mnt/hdd/raspiblitz.conf
|
source /mnt/hdd/raspiblitz.conf
|
||||||
|
|
||||||
echo "services default values"
|
echo "services default values"
|
||||||
|
if [ ${#runBehindTor} -eq 0 ]; then runBehindTor="off"; fi
|
||||||
if [ ${#rtlWebinterface} -eq 0 ]; then rtlWebinterface="off"; fi
|
if [ ${#rtlWebinterface} -eq 0 ]; then rtlWebinterface="off"; fi
|
||||||
|
if [ ${#crtlWebinterface} -eq 0 ]; then crtlWebinterface="off"; fi
|
||||||
if [ ${#BTCRPCexplorer} -eq 0 ]; then BTCRPCexplorer="off"; fi
|
if [ ${#BTCRPCexplorer} -eq 0 ]; then BTCRPCexplorer="off"; fi
|
||||||
if [ ${#specter} -eq 0 ]; then specter="off"; fi
|
if [ ${#specter} -eq 0 ]; then specter="off"; fi
|
||||||
if [ ${#BTCPayServer} -eq 0 ]; then BTCPayServer="off"; fi
|
if [ ${#BTCPayServer} -eq 0 ]; then BTCPayServer="off"; fi
|
||||||
|
@ -22,30 +24,47 @@ if [ ${#sphinxrelay} -eq 0 ]; then sphinxrelay="off"; fi
|
||||||
if [ ${#lit} -eq 0 ]; then lit="off"; fi
|
if [ ${#lit} -eq 0 ]; then lit="off"; fi
|
||||||
if [ ${#whitepaper} -eq 0 ]; then whitepaper="off"; fi
|
if [ ${#whitepaper} -eq 0 ]; then whitepaper="off"; fi
|
||||||
if [ ${#chantools} -eq 0 ]; then chantools="off"; fi
|
if [ ${#chantools} -eq 0 ]; then chantools="off"; fi
|
||||||
|
if [ ${#sparko} -eq 0 ]; then sparko="off"; fi
|
||||||
|
if [ ${#spark} -eq 0 ]; then spark="off"; fi
|
||||||
|
|
||||||
# show select dialog
|
# show select dialog
|
||||||
echo "run dialog ..."
|
echo "run dialog ..."
|
||||||
|
|
||||||
OPTIONS=()
|
OPTIONS=()
|
||||||
OPTIONS+=(e 'Electrum Rust Server' ${ElectRS})
|
|
||||||
OPTIONS+=(r 'RTL Webinterface' ${rtlWebinterface})
|
|
||||||
OPTIONS+=(t 'ThunderHub' ${thunderhub})
|
|
||||||
OPTIONS+=(l 'LIT (loop, pool, faraday)' ${lit})
|
|
||||||
OPTIONS+=(p 'BTCPayServer' ${BTCPayServer})
|
|
||||||
OPTIONS+=(i 'LNbits' ${LNBits})
|
|
||||||
OPTIONS+=(b 'BTC-RPC-Explorer' ${BTCRPCexplorer})
|
|
||||||
OPTIONS+=(s 'Cryptoadvance Specter' ${specter})
|
|
||||||
OPTIONS+=(a 'Mempool Space' ${mempoolExplorer})
|
|
||||||
OPTIONS+=(j 'JoinMarket' ${joinmarket})
|
|
||||||
OPTIONS+=(o 'Balance of Satoshis' ${bos})
|
|
||||||
OPTIONS+=(x 'Sphinx-Relay' ${sphinxrelay})
|
|
||||||
OPTIONS+=(y 'PyBLOCK' ${pyblock})
|
|
||||||
OPTIONS+=(c 'ChannelTools (Fund Rescue)' ${chantools})
|
|
||||||
OPTIONS+=(w 'Download Bitcoin Whitepaper' ${whitepaper})
|
|
||||||
|
|
||||||
CHOICES=$(dialog --title ' Additional Services ' \
|
# just available for BTC
|
||||||
|
if [ "${network}" == "bitcoin" ]; then
|
||||||
|
OPTIONS+=(e 'BTC Electrum Rust Server' ${ElectRS})
|
||||||
|
OPTIONS+=(p 'BTC PayServer' ${BTCPayServer})
|
||||||
|
OPTIONS+=(b 'BTC RPC-Explorer' ${BTCRPCexplorer})
|
||||||
|
OPTIONS+=(s 'BTC Specter Desktop' ${specter})
|
||||||
|
OPTIONS+=(a 'BTC Mempool Space' ${mempoolExplorer})
|
||||||
|
OPTIONS+=(j 'BTC JoinMarket+JoininBox menu' ${joinmarket})
|
||||||
|
OPTIONS+=(w 'BTC Download Bitcoin Whitepaper' ${whitepaper})
|
||||||
|
fi
|
||||||
|
|
||||||
|
# just available for LND
|
||||||
|
if [ "${lightning}" == "lnd" ] || [ "${lnd}" == "on" ]; then
|
||||||
|
OPTIONS+=(r 'LND RTL Webinterface' ${rtlWebinterface})
|
||||||
|
OPTIONS+=(t 'LND ThunderHub' ${thunderhub})
|
||||||
|
OPTIONS+=(l 'LND LIT (loop, pool, faraday)' ${lit})
|
||||||
|
OPTIONS+=(i 'LND LNbits' ${LNBits})
|
||||||
|
OPTIONS+=(o 'LND Balance of Satoshis' ${bos})
|
||||||
|
OPTIONS+=(y 'LND PyBLOCK' ${pyblock})
|
||||||
|
OPTIONS+=(h 'LND ChannelTools (Fund Rescue)' ${chantools})
|
||||||
|
OPTIONS+=(x 'LND Sphinx-Relay' ${sphinxrelay})
|
||||||
|
fi
|
||||||
|
|
||||||
|
# just available for CL
|
||||||
|
if [ "${lightning}" == "cl" ] || [ "${cl}" == "on" ]; then
|
||||||
|
OPTIONS+=(c 'C-Lightning RTL Webinterface' ${crtlWebinterface})
|
||||||
|
OPTIONS+=(k 'C-Lightning Sparko WebWallet' ${sparko})
|
||||||
|
OPTIONS+=(n 'C-Lightning Spark Wallet' ${spark})
|
||||||
|
fi
|
||||||
|
|
||||||
|
CHOICES=$(dialog --title ' Additional Mainnet Services ' \
|
||||||
--checklist ' use spacebar to activate/de-activate ' \
|
--checklist ' use spacebar to activate/de-activate ' \
|
||||||
22 45 15 "${OPTIONS[@]}" 2>&1 >/dev/tty)
|
25 55 18 "${OPTIONS[@]}" 2>&1 >/dev/tty)
|
||||||
|
|
||||||
dialogcancel=$?
|
dialogcancel=$?
|
||||||
echo "done dialog"
|
echo "done dialog"
|
||||||
|
@ -55,38 +74,64 @@ clear
|
||||||
echo "dialogcancel(${dialogcancel})"
|
echo "dialogcancel(${dialogcancel})"
|
||||||
if [ ${dialogcancel} -eq 1 ]; then
|
if [ ${dialogcancel} -eq 1 ]; then
|
||||||
echo "user canceled"
|
echo "user canceled"
|
||||||
exit 1
|
exit 0
|
||||||
elif [ ${dialogcancel} -eq 255 ]; then
|
elif [ ${dialogcancel} -eq 255 ]; then
|
||||||
echo "ESC pressed"
|
echo "ESC pressed"
|
||||||
exit 1
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
needsReboot=0
|
needsReboot=0
|
||||||
anychange=0
|
anychange=0
|
||||||
|
|
||||||
# RTL process choice
|
# RTL process choice (LND)
|
||||||
choice="off"; check=$(echo "${CHOICES}" | grep -c "r")
|
choice="off"; check=$(echo "${CHOICES}" | grep -c "r")
|
||||||
if [ ${check} -eq 1 ]; then choice="on"; fi
|
if [ ${check} -eq 1 ]; then choice="on"; fi
|
||||||
|
|
||||||
if [ "${rtlWebinterface}" != "${choice}" ]; then
|
if [ "${rtlWebinterface}" != "${choice}" ]; then
|
||||||
echo "RTL Webinterface Setting changed .."
|
echo "RTL-lnd Webinterface Setting changed .."
|
||||||
anychange=1
|
anychange=1
|
||||||
/home/admin/config.scripts/bonus.rtl.sh ${choice}
|
/home/admin/config.scripts/bonus.rtl.sh ${choice} lnd mainnet
|
||||||
errorOnInstall=$?
|
errorOnInstall=$?
|
||||||
if [ "${choice}" = "on" ]; then
|
if [ "${choice}" = "on" ]; then
|
||||||
if [ ${errorOnInstall} -eq 0 ]; then
|
if [ ${errorOnInstall} -eq 0 ]; then
|
||||||
sudo systemctl start RTL
|
sudo systemctl start RTL
|
||||||
echo "waiting 10 secs .."
|
echo "waiting 10 secs .."
|
||||||
sleep 10
|
sleep 10
|
||||||
/home/admin/config.scripts/bonus.rtl.sh menu
|
/home/admin/config.scripts/bonus.rtl.sh menu lnd mainnet
|
||||||
else
|
else
|
||||||
l1="!!! FAIL on RTL install !!!"
|
l1="!!! FAIL on RTL lnd install !!!"
|
||||||
l2="Try manual install on terminal after reboot with:"
|
l2="Try manual install on terminal after reboot with:"
|
||||||
l3="/home/admin/config.scripts/bonus.rtl.sh on"
|
l3="/home/admin/config.scripts/bonus.rtl.sh on lnd mainnet"
|
||||||
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
|
||||||
else
|
else
|
||||||
echo "RTL Webinterface Setting unchanged."
|
echo "RTL-lnd Webinterface Setting unchanged."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# RTL process choice (C-Lightning)
|
||||||
|
choice="off"; check=$(echo "${CHOICES}" | grep -c "c")
|
||||||
|
if [ ${check} -eq 1 ]; then choice="on"; fi
|
||||||
|
if [ "${crtlWebinterface}" != "${choice}" ]; then
|
||||||
|
echo "RTL-cl Webinterface Setting changed .."
|
||||||
|
anychange=1
|
||||||
|
/home/admin/config.scripts/bonus.rtl.sh ${choice} cl mainnet
|
||||||
|
errorOnInstall=$?
|
||||||
|
if [ "${choice}" = "on" ]; then
|
||||||
|
if [ ${errorOnInstall} -eq 0 ]; then
|
||||||
|
sudo systemctl start RTL
|
||||||
|
echo "waiting 10 secs .."
|
||||||
|
sleep 10
|
||||||
|
/home/admin/config.scripts/bonus.rtl.sh menu cl mainnet
|
||||||
|
else
|
||||||
|
l1="!!! FAIL on RTL C-Lightning install !!!"
|
||||||
|
l2="Try manual install on terminal after reboot with:"
|
||||||
|
l3="/home/admin/config.scripts/bonus.rtl.sh on cl mainnet"
|
||||||
|
dialog --title 'FAIL' --msgbox "${l1}\n${l2}\n${l3}" 7 65
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "RTL-cl Webinterface Setting unchanged."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# BTC-RPC-Explorer process choice
|
# BTC-RPC-Explorer process choice
|
||||||
|
@ -99,7 +144,7 @@ if [ "${BTCRPCexplorer}" != "${choice}" ]; then
|
||||||
errorOnInstall=$?
|
errorOnInstall=$?
|
||||||
if [ "${choice}" = "on" ]; then
|
if [ "${choice}" = "on" ]; then
|
||||||
if [ ${errorOnInstall} -eq 0 ]; then
|
if [ ${errorOnInstall} -eq 0 ]; then
|
||||||
sudo sytemctl start btc-rpc-explorer
|
sudo systemctl start btc-rpc-explorer
|
||||||
whiptail --title " Installed BTC-RPC-Explorer " --msgbox "\
|
whiptail --title " Installed BTC-RPC-Explorer " --msgbox "\
|
||||||
The txindex may need to be created before BTC-RPC-Explorer can be active.\n
|
The txindex may need to be created before BTC-RPC-Explorer can be active.\n
|
||||||
This can take ~7 hours on a RPi4 with SSD. Monitor the progress on the LCD.\n
|
This can take ~7 hours on a RPi4 with SSD. Monitor the progress on the LCD.\n
|
||||||
|
@ -117,27 +162,27 @@ else
|
||||||
echo "BTC-RPC-Explorer Setting unchanged."
|
echo "BTC-RPC-Explorer Setting unchanged."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# cryptoadvance Specter process choice
|
# Specter Desktop process choice
|
||||||
choice="off"; check=$(echo "${CHOICES}" | grep -c "s")
|
choice="off"; check=$(echo "${CHOICES}" | grep -c "s")
|
||||||
if [ ${check} -eq 1 ]; then choice="on"; fi
|
if [ ${check} -eq 1 ]; then choice="on"; fi
|
||||||
if [ "${specter}" != "${choice}" ]; then
|
if [ "${specter}" != "${choice}" ]; then
|
||||||
echo "Cryptoadvance Specter Setting changed .."
|
echo "Specter Desktop Setting changed .."
|
||||||
anychange=1
|
anychange=1
|
||||||
/home/admin/config.scripts/bonus.cryptoadvance-specter.sh ${choice}
|
/home/admin/config.scripts/bonus.specter.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 cryptoadvance-specter
|
sudo systemctl start specter
|
||||||
/home/admin/config.scripts/bonus.cryptoadvance-specter.sh menu
|
/home/admin/config.scripts/bonus.specter.sh menu
|
||||||
else
|
else
|
||||||
l1="!!! FAIL on Cryptoadvance Specter install !!!"
|
l1="!!! FAIL on Specter Desktop install !!!"
|
||||||
l2="Try manual install on terminal after reboot with:"
|
l2="Try manual install on terminal after reboot with:"
|
||||||
l3="/home/admin/config.scripts/bonus.cryptoadvance-specter.sh on"
|
l3="/home/admin/config.scripts/bonus.specter.sh on"
|
||||||
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
|
||||||
else
|
else
|
||||||
echo "Cryptoadvance Specter Setting unchanged."
|
echo "Specter Desktop Setting unchanged."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ElectRS process choice
|
# ElectRS process choice
|
||||||
|
@ -166,7 +211,7 @@ The index database needs to be created before Electrum Server can be used.\n
|
||||||
This can take hours/days depending on your RaspiBlitz. Monitor the progress on the LCD.\n
|
This can take hours/days depending on your RaspiBlitz. Monitor the progress on the LCD.\n
|
||||||
When finished use the new 'ELECTRS' entry in Main Menu for more info.\n
|
When finished use the new 'ELECTRS' entry in Main Menu for more info.\n
|
||||||
" 14 50
|
" 14 50
|
||||||
needsReboot=1
|
needsReboot=0
|
||||||
else
|
else
|
||||||
l1="!!! FAIL on ElectRS install !!!"
|
l1="!!! FAIL on ElectRS install !!!"
|
||||||
l2="Try manual install on terminal after reboot with:"
|
l2="Try manual install on terminal after reboot with:"
|
||||||
|
@ -242,7 +287,7 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# CHANTOOLS process choice
|
# CHANTOOLS process choice
|
||||||
choice="off"; check=$(echo "${CHOICES}" | grep -c "c")
|
choice="off"; check=$(echo "${CHOICES}" | grep -c "h")
|
||||||
if [ ${check} -eq 1 ]; then choice="on"; fi
|
if [ ${check} -eq 1 ]; then choice="on"; fi
|
||||||
if [ "${chantools}" != "${choice}" ]; then
|
if [ "${chantools}" != "${choice}" ]; then
|
||||||
echo "chantools Setting changed .."
|
echo "chantools Setting changed .."
|
||||||
|
@ -431,6 +476,50 @@ else
|
||||||
echo "Whitepaper setting unchanged."
|
echo "Whitepaper setting unchanged."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# sparko process choice
|
||||||
|
choice="off"; check=$(echo "${CHOICES}" | grep -c "k")
|
||||||
|
if [ ${check} -eq 1 ]; then choice="on"; fi
|
||||||
|
if [ "${sparko}" != "${choice}" ]; then
|
||||||
|
echo "# Sparko on mainnet Setting changed .."
|
||||||
|
anychange=1
|
||||||
|
/home/admin/config.scripts/cl-plugin.sparko.sh ${choice} mainnet
|
||||||
|
errorOnInstall=$?
|
||||||
|
if [ "${choice}" = "on" ]; then
|
||||||
|
if [ ${errorOnInstall} -eq 0 ]; then
|
||||||
|
/home/admin/config.scripts/cl-plugin.sparko.sh menu mainnet
|
||||||
|
else
|
||||||
|
l1="# !!! FAIL on Sparko on mainnet install !!!"
|
||||||
|
l2="# Try manual install on terminal after reboot with:"
|
||||||
|
l3="/home/admin/config.scripts/cl-plugin.sparko.sh on mainnet"
|
||||||
|
dialog --title 'FAIL' --msgbox "${l1}\n${l2}\n${l3}" 7 65
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "# Sparko on mainnet Setting unchanged."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# spark wallet process choice
|
||||||
|
choice="off"; check=$(echo "${CHOICES}" | grep -c "n")
|
||||||
|
if [ ${check} -eq 1 ]; then choice="on"; fi
|
||||||
|
if [ "${spark}" != "${choice}" ]; then
|
||||||
|
echo "# Spark Wallet on mainnet Setting changed .."
|
||||||
|
anychange=1
|
||||||
|
/home/admin/config.scripts/cl.spark.sh ${choice} mainnet
|
||||||
|
errorOnInstall=$?
|
||||||
|
if [ "${choice}" = "on" ]; then
|
||||||
|
if [ ${errorOnInstall} -eq 0 ]; then
|
||||||
|
/home/admin/config.scripts/cl.spark.sh menu mainnet
|
||||||
|
else
|
||||||
|
l1="# !!! FAIL on Spark Wallet on mainnet install !!!"
|
||||||
|
l2="# Try manual install on terminal after reboot with:"
|
||||||
|
l3="/home/admin/config.scripts/cl.spark.sh on mainnet"
|
||||||
|
dialog --title 'FAIL' --msgbox "${l1}\n${l2}\n${l3}" 7 65
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "# Spark Wallet on mainnet Setting unchanged."
|
||||||
|
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
|
||||||
|
@ -444,5 +533,5 @@ if [ ${needsReboot} -eq 1 ]; then
|
||||||
# stop bitcoind
|
# stop bitcoind
|
||||||
sudo -u bitcoin ${network}-cli stop
|
sudo -u bitcoin ${network}-cli stop
|
||||||
sleep 4
|
sleep 4
|
||||||
sudo /home/admin/XXshutdown.sh reboot
|
sudo /home/admin/config.scripts/blitz.shutdown.sh reboot
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,267 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# CHECK WHAT IS ALREADY WORKING
|
|
||||||
# check list from top down - so ./10setupBlitz.sh
|
|
||||||
# and re-enters the setup process at the correct spot
|
|
||||||
# in case it got interrupted
|
|
||||||
echo "checking setup script"
|
|
||||||
|
|
||||||
# INFOFILE on SD - state data from bootstrap & setup
|
|
||||||
infoFile="/home/admin/raspiblitz.info"
|
|
||||||
source ${infoFile}
|
|
||||||
|
|
||||||
echo "network(${network})"
|
|
||||||
echo "chain(${chain})"
|
|
||||||
echo "setupStep(${setupStep})"
|
|
||||||
|
|
||||||
if [ ${#network} -eq 0 ]; then
|
|
||||||
echo "FAIL: Something is wrong. There is no value for network in ${infoFile}."
|
|
||||||
echo "Should be at least default value. EXIT"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# if no setup step in info file init with 0
|
|
||||||
if [ ${#setupStep} -eq 0 ];then
|
|
||||||
echo "Init setupStep=0"
|
|
||||||
echo "setupStep=0" >> ${infoFile}
|
|
||||||
setupStep=0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# check if LND needs re-setup
|
|
||||||
if [ ${setupStep} -gt 79 ];then
|
|
||||||
source <(sudo /home/admin/config.scripts/lnd.check.sh basic-setup)
|
|
||||||
if [ ${wallet} -eq 0 ] || [ ${macaroon} -eq 0 ] || [ ${config} -eq 0 ] || [ ${tls} -eq 0 ]; then
|
|
||||||
echo "WARN: LND needs re-setup"
|
|
||||||
sudo /home/admin/70initLND.sh
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# if setup if ready --> REBOOT
|
|
||||||
if [ ${setupStep} -gt 89 ];then
|
|
||||||
echo "FINISH by setupstep(${setupStep})"
|
|
||||||
sleep 3
|
|
||||||
sudo /home/admin/90finishSetup.sh
|
|
||||||
sudo /home/admin/95finalSetup.sh
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# check if lightning is running
|
|
||||||
lndRunning=$(systemctl status lnd.service 2>/dev/null | grep -c running)
|
|
||||||
if [ ${lndRunning} -eq 1 ]; then
|
|
||||||
|
|
||||||
echo "LND is running ..."
|
|
||||||
sleep 1
|
|
||||||
|
|
||||||
# check if LND wallet exists and if locked
|
|
||||||
walletExists=$(sudo ls /mnt/hdd/lnd/data/chain/${network}/${chain}net/wallet.db 2>/dev/null | grep wallet.db -c)
|
|
||||||
walletLocked=0
|
|
||||||
# only when a wallet exists - it can be locked
|
|
||||||
if [ ${walletExists} -eq 1 ];then
|
|
||||||
echo "lnd wallet exists ... checking if locked"
|
|
||||||
sleep 2
|
|
||||||
walletLocked=$(sudo -u bitcoin /usr/local/bin/lncli getinfo 2>&1 | grep -c unlock)
|
|
||||||
fi
|
|
||||||
if [ ${walletLocked} -gt 0 ]; then
|
|
||||||
# LND wallet is locked
|
|
||||||
/home/admin/config.scripts/lnd.unlock.sh
|
|
||||||
/home/admin/10setupBlitz.sh
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# check if blockchain still syncing (during sync sometimes CLI returns with error at this point)
|
|
||||||
chainInfo=$(sudo -u bitcoin ${network}-cli getblockchaininfo 2>/dev/null | grep 'initialblockdownload')
|
|
||||||
chainSyncing=1
|
|
||||||
if [ ${#chainInfo} -gt 0 ];then
|
|
||||||
echo "check chaininfo"
|
|
||||||
chainSyncing=$(echo "${chainInfo}" | grep "true" -c)
|
|
||||||
else
|
|
||||||
echo "chaininfo is zero"
|
|
||||||
fi
|
|
||||||
if [ ${chainSyncing} -eq 1 ]; then
|
|
||||||
echo "Sync Chain ..."
|
|
||||||
sleep 3
|
|
||||||
/home/admin/70initLND.sh
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# check if lnd is scanning blockchain
|
|
||||||
lndInfo=$(sudo -u bitcoin /usr/local/bin/lncli --chain=${network} getinfo 2>/dev/null | grep "synced_to_chain")
|
|
||||||
lndSyncing=1
|
|
||||||
if [ ${#lndInfo} -gt 0 ];then
|
|
||||||
lndSyncing=$(echo "${chainInfo}" | grep "false" -c)
|
|
||||||
fi
|
|
||||||
if [ ${lndSyncing} -eq 1 ]; then
|
|
||||||
echo "Sync LND ..."
|
|
||||||
sleep 3
|
|
||||||
/home/admin/70initLND.sh
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# if unlocked, blockchain synced and LND synced to chain .. finish Setup
|
|
||||||
echo "FINSIH ... "
|
|
||||||
sleep 3
|
|
||||||
sudo /home/admin/90finishSetup.sh
|
|
||||||
sudo /home/admin/95finalSetup.sh
|
|
||||||
exit 0
|
|
||||||
|
|
||||||
fi #end - when lighting is running
|
|
||||||
|
|
||||||
# check if bitcoin is running
|
|
||||||
bitcoinRunning=$(systemctl status ${network}d.service 2>/dev/null | grep -c running)
|
|
||||||
if [ ${bitcoinRunning} -eq 0 ]; then
|
|
||||||
# double check
|
|
||||||
seconds=120
|
|
||||||
if [ ${setupStep} -lt 60 ]; then
|
|
||||||
seconds=10
|
|
||||||
fi
|
|
||||||
dialog --pause " Double checking for ${network}d - please wait .." 8 58 ${seconds}
|
|
||||||
clear
|
|
||||||
bitcoinRunning=$(${network}-cli getblockchaininfo 2>/dev/null | grep "initialblockdownload" -c)
|
|
||||||
else
|
|
||||||
echo "${network} is running"
|
|
||||||
fi
|
|
||||||
if [ ${bitcoinRunning} -eq 1 ]; then
|
|
||||||
echo "OK - ${network}d is running"
|
|
||||||
echo "Next step run Lightning"
|
|
||||||
/home/admin/70initLND.sh
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
echo "${network} still not running"
|
|
||||||
fi #end - when bitcoin is running
|
|
||||||
|
|
||||||
# --- so neither bitcoin or lnd or running yet --> find the earlier step in the setup process:
|
|
||||||
|
|
||||||
# use blitz.datadrive.sh to analyse HDD situation
|
|
||||||
source <(sudo /home/admin/config.scripts/blitz.datadrive.sh status ${network})
|
|
||||||
if [ ${#error} -gt 0 ]; then
|
|
||||||
echo "# FAIL blitz.datadrive.sh status --> ${error}"
|
|
||||||
echo "# Please report issue to the raspiblitz github."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# check if HDD is auto-mounted
|
|
||||||
if [ ${isMounted} -eq 1 ]; then
|
|
||||||
|
|
||||||
# FAILSAFE: check if raspiblitz.conf is available
|
|
||||||
configExists=$(ls /mnt/hdd/raspiblitz.conf | grep -c '.conf')
|
|
||||||
if [ ${configExists} -eq 0 ]; then
|
|
||||||
echo ""
|
|
||||||
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
|
||||||
echo "FAIL: /mnt/hdd/raspiblitz.conf should exists at this point, but not found!"
|
|
||||||
echo "Please report to: https://github.com/rootzoll/raspiblitz/issues/293"
|
|
||||||
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
|
||||||
echo "Press ENTER to EXIT."
|
|
||||||
read key
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# are there any signs of blockchain data and activity
|
|
||||||
# setup running with admin user, but has no permission to read /mnt/hdd/bitcoin/blocks/, sudo needed
|
|
||||||
blockchainDataExists=$(sudo ls /mnt/hdd/${network}/blocks 2>/dev/null | grep -c '.dat')
|
|
||||||
configExists=$(sudo ls /mnt/hdd/${network}/${network}.conf | grep -c '.conf')
|
|
||||||
|
|
||||||
if [ ${blockchainDataExists} -gt 0 ]; then
|
|
||||||
if [ ${configExists} -eq 1 ]; then
|
|
||||||
/home/admin/XXdebugLogs.sh
|
|
||||||
echo "UNKOWN STATE - there is blockchain data config, but blockchain service is not running"
|
|
||||||
echo "It seems that something went wrong during sync/download/copy of the blockchain."
|
|
||||||
echo "Or something with the config is not correct."
|
|
||||||
echo "Sometimes a reboot helps - use command: restart"
|
|
||||||
echo "Or try to repair blockchain - use command: repair"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
echo "Got mounted blockchain, but no config and running service yet --> finish HDD"
|
|
||||||
/home/admin/60finishHDD.sh
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# HDD is empty - get Blockchain
|
|
||||||
|
|
||||||
# detect hardware version of RaspberryPi
|
|
||||||
# https://www.unixtutorial.org/command-to-confirm-raspberry-pi-model
|
|
||||||
raspberryPi=$(cat /proc/device-tree/model | cut -d " " -f 3 | sed 's/[^0-9]*//g')
|
|
||||||
if [ ${#raspberryPi} -eq 0 ]; then
|
|
||||||
raspberryPi=0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Bitcoin on older/weak RaspberryPi3 (LEGACY)
|
|
||||||
if [ ${network} = "bitcoin" ] && [ ${raspberryPi} -eq 3 ]; then
|
|
||||||
echo "Bitcoin-RP3 Options"
|
|
||||||
menuitem=$(dialog --clear --beep --backtitle "RaspiBlitz" --title " Getting the Blockchain " \
|
|
||||||
--menu "You need a copy of the Bitcoin Blockchain - choose method:" 13 75 5 \
|
|
||||||
C "COPY --> Copy from laptop/node over LAN (±6hours)" \
|
|
||||||
S "SYNC --> Selfvalidate all Blocks (VERY SLOW ±2month)" 2>&1 >/dev/tty)
|
|
||||||
|
|
||||||
# Bitcoin on stronger RaspberryPi4 (new DEFAULT)
|
|
||||||
elif [ ${network} = "bitcoin" ]; then
|
|
||||||
echo "Bitcoin-RP4 Options"
|
|
||||||
menuitem=$(dialog --clear --beep --backtitle "RaspiBlitz" --title " Getting the Blockchain " \
|
|
||||||
--menu "You need a copy of the Bitcoin Blockchain - choose method:" 13 75 5 \
|
|
||||||
S "SYNC --> Selfvalidate all Blocks (DEFAULT ±2days)" \
|
|
||||||
C "COPY --> Copy from laptop/node over LAN (±6hours)" 2>&1 >/dev/tty)
|
|
||||||
|
|
||||||
# Litecoin
|
|
||||||
elif [ ${network} = "litecoin" ]; then
|
|
||||||
echo "Litecoin Options"
|
|
||||||
menuitem=$(dialog --clear --beep --backtitle "RaspiBlitz" --title " Getting the Blockchain " \
|
|
||||||
--menu "You need a copy of the Litecoin Blockchain:" 13 75 4 \
|
|
||||||
S "SYNC --> Selfvalidate all Blocks (±1day)" 2>&1 >/dev/tty)
|
|
||||||
|
|
||||||
# error
|
|
||||||
else
|
|
||||||
echo "FAIL Unknown network(${network})"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# set SetupState
|
|
||||||
sudo sed -i "s/^setupStep=.*/setupStep=50/g" ${infoFile}
|
|
||||||
|
|
||||||
clear
|
|
||||||
case $menuitem in
|
|
||||||
C)
|
|
||||||
/home/admin/50copyHDD.sh
|
|
||||||
;;
|
|
||||||
S)
|
|
||||||
/home/admin/50syncHDD.sh
|
|
||||||
/home/admin/10setupBlitz.sh
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Use 'raspiblitz' command to return to setup ..."
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
exit 1
|
|
||||||
|
|
||||||
fi # end HDD is already auto-mounted
|
|
||||||
|
|
||||||
|
|
||||||
# --- the HDD is not auto-mounted --> very early stage of setup
|
|
||||||
|
|
||||||
# if the script is called for the first time
|
|
||||||
if [ ${setupStep} -eq 0 ]; then
|
|
||||||
# run initial user dialog
|
|
||||||
/home/admin/20setupDialog.sh
|
|
||||||
fi
|
|
||||||
|
|
||||||
# if the script is called for the first time
|
|
||||||
if [ ${setupStep} -eq 20 ]; then
|
|
||||||
# run initial user dialog
|
|
||||||
/home/admin/30initHDD.sh
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# the HDD is already ext4 formatted and contains blockchain data
|
|
||||||
if [ "${hddFormat}" = "ext4" ] || [ "${hddFormat}" = "btrfs" ]; then
|
|
||||||
if [ ${hddGotBlockchain} -eq 1 ]; then
|
|
||||||
echo "HDD was already initialized/prepared"
|
|
||||||
echo "Now needs to be mounted"
|
|
||||||
/home/admin/40addHDD.sh
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# the HDD had no init yet
|
|
||||||
echo "init HDD ..."
|
|
||||||
/home/admin/30initHDD.sh
|
|
||||||
exit 1
|
|
|
@ -1,127 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
## get basic info
|
|
||||||
source /home/admin/raspiblitz.info
|
|
||||||
source /mnt/hdd/raspiblitz.conf
|
|
||||||
|
|
||||||
# show password info dialog
|
|
||||||
resetAlsoPasswordB=$(sudo cat /mnt/hdd/bitcoin/bitcoin.conf 2>/dev/null | grep -c "rpcpassword=passwordB")
|
|
||||||
resetAlsoPasswordC=$(sudo ls /mnt/hdd/passwordc.flag 2>/dev/null | grep -c ".flag")
|
|
||||||
|
|
||||||
if [ ${resetAlsoPasswordC} -gt 0 ]; then
|
|
||||||
|
|
||||||
# password A + B + C
|
|
||||||
dialog --backtitle "RaspiBlitz - Migration Setup" --msgbox "Your migration to RaspiBlitz is almost done.
|
|
||||||
|
|
||||||
You need to set a new Password A, B & C:
|
|
||||||
A) Main User Password (SSH, WebUI, ..)
|
|
||||||
B) RPC & APP Password (Additional Apps, ..)
|
|
||||||
C) Lightning Wallet Unlock Password
|
|
||||||
|
|
||||||
Follow Password Rules: Minimal of 8 chars,
|
|
||||||
no spaces and only special characters - or .
|
|
||||||
Write them down & store them in a safe place.
|
|
||||||
" 17 52
|
|
||||||
|
|
||||||
# call set password a script
|
|
||||||
sudo /home/admin/config.scripts/blitz.setpassword.sh a
|
|
||||||
dialog --backtitle "RaspiBlitz" --msgbox "OK - password A was set\nfor all users pi, admin, root & bitcoin" 6 52
|
|
||||||
|
|
||||||
sudo /home/admin/config.scripts/blitz.setpassword.sh b
|
|
||||||
dialog --backtitle "RaspiBlitz" --msgbox "OK - password B was set\nit will be used by additional apps you install." 6 52
|
|
||||||
|
|
||||||
oldPasswordC=$(sudo cat /mnt/hdd/passwordc.flag)
|
|
||||||
sudo /home/admin/config.scripts/blitz.setpassword.sh c $oldPasswordC
|
|
||||||
if [ "$?" != "0" ]; then
|
|
||||||
dialog --backtitle "RaspiBlitz - Setup" --msgbox "Please write down your Password C:\n${oldPasswordC}" 10 52
|
|
||||||
else
|
|
||||||
dialog --backtitle "RaspiBlitz" --msgbox "OK - password C was set\nuse it to unlock your Lightning Wallet after restarts." 8 52
|
|
||||||
fi
|
|
||||||
|
|
||||||
elif [ ${resetAlsoPasswordB} -gt 0 ]; then
|
|
||||||
|
|
||||||
# password A + B
|
|
||||||
dialog --backtitle "RaspiBlitz - Migration Setup" --msgbox "Your migration to RaspiBlitz is almost done.
|
|
||||||
|
|
||||||
You need to set a new Password A & B:
|
|
||||||
A) Main User Password (SSH, WebUI, ..)
|
|
||||||
B) RPC & APP Password (Additional Apps, ..)
|
|
||||||
|
|
||||||
Passwords C (for your Lightning wallet) stays to the password you set before.
|
|
||||||
|
|
||||||
Follow Password Rules: Minimal of 8 chars,
|
|
||||||
no spaces and only special characters - or .
|
|
||||||
Write them down & store them in a safe place.
|
|
||||||
" 17 52
|
|
||||||
|
|
||||||
# call set password a script
|
|
||||||
sudo /home/admin/config.scripts/blitz.setpassword.sh a
|
|
||||||
dialog --backtitle "RaspiBlitz" --msgbox "OK - password A was set\nfor all users pi, admin, root & bitcoin" 6 52
|
|
||||||
|
|
||||||
sudo /home/admin/config.scripts/blitz.setpassword.sh b
|
|
||||||
dialog --backtitle "RaspiBlitz" --msgbox "OK - password B was set\nit will be used by additional apps you install." 6 52
|
|
||||||
|
|
||||||
else
|
|
||||||
|
|
||||||
# just password A
|
|
||||||
dialog --backtitle "RaspiBlitz - Recover Setup" --msgbox "Your previous RaspiBlitz config was recovered.
|
|
||||||
|
|
||||||
You need to set a new Password A:
|
|
||||||
A) Master User Password
|
|
||||||
|
|
||||||
Passwords B & C stay as before.
|
|
||||||
|
|
||||||
Follow Password Rules: Minimal of 8 chars,
|
|
||||||
no spaces and only special characters - or .
|
|
||||||
Write them down & store them in a safe place.
|
|
||||||
" 14 52
|
|
||||||
|
|
||||||
# call set password a script
|
|
||||||
sudo /home/admin/config.scripts/blitz.setpassword.sh a
|
|
||||||
|
|
||||||
# success info dialog
|
|
||||||
dialog --backtitle "RaspiBlitz" --msgbox "OK - password A was set\nfor all users pi, admin, root & bitcoin" 6 52
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
# activate lnd & bitcoin service
|
|
||||||
echo "Enabling Services"
|
|
||||||
sudo systemctl daemon-reload
|
|
||||||
sudo systemctl enable lnd.service
|
|
||||||
sudo systemctl enable ${network}d.service
|
|
||||||
if [ "${rtlWebinterface}" = "on" ]; then
|
|
||||||
sudo systemctl enable RTL
|
|
||||||
fi
|
|
||||||
if [ "${loop}" = "on" ]; then
|
|
||||||
sudo systemctl enable loopd
|
|
||||||
fi
|
|
||||||
if [ "${BTCRPCexplorer}" = "on" ]; then
|
|
||||||
sudo systemctl enable btc-rpc-explorer
|
|
||||||
fi
|
|
||||||
if [ "${ElectRS}" = "on" ]; then
|
|
||||||
sudo systemctl enable electrs
|
|
||||||
fi
|
|
||||||
|
|
||||||
# remove flag that freshly recovered
|
|
||||||
sudo rm /home/admin/recover.flag
|
|
||||||
|
|
||||||
# when auto-unlock is activated then Password C is needed to be restored on SD card
|
|
||||||
if [ "${autoUnlock}" = "on" ]; then
|
|
||||||
|
|
||||||
# reset auto-unlock feature
|
|
||||||
dialog --backtitle "RaspiBlitz - Setup" --msgbox "You had the Auto-Unlock feature enabled.
|
|
||||||
|
|
||||||
In the next dialog you need to re-enter your
|
|
||||||
ACTUAL/OLD Password C to re-activate the
|
|
||||||
Auto-Unlock feature. Enter a empty password
|
|
||||||
to deactivate the Auto-Unlock feature.
|
|
||||||
" 10 52
|
|
||||||
echo "Activating Auto-Unlock (please wait) .."
|
|
||||||
sudo /home/admin/config.scripts/lnd.autounlock.sh on
|
|
||||||
dialog --backtitle "RaspiBlitz" --pause " FINAL REBOOT IS NEEDED." 8 52 5
|
|
||||||
|
|
||||||
else
|
|
||||||
dialog --backtitle "RaspiBlitz" --pause " OK - Passwords set.\n FINAL REBOOT IS NEEDED." 9 52 5
|
|
||||||
fi
|
|
||||||
|
|
||||||
sudo /home/admin/XXshutdown.sh reboot
|
|
|
@ -1,90 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
_temp=$(mktemp -p /dev/shm/)
|
|
||||||
|
|
||||||
## get basic info
|
|
||||||
source /home/admin/raspiblitz.info 2>/dev/null
|
|
||||||
|
|
||||||
###################
|
|
||||||
# CHECK IF DNS NEEDS SETTING DURING SETUP
|
|
||||||
# https://github.com/rootzoll/raspiblitz/issues/787
|
|
||||||
###################
|
|
||||||
sudo /home/admin/config.scripts/internet.dns.sh test
|
|
||||||
|
|
||||||
###################
|
|
||||||
# ENTER NAME
|
|
||||||
###################
|
|
||||||
|
|
||||||
# welcome and ask for name of RaspiBlitz
|
|
||||||
result=""
|
|
||||||
while [ ${#result} -eq 0 ]
|
|
||||||
do
|
|
||||||
l1="Please enter the name of your new RaspiBlitz:\n"
|
|
||||||
l2="one word, keep characters basic & not too long"
|
|
||||||
dialog --backtitle "RaspiBlitz - Setup (${network}/${chain})" --inputbox "$l1$l2" 11 52 2>$_temp
|
|
||||||
result=$( cat $_temp | tr -dc '[:alnum:]-.' | tr -d ' ' )
|
|
||||||
shred -u $_temp
|
|
||||||
echo "processing ..."
|
|
||||||
sleep 3
|
|
||||||
done
|
|
||||||
|
|
||||||
# set lightning alias
|
|
||||||
sed -i "s/^alias=.*/alias=${result}/g" /home/admin/assets/lnd.${network}.conf
|
|
||||||
|
|
||||||
# store hostname for later - to be set right before the next reboot
|
|
||||||
# work around - because without a reboot the hostname seems not updates in the whole system
|
|
||||||
valueExistsInInfoFile=$(sudo cat /home/admin/raspiblitz.info | grep -c "hostname=")
|
|
||||||
if [ ${valueExistsInInfoFile} -eq 0 ]; then
|
|
||||||
# add
|
|
||||||
echo "hostname=${result}" >> /home/admin/raspiblitz.info
|
|
||||||
else
|
|
||||||
# update
|
|
||||||
sed -i "s/^hostname=.*/hostname=${result}/g" /home/admin/raspiblitz.info
|
|
||||||
fi
|
|
||||||
|
|
||||||
###################
|
|
||||||
# ENTER PASSWORDS
|
|
||||||
###################
|
|
||||||
|
|
||||||
# show password info dialog
|
|
||||||
dialog --backtitle "RaspiBlitz - Setup (${network}/${chain})" --msgbox "RaspiBlitz uses 4 different passwords.
|
|
||||||
Referenced as password A, B, C and D.
|
|
||||||
|
|
||||||
A) Master User Password
|
|
||||||
B) Blockchain RPC Password
|
|
||||||
C) LND Wallet Password
|
|
||||||
D) LND Seed Password
|
|
||||||
|
|
||||||
Choose now 4 new passwords - all min 8 chars,
|
|
||||||
no spaces and only special characters - or .
|
|
||||||
Write them down & store them in a safe place.
|
|
||||||
" 15 52
|
|
||||||
|
|
||||||
# call set password a script
|
|
||||||
sudo /home/admin/config.scripts/blitz.setpassword.sh a
|
|
||||||
|
|
||||||
# success info dialog
|
|
||||||
dialog --backtitle "RaspiBlitz" --msgbox "OK - password A was set\nfor all users pi, admin, root & bitcoin" 6 52
|
|
||||||
|
|
||||||
# call set password b script
|
|
||||||
sudo /home/admin/config.scripts/blitz.setpassword.sh b
|
|
||||||
|
|
||||||
# success info dialog
|
|
||||||
dialog --backtitle "RaspiBlitz" --msgbox "OK - RPC password changed \n\nNow starting the Setup of your RaspiBlitz." 7 52
|
|
||||||
|
|
||||||
###################
|
|
||||||
# TOR BY DEFAULT
|
|
||||||
# https://github.com/rootzoll/raspiblitz/issues/592
|
|
||||||
#
|
|
||||||
###################
|
|
||||||
echo "runBehindTor=on" >> /home/admin/raspiblitz.info
|
|
||||||
#whiptail --title ' Privacy Level - How do you want to run your node? ' --yes-button='Public IP' --no-button='TOR NETWORK' --yesno "Running your Lightning node with your Public IP is common and faster, but might reveal your personal identity and location.\n
|
|
||||||
#You can better protect your privacy with running your lightning node as a TOR Hidden Service from the start, but it can make it harder to connect with other non-TOR nodes and remote mobile apps later on.
|
|
||||||
# " 12 75
|
|
||||||
#if [ $? -eq 1 ]; then
|
|
||||||
# echo "runBehindTor=on" >> /home/admin/raspiblitz.info
|
|
||||||
#fi
|
|
||||||
|
|
||||||
# set SetupState
|
|
||||||
sudo sed -i "s/^setupStep=.*/setupStep=20/g" /home/admin/raspiblitz.info
|
|
||||||
|
|
||||||
clear
|
|
|
@ -1,136 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
## get basic info
|
|
||||||
source /home/admin/raspiblitz.info
|
|
||||||
|
|
||||||
clear
|
|
||||||
echo ""
|
|
||||||
echo "# *** 30initHDD.sh ***"
|
|
||||||
echo
|
|
||||||
echo "# --> Checking HDD/SSD status..."
|
|
||||||
|
|
||||||
# use blitz.datadrive.sh to analyse HDD situation
|
|
||||||
source <(sudo /home/admin/config.scripts/blitz.datadrive.sh status ${network})
|
|
||||||
if [ ${#error} -gt 0 ]; then
|
|
||||||
echo "# FAIL blitz.datadrive.sh status --> ${error}"
|
|
||||||
echo "# Please report issue to the raspiblitz github."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# check if HDD is mounted (secure against formatting a mounted disk with data)
|
|
||||||
echo "isMounted=${isMounted}"
|
|
||||||
if [ ${isMounted} -eq 1 ]; then
|
|
||||||
echo "# FAIL HDD/SSD is mounted - please unmount and call ./30initHDD.sh again"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# check if HDD contains old RaspiBlitz data (secure against wrongly formatting)
|
|
||||||
echo "hddRaspiData=${hddRaspiData}"
|
|
||||||
if [ ${hddRaspiData} -eq 1 ]; then
|
|
||||||
echo "# FAIL HDD/SSD contains old data - please delete manual and call ./30initHDD.sh again"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# check if there is a HDD connected to use as data drive
|
|
||||||
echo "hddCandidate=${hddCandidate}"
|
|
||||||
if [ ${#hddCandidate} -eq 0 ]; then
|
|
||||||
echo "# FAIL please connect a HDD and call ./30initHDD.sh again"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "OK"
|
|
||||||
|
|
||||||
# check minimal size of data drive needed
|
|
||||||
echo
|
|
||||||
echo "# --> Check HDD/SSD for Size ..."
|
|
||||||
# bitcoin: 400 GB
|
|
||||||
# litecoin: 120 GB
|
|
||||||
minSize=400
|
|
||||||
if [ "${network}" = "litecoin" ]; then
|
|
||||||
minSize=120
|
|
||||||
fi
|
|
||||||
if [ ${hddGigaBytes} -lt ${minSize} ]; then
|
|
||||||
echo "# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
|
||||||
echo "# WARNING: HDD is too small"
|
|
||||||
echo "# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
|
||||||
echo ""
|
|
||||||
echo "# HDD was detected with the size of ${hddGigaBytes} GB"
|
|
||||||
echo "# For ${network} at least ${minSize} GB is needed"
|
|
||||||
echo ""
|
|
||||||
echo "# If you want to change to a bigger HDD:"
|
|
||||||
echo "# * Unplug power of RaspiBlitz"
|
|
||||||
echo "# * Make a fresh SD card again"
|
|
||||||
echo "# * Start again with bigger HDD"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo " OK"
|
|
||||||
|
|
||||||
# format drive if it does not have any blockchain or blitz data on it
|
|
||||||
# to be sure that HDD has no faulty partitions, etc.
|
|
||||||
echo
|
|
||||||
echo "# --> Check HDD/SSD for Blockchain ..."
|
|
||||||
echo "# hddGotBlockchain=${hddGotBlockchain}"
|
|
||||||
raidSizeGB=$(echo "${raidCandidate[0]}" | cut -d " " -f 2)
|
|
||||||
echo "# raidCandidates=${raidCandidates}"
|
|
||||||
echo "# raidSizeGB=${raidSizeGB}"
|
|
||||||
if [ "${hddGotBlockchain}" == "" ] || [ ${hddGotBlockchain} -eq 0 ]; then
|
|
||||||
|
|
||||||
format="ext4"
|
|
||||||
|
|
||||||
# test feature: if there is a USB stick as a raid connected, then format in BTRFS an not in EXT4
|
|
||||||
if [ ${raidCandidates} -eq 1 ] && [ ${raidSizeGB} -gt 14 ]; then
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo "# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
|
||||||
echo "# EXPERIMENTAL FEATURE: BTRFS + RAID"
|
|
||||||
echo "# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
|
||||||
echo "# You connected an extra USB thumb drive to your RaspiBlitz."
|
|
||||||
echo "# This activates the experimental feature of running BTRFS"
|
|
||||||
echo "# instead of EXT4 and is still unstable but needs testing."
|
|
||||||
echo "# PRESS ENTER to continue with BTRFS+RAID setup or press"
|
|
||||||
echo "# CTRL+C, remove device & call ./30initHDD.sh again."
|
|
||||||
read key
|
|
||||||
format="btrfs"
|
|
||||||
|
|
||||||
# check that raid candidate is big enough
|
|
||||||
# a 32GB drive gets shown with 28GB in my tests
|
|
||||||
if [ ${raidSizeGB} -lt 27 ]; then
|
|
||||||
echo "# FAIL the raid device needs to be at least a 32GB thumb drive."
|
|
||||||
echo "# Please remove or replace and call ./30initHDD.sh again"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
elif [ ${raidCandidates} -gt 1 ]; then
|
|
||||||
echo "# FAIL more then one USB raid drive candidate connected."
|
|
||||||
echo "# Please max one extra USB drive and the call ./30initHDD.sh again"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# now partition/format HDD
|
|
||||||
echo
|
|
||||||
if (whiptail --title "FORMAT HDD/SSD" --yesno "The connected hard drive needs to get formatted.\nIMPORTANT: This will delete all data on that drive." 8 56); then
|
|
||||||
clear
|
|
||||||
echo "# --> Formatting HDD/SSD ..."
|
|
||||||
source <(sudo /home/admin/config.scripts/blitz.datadrive.sh format ${format} ${hddCandidate})
|
|
||||||
if [ ${#error} -gt 0 ]; then
|
|
||||||
echo "# FAIL blitz.datadrive.sh format --> ${error}"
|
|
||||||
echo "# Please report issue to the raspiblitz github."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
clear
|
|
||||||
echo "# Not formatting the HDD/SSD - Setup Process stopped."
|
|
||||||
echo "# Rearrange your hardware and restart with a fresh sd card again."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
|
||||||
echo "# OK"
|
|
||||||
|
|
||||||
# set SetupState
|
|
||||||
sudo sed -i "s/^setupStep=.*/setupStep=30/g" /home/admin/raspiblitz.info
|
|
||||||
|
|
||||||
# automatically now add the HDD to the system
|
|
||||||
./40addHDD.sh
|
|
||||||
|
|
||||||
|
|
|
@ -1,165 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
## get basic info
|
|
||||||
source /home/admin/raspiblitz.info
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "# *** 40addHDD.sh ***"
|
|
||||||
|
|
||||||
# use blitz.datadrive.sh to analyse HDD situation
|
|
||||||
source <(sudo /home/admin/config.scripts/blitz.datadrive.sh status ${network})
|
|
||||||
if [ ${#error} -gt 0 ]; then
|
|
||||||
echo "FAIL blitz.datadrive.sh status --> ${error}"
|
|
||||||
echo "Please report issue to the raspiblitz github."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# temp mount
|
|
||||||
if [ "$hddFormat" == "btrfs" ]; then
|
|
||||||
source <(sudo /home/admin/config.scripts/blitz.datadrive.sh tempmount ${hddCandidate})
|
|
||||||
else
|
|
||||||
source <(sudo /home/admin/config.scripts/blitz.datadrive.sh tempmount ${hddPartitionCandidate})
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ${#error} -gt 0 ]; then
|
|
||||||
echo "FAIL blitz.datadrive.sh tempmount --> ${error}"
|
|
||||||
echo "Please report issue to the raspiblitz github."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# linking drives/directories
|
|
||||||
echo
|
|
||||||
echo "# --> Linking drives/directories"
|
|
||||||
echo "# hddCandidate='${hddCandidate}'"
|
|
||||||
echo "# hddPartitionCandidate='${hddPartitionCandidate}'"
|
|
||||||
source <(sudo /home/admin/config.scripts/blitz.datadrive.sh link)
|
|
||||||
if [ ${#error} -gt 0 ]; then
|
|
||||||
echo "FAIL blitz.datadrive.sh link --> ${error}"
|
|
||||||
echo "Please report issue to the raspiblitz github."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# adding drives to fstab for permanent mount
|
|
||||||
echo
|
|
||||||
echo "# --> Adding the data drive to OS ..."
|
|
||||||
echo "# hddCandidate='${hddCandidate}'"
|
|
||||||
echo "# hddPartitionCandidate='${hddPartitionCandidate}'"
|
|
||||||
echo "# hddFormat='${hddFormat}'"
|
|
||||||
if [ "$hddFormat" == "btrfs" ]; then
|
|
||||||
source <(sudo /home/admin/config.scripts/blitz.datadrive.sh fstab ${hddCandidate})
|
|
||||||
else
|
|
||||||
source <(sudo /home/admin/config.scripts/blitz.datadrive.sh fstab ${hddPartitionCandidate})
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ${#error} -gt 0 ]; then
|
|
||||||
echo "FAIL blitz.datadrive.sh fstab --> ${error}"
|
|
||||||
echo "Please report issue to the raspiblitz github."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# adding RAID drive
|
|
||||||
echo "# isBTRFS=${isBTRFS}"
|
|
||||||
echo "# raidCandidates=${raidCandidates}"
|
|
||||||
if [ ${isBTRFS} -eq 1 ] && [ ${raidCandidates} -eq 1 ]; then
|
|
||||||
|
|
||||||
# example string: 'sdb 28 GB SanDisk'
|
|
||||||
raidDevice=$(echo "${raidCandidate[0]}" | cut -d " " -f 1)
|
|
||||||
raidSizeGB=$(echo "${raidCandidate[0]}" | cut -d " " -f 2)
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo "# --> Adding Raid Drive ..."
|
|
||||||
echo "# raidDevice='${raidDevice}'"
|
|
||||||
echo "# raidSizeGB=${raidSizeGB}"
|
|
||||||
source <(sudo /home/admin/config.scripts/blitz.datadrive.sh raid on ${raidDevice})
|
|
||||||
if [ ${#error} -gt 0 ]; then
|
|
||||||
echo "# FAIL blitz.datadrive.sh raid on --> ${error}"
|
|
||||||
echo "# Please report issue to the raspiblitz github."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
# init the RASPIBLITZ Config
|
|
||||||
echo
|
|
||||||
echo "# --> Init raspiblitz.conf ..."
|
|
||||||
configFile="/mnt/hdd/raspiblitz.conf"
|
|
||||||
configExists=$(sudo ls ${configFile} 2>/dev/null | grep -c 'raspiblitz.conf')
|
|
||||||
if [ ${configExists} -eq 1 ]; then
|
|
||||||
|
|
||||||
# config exists - nothing much to do
|
|
||||||
echo "# config file already exists on HDD/SSD"
|
|
||||||
sudo chmod 777 ${configFile}
|
|
||||||
|
|
||||||
else
|
|
||||||
|
|
||||||
# create file and use init values from raspiblitz.info
|
|
||||||
echo "# CREATING new ${configFile}"
|
|
||||||
source /home/admin/_version.info
|
|
||||||
echo "# RASPIBLITZ CONFIG FILE" > /home/admin/raspiblitz.conf
|
|
||||||
echo "raspiBlitzVersion='${codeVersion}'" >> /home/admin/raspiblitz.conf
|
|
||||||
echo "network=${network}" >> /home/admin/raspiblitz.conf
|
|
||||||
echo "chain=${chain}" >> /home/admin/raspiblitz.conf
|
|
||||||
echo "hostname=${hostname}" >> /home/admin/raspiblitz.conf
|
|
||||||
echo "displayClass=${displayClass}" >> /home/admin/raspiblitz.conf
|
|
||||||
echo "displayType=${displayType}" >> /home/admin/raspiblitz.conf
|
|
||||||
echo "lcdrotate=1" >> /home/admin/raspiblitz.conf
|
|
||||||
|
|
||||||
sudo mv /home/admin/raspiblitz.conf $configFile
|
|
||||||
sudo chown root:root ${configFile}
|
|
||||||
sudo chmod 777 ${configFile}
|
|
||||||
sleep 3
|
|
||||||
|
|
||||||
# try to determine publicIP and make sure its in raspiblitz.conf
|
|
||||||
# https://github.com/rootzoll/raspiblitz/issues/312#issuecomment-462675101
|
|
||||||
/home/admin/config.scripts/internet.sh update-publicip
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
# link ssh directory from SD card to HDD
|
|
||||||
echo "# --> SSH key settings"
|
|
||||||
echo "# copying SSH pub keys to HDD"
|
|
||||||
sudo cp -r /etc/ssh /mnt/hdd/ssh
|
|
||||||
# just copy dont link anymore
|
|
||||||
# see: https://github.com/rootzoll/raspiblitz/issues/1798
|
|
||||||
#sudo rm -rf /etc/ssh
|
|
||||||
#sudo ln -s /mnt/hdd/ssh /etc/ssh
|
|
||||||
#sudo /home/admin/config.scripts/blitz.systemd.sh update-sshd
|
|
||||||
echo "# OK"
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
# set SetupState
|
|
||||||
sudo sed -i "s/^setupStep=.*/setupStep=40/g" /home/admin/raspiblitz.info
|
|
||||||
|
|
||||||
# check if HDD contains a blockchain to work with
|
|
||||||
echo "hddGotBlockchain=${hddGotBlockchain}"
|
|
||||||
if [ ${hddGotBlockchain} -eq 1 ]; then
|
|
||||||
|
|
||||||
echo "# Looks like the HDD is prepared with the Blockchain."
|
|
||||||
|
|
||||||
# ask user if prepared blockchain is to use or self-validate
|
|
||||||
whiptail --title ' Use Blockchain from HDD/SSD? ' --yes-button='Continue' --no-button='DELETE' --yesno "
|
|
||||||
On the HDD/SSD Blockchain data was found.\n
|
|
||||||
Continue if you trust that data to be valid.\n
|
|
||||||
If you dont trust that data you can now choose to delete it - but keep in mind that this can add multiple days of waiting time to your setup process to regain or self-validate the initial blockchain data.
|
|
||||||
" 14 75
|
|
||||||
if [ $? -eq 1 ]; then
|
|
||||||
# DELETE
|
|
||||||
echo "# Deleting old blockchain data .."
|
|
||||||
sudo rm -R /mnt/hdd/bitcoin 2>/dev/null
|
|
||||||
sudo rm -R /mnt/hdd/litecoin 2>/dev/null
|
|
||||||
# HDD is now empty - let setupBlitz - display next options
|
|
||||||
echo "# HDD now empty --> follow further setup"
|
|
||||||
./10setupBlitz.sh
|
|
||||||
else
|
|
||||||
# CONTINUE
|
|
||||||
echo "# Continuing with finishing the system setup ..."
|
|
||||||
./60finishHDD.sh
|
|
||||||
fi
|
|
||||||
|
|
||||||
else
|
|
||||||
|
|
||||||
# HDD is empty - let setupBlitz - display next options
|
|
||||||
echo "# HDD empty --> follow further setup"
|
|
||||||
./10setupBlitz.sh
|
|
||||||
|
|
||||||
fi
|
|
|
@ -1,256 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
## get basic info
|
|
||||||
source /home/admin/raspiblitz.info
|
|
||||||
|
|
||||||
# get local ip
|
|
||||||
localip=$(ip addr | grep 'state UP' -A2 | egrep -v 'docker0|veth' | grep 'eth0\|wlan0\|enp0' | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
|
|
||||||
|
|
||||||
# Basic Options
|
|
||||||
OPTIONS=(WINDOWS "Windows" \
|
|
||||||
MACOS "Apple MacOSX" \
|
|
||||||
LINUX "Linux" \
|
|
||||||
BLITZ "RaspiBlitz"
|
|
||||||
)
|
|
||||||
|
|
||||||
CHOICE=$(dialog --clear --title " Copy Blockchain from another laptop/node over LAN " --menu "\nWhich system is running on the other laptop/node you want to copy the blockchain from?\n " 14 60 9 "${OPTIONS[@]}" 2>&1 >/dev/tty)
|
|
||||||
|
|
||||||
clear
|
|
||||||
case $CHOICE in
|
|
||||||
MACOS) echo "Steve";;
|
|
||||||
LINUX) echo "Linus";;
|
|
||||||
WINDOWS) echo "Bill";;
|
|
||||||
BLITZ) echo "Satoshi";;
|
|
||||||
*) exit 1;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# additional prep if this is used to replace corrupted blockchain
|
|
||||||
if [ "${setupStep}" = "100" ]; then
|
|
||||||
# make sure services are not running
|
|
||||||
echo "stopping services ..."
|
|
||||||
sudo systemctl stop background
|
|
||||||
sudo systemctl stop lnd
|
|
||||||
sudo systemctl stop bitcoind
|
|
||||||
sudo cp -f /mnt/hdd/bitcoin/bitcoin.conf /home/admin/assets/bitcoin.conf
|
|
||||||
else
|
|
||||||
# make sure bitcoind is not running
|
|
||||||
sudo systemctl stop background <2 /dev/null
|
|
||||||
sudo systemctl stop bitcoind <2 /dev/null
|
|
||||||
fi
|
|
||||||
|
|
||||||
# check if old blockchain data exists
|
|
||||||
hasOldBlockchainData=0
|
|
||||||
sizeBlocks=$(sudo du -s /mnt/hdd/bitcoin/blocks 2>/dev/null | tr -dc '[0-9]')
|
|
||||||
if [ ${#sizeBlocks} -gt 0 ] && [ ${sizeBlocks} -gt 0 ]; then
|
|
||||||
hasOldBlockchainData=1
|
|
||||||
fi
|
|
||||||
sizeChainstate=$(sudo du -s /mnt/hdd/bitcoin/chainstate 2>/dev/null | tr -dc '[0-9]')
|
|
||||||
if [ ${#sizeChainstate} -gt 0 ] && [ ${sizeChainstate} -gt 0 ]; then
|
|
||||||
hasOldBlockchainData=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ${hasOldBlockchainData} -eq 1 ] && [ "$1" != "stop-after-script" ]; then
|
|
||||||
dialog --title " Old Blockchain Data Found " --yesno "\nDo you want to delete the existing blockchain data now?" 7 60
|
|
||||||
response=$?
|
|
||||||
echo "response(${response})"
|
|
||||||
if [ "${response}" = "1" ]; then
|
|
||||||
echo "OK - keep old blockchain - just try to repair by copying over it"
|
|
||||||
sleep 3
|
|
||||||
else
|
|
||||||
echo "OK - delete old blockchain"
|
|
||||||
sudo rm -rfv /mnt/hdd/bitcoin/blocks/* 2>/dev/null
|
|
||||||
sudo rm -rfv /mnt/hdd/bitcoin/chainstate/* 2>/dev/null
|
|
||||||
sleep 3
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# make sure /mnt/hdd/bitcoin exists
|
|
||||||
sudo mkdir /mnt/hdd/bitcoin 2>/dev/null
|
|
||||||
|
|
||||||
# allow all users write to it
|
|
||||||
sudo chmod 777 /mnt/hdd/bitcoin
|
|
||||||
|
|
||||||
echo
|
|
||||||
clear
|
|
||||||
if [ "${CHOICE}" = "WINDOWS" ]; then
|
|
||||||
echo "****************************************************************************"
|
|
||||||
echo "Instructions to COPY/TRANSFER SYNCED BLOCKCHAIN from a WINDOWS computer"
|
|
||||||
echo "****************************************************************************"
|
|
||||||
echo ""
|
|
||||||
echo "ON YOUR WINDOWS COMPUTER download and validate the blockchain with the Bitcoin"
|
|
||||||
echo "Core wallet software (>=0.17.1) from: bitcoincore.org/en/download"
|
|
||||||
echo "If the Bitcoin Blockchain is synced up - make sure that your Windows computer &"
|
|
||||||
echo "your RaspiBlitz are in the same local network."
|
|
||||||
echo ""
|
|
||||||
echo "Open a fresh terminal on your Windows computer & change into the directory that"
|
|
||||||
echo "contains the blockchain data - should see folders named 'blocks' & 'chainstate'"
|
|
||||||
echo "there. Normally on Windows thats: C:\Users\YourUserName\Appdata\Roaming\Bitcoin"
|
|
||||||
echo "Make sure that the Bitcoin Core Wallet is not running in the background anymore."
|
|
||||||
echo ""
|
|
||||||
echo "COPY, PASTE & EXECUTE the following command on your Windows computer terminal:"
|
|
||||||
echo "scp -r ./chainstate ./blocks bitcoin@${localip}:/mnt/hdd/bitcoin"
|
|
||||||
echo ""
|
|
||||||
echo "If asked for a password use PASSWORD A (or 'raspiblitz')."
|
|
||||||
fi
|
|
||||||
if [ "${CHOICE}" = "MACOS" ]; then
|
|
||||||
echo "****************************************************************************"
|
|
||||||
echo "Instructions to COPY/TRANSFER SYNCED BLOCKCHAIN from a MacOSX computer"
|
|
||||||
echo "****************************************************************************"
|
|
||||||
echo ""
|
|
||||||
echo "ON YOUR MacOSX COMPUTER download and validate the blockchain with the Bitcoin"
|
|
||||||
echo "Core wallet software (>=0.17.1) from: bitcoincore.org/en/download"
|
|
||||||
echo "If the Bitcoin Blockchain is synced up - make sure that your MacOSX computer &"
|
|
||||||
echo "your RaspiBlitz are in the same local network."
|
|
||||||
echo ""
|
|
||||||
echo "Open a fresh terminal on your MacOSX computer and change into the directory that"
|
|
||||||
echo "contains the blockchain data - should see folders named 'blocks' & 'chainstate'"
|
|
||||||
echo "there. Normally on MacOSX thats: cd ~/Library/Application Support/Bitcoin/"
|
|
||||||
echo "Make sure that the Bitcoin Core Wallet is not running in the background anymore."
|
|
||||||
echo ""
|
|
||||||
echo "COPY, PASTE & EXECUTE the following command on your MacOSX terminal:"
|
|
||||||
echo "sudo rsync -avhW --progress ./chainstate ./blocks bitcoin@${localip}:/mnt/hdd/bitcoin"
|
|
||||||
echo ""
|
|
||||||
echo "You will be asked for passwords. First can be the user password of your MacOSX"
|
|
||||||
echo "computer and the last is the PASSWORD A (or 'raspiblitz') of this RaspiBlitz."
|
|
||||||
fi
|
|
||||||
if [ "${CHOICE}" = "LINUX" ]; then
|
|
||||||
echo "****************************************************************************"
|
|
||||||
echo "Instructions to COPY/TRANSFER SYNCED BLOCKCHAIN from a LINUX computer"
|
|
||||||
echo "****************************************************************************"
|
|
||||||
echo ""
|
|
||||||
echo "ON YOUR LINUX COMPUTER download and validate the blockchain with the Bitcoin"
|
|
||||||
echo "Core wallet software (>=0.17.1) from: bitcoincore.org/en/download"
|
|
||||||
echo "If the Bitcoin Blockchain is synced up - make sure that your Linux computer &"
|
|
||||||
echo "your RaspiBlitz are in the same local network."
|
|
||||||
echo ""
|
|
||||||
echo "Open a fresh terminal on your Linux computer and change into the directory that"
|
|
||||||
echo "contains the blockchain data - should see folders named 'blocks' & 'chainstate'"
|
|
||||||
echo "there. Normally on Linux thats: cd ~/.bitcoin/"
|
|
||||||
echo "Make sure that the Bitcoin Core Wallet is not running in the background anymore."
|
|
||||||
echo ""
|
|
||||||
echo "COPY, PASTE & EXECUTE the following command on your Linux terminal:"
|
|
||||||
echo "sudo rsync -avhW --progress ./chainstate ./blocks bitcoin@${localip}:/mnt/hdd/bitcoin"
|
|
||||||
echo ""
|
|
||||||
echo "You will be asked for passwords. First can be the user password of your Linux"
|
|
||||||
echo "computer and the last is the PASSWORD A (or 'raspiblitz') of this RaspiBlitz."
|
|
||||||
fi
|
|
||||||
if [ "${CHOICE}" = "BLITZ" ]; then
|
|
||||||
echo "****************************************************************************"
|
|
||||||
echo "Instructions to COPY/TRANSFER SYNCED BLOCKCHAIN from another RaspiBlitz"
|
|
||||||
echo "****************************************************************************"
|
|
||||||
echo ""
|
|
||||||
echo "The other RaspiBlitz needs a minimum version of 1.6 (if lower, update first)."
|
|
||||||
echo "Make sure that the other RaspiBlitz is on the same local network."
|
|
||||||
echo ""
|
|
||||||
echo "Open a fresh terminal and login per SSH into that other RaspiBlitz."
|
|
||||||
echo "Once in the main menu go: MAINMENU > REPAIR > COPY-SOURCE"
|
|
||||||
echo "Follow the given instructions ..."
|
|
||||||
echo ""
|
|
||||||
echo "The LOCAL IP of this target RaspiBlitz is: ${localip}"
|
|
||||||
fi
|
|
||||||
echo ""
|
|
||||||
echo "It can take multiple hours until transfer is complete - be patient."
|
|
||||||
echo "****************************************************************************"
|
|
||||||
echo "PRESS ENTER if transfers is done OR if you want to choose another option."
|
|
||||||
sleep 2
|
|
||||||
read key
|
|
||||||
|
|
||||||
# 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
|
|
||||||
|
|
||||||
echo "*********************************************"
|
|
||||||
echo "QUICK CHECK RESULT"
|
|
||||||
echo "*********************************************"
|
|
||||||
|
|
||||||
# just if any data transferred ..
|
|
||||||
if [ ${anyDataAtAll} -eq 1 ]; then
|
|
||||||
|
|
||||||
# data was invalid - ask user to keep?
|
|
||||||
if [ ${quickCheckOK} -eq 0 ]; then
|
|
||||||
|
|
||||||
echo "FAIL -> DATA seems incomplete."
|
|
||||||
|
|
||||||
else
|
|
||||||
|
|
||||||
echo "OK -> DATA LOOKS GOOD :D"
|
|
||||||
sudo rm /mnt/hdd/bitcoin/debug.log 2>/dev/null
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
else
|
|
||||||
|
|
||||||
echo "CANCEL -> NO DATA was copied."
|
|
||||||
quickCheckOK=0
|
|
||||||
|
|
||||||
fi
|
|
||||||
echo "*********************************************"
|
|
||||||
|
|
||||||
# if started with parameter "stop-after-script" - quit here
|
|
||||||
if [ "$1" == "stop-after-script" ]; then
|
|
||||||
echo "DONE Copy"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# if started after initial setup - quit here
|
|
||||||
if [ "${setupStep}" = "100" ]; then
|
|
||||||
sudo cp /home/admin/assets/bitcoin.conf /mnt/hdd/bitcoin/bitcoin.conf
|
|
||||||
sudo systemctl enable bitcoind
|
|
||||||
echo "DONE - rebooting: sudo shutdown -r now"
|
|
||||||
sudo shutdown -r now
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# REACT ON QUICK CHECK DURING INITAL SETUP
|
|
||||||
|
|
||||||
if [ ${quickCheckOK} -eq 0 ]; then
|
|
||||||
|
|
||||||
echo "*********************************************"
|
|
||||||
echo "There seems to be an invalid transfer."
|
|
||||||
|
|
||||||
echo "Wait 5 secs ..."
|
|
||||||
sleep 5
|
|
||||||
|
|
||||||
dialog --title " INVALID TRANSFER - TRY AGAIN?" --yesno "Quickcheck shows the data you transferred is invalid/incomplete. Maybe transfer was interrupted and not completed.\n\nDo you want retry/proceed the copy process?" 8 70
|
|
||||||
response=$?
|
|
||||||
echo "response(${response})"
|
|
||||||
if [ "${response}" == "0" ]; then
|
|
||||||
/home/admin/50copyHDD.sh
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
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?" 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
|
|
||||||
sleep 2
|
|
||||||
fi
|
|
||||||
|
|
||||||
# setup script will decide the next logical step
|
|
||||||
/home/admin/10setupBlitz.sh
|
|
|
@ -1,98 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
## get basic info
|
|
||||||
source /home/admin/raspiblitz.info
|
|
||||||
|
|
||||||
# only show warning when bitcoin
|
|
||||||
if [ "$network" = "bitcoin" ]; then
|
|
||||||
|
|
||||||
# detect hardware version of RaspberryPi
|
|
||||||
# https://www.unixtutorial.org/command-to-confirm-raspberry-pi-model
|
|
||||||
raspberryPi=$(cat /proc/device-tree/model | cut -d " " -f 3 | sed 's/[^0-9]*//g')
|
|
||||||
if [ ${#raspberryPi} -eq 0 ]; then
|
|
||||||
raspberryPi=0
|
|
||||||
fi
|
|
||||||
echo "RaspberryPi Model Version: ${raspberryPi}"
|
|
||||||
if [ ${raspberryPi} -lt 4 ]; then
|
|
||||||
# raspberryPi 3 and lower
|
|
||||||
msg=" This old RaspberryPi has very limited CPU power.\n"
|
|
||||||
msg="$msg To sync & validate the complete blockchain\n"
|
|
||||||
msg="$msg can take multiple days - even weeks\n"
|
|
||||||
msg="$msg Its recommended to use another option.\n"
|
|
||||||
msg="$msg \n"
|
|
||||||
msg="$msg So do you really want start syncing now?"
|
|
||||||
dialog --title " WARNING " --yesno "${msg}" 11 57
|
|
||||||
response=$?
|
|
||||||
case $response in
|
|
||||||
0) echo "--> OK";;
|
|
||||||
1) exit 1;;
|
|
||||||
255) exit 1;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# ask if really sync behind TOR
|
|
||||||
# if [ "${runBehindTor}" = "on" ]; then
|
|
||||||
# whiptail --title ' Sync Blockchain from behind TOR? ' --yes-button='Public-Sync' --no-button='TOR-Sync' --yesno "You decided to run your node behind TOR and validate the blockchain with your RaspiBlitz - thats good. But downloading the complete blockchain thru TOR can add some extra time (maybe a day) to the process and adds a heavy load on the TOR network.\n
|
|
||||||
#Your RaspiBlitz can just run the initial blockchain download with your public IP (Public-Sync) but keep your Lighting node safe behind TOR.
|
|
||||||
#It would speed up the self-validation while not revealing your Lightning node identity. But for most privacy choose (TOR-Sync).
|
|
||||||
# " 15 76
|
|
||||||
# if [ $? -eq 0 ]; then
|
|
||||||
# # set flag to not run bitcoin behind TOR during IDB
|
|
||||||
# echo "ibdBehindTor=off" >> /home/admin/raspiblitz.info
|
|
||||||
# fi
|
|
||||||
#fi
|
|
||||||
|
|
||||||
echo "**********************************"
|
|
||||||
echo "Dont Trust, verify - starting sync"
|
|
||||||
echo "**********************************"
|
|
||||||
echo ""
|
|
||||||
sleep 3
|
|
||||||
|
|
||||||
|
|
||||||
echo "*** Optimizing RAM for Sync ***"
|
|
||||||
|
|
||||||
kbSizeRAM=$(cat /proc/meminfo | grep "MemTotal" | sed 's/[^0-9]*//g')
|
|
||||||
echo "dont forget to reduce dbcache once IBD is done" > "/home/admin/selfsync.flag"
|
|
||||||
# RP4 4GB
|
|
||||||
if [ ${kbSizeRAM} -gt 3500000 ]; then
|
|
||||||
echo "Detected RAM >=4GB --> optimizing ${network}.conf"
|
|
||||||
sudo sed -i "s/^dbcache=.*/dbcache=3072/g" /home/admin/assets/${network}.conf
|
|
||||||
# RP4 2GB
|
|
||||||
elif [ ${kbSizeRAM} -gt 1500000 ]; then
|
|
||||||
echo "Detected RAM >=2GB --> optimizing ${network}.conf"
|
|
||||||
sudo sed -i "s/^dbcache=.*/dbcache=1536/g" /home/admin/assets/${network}.conf
|
|
||||||
# RP3/4 1GB
|
|
||||||
else
|
|
||||||
echo "Detected RAM <=1GB --> optimizing ${network}.conf"
|
|
||||||
sudo sed -i "s/^dbcache=.*/dbcache=512/g" /home/admin/assets/${network}.conf
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "*** Activating Blockain Sync ***"
|
|
||||||
|
|
||||||
sudo mkdir /mnt/hdd/${network} 2>/dev/null
|
|
||||||
sudo /home/admin/XXcleanHDD.sh -blockchain -force
|
|
||||||
sudo -u bitcoin mkdir /mnt/hdd/${network}/blocks 2>/dev/null
|
|
||||||
sudo -u bitcoin mkdir /mnt/hdd/${network}/chainstate 2>/dev/null
|
|
||||||
|
|
||||||
# set so that 10raspiblitz.sh has a flag to see that resync is running
|
|
||||||
sudo touch /mnt/hdd/${network}/blocks/.selfsync
|
|
||||||
sudo sed -i "s/^state=.*/state=sync/g" /home/admin/raspiblitz.info
|
|
||||||
|
|
||||||
echo "OK - sync is activated"
|
|
||||||
|
|
||||||
if [ "${setupStep}" = "100" ]; then
|
|
||||||
|
|
||||||
# start services
|
|
||||||
echo "reboot needed: shutdown -r now"
|
|
||||||
|
|
||||||
else
|
|
||||||
|
|
||||||
# set SetupState
|
|
||||||
sudo sed -i "s/^setupStep=.*/setupStep=50/g" /home/admin/raspiblitz.info
|
|
||||||
|
|
||||||
# continue setup
|
|
||||||
./60finishHDD.sh
|
|
||||||
|
|
||||||
fi
|
|
|
@ -1,89 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
## get basic info
|
|
||||||
source /home/admin/raspiblitz.info
|
|
||||||
source /mnt/hdd/raspiblitz.conf
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "*** 60finishHDD.sh ***"
|
|
||||||
|
|
||||||
# use blitz.datadrive.sh to analyse HDD situation
|
|
||||||
source <(sudo /home/admin/config.scripts/blitz.datadrive.sh status ${network})
|
|
||||||
if [ ${#error} -gt 0 ]; then
|
|
||||||
echo "# FAIL blitz.datadrive.sh status --> ${error}"
|
|
||||||
echo "# Please report issue to the raspiblitz github."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# check that data drive is mounted
|
|
||||||
if [ ${isMounted} -eq 0 ]; then
|
|
||||||
echo "# FAIL - HDD is not mounted."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
###### COPY BASIC NETWORK CONFIG
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "*** Prepare ${network} ***"
|
|
||||||
sudo cp /home/admin/assets/${network}.conf /mnt/hdd/${network}/${network}.conf
|
|
||||||
sudo mkdir /home/admin/.${network} 2>/dev/null
|
|
||||||
sudo cp /home/admin/assets/${network}.conf /home/admin/.${network}/${network}.conf
|
|
||||||
|
|
||||||
# make sure all files are linked correct
|
|
||||||
sudo /home/admin/config.scripts/blitz.datadrive.sh link
|
|
||||||
|
|
||||||
# BLITZ WEB SERVICE
|
|
||||||
/home/admin/config.scripts/blitz.web.sh on
|
|
||||||
|
|
||||||
###### ACTIVATE TOR IF SET DURING SETUP
|
|
||||||
if [ "${runBehindTor}" = "on" ]; then
|
|
||||||
|
|
||||||
echo "runBehindTor --> ON"
|
|
||||||
sudo /home/admin/config.scripts/internet.tor.sh on
|
|
||||||
|
|
||||||
# but if IBD is allowed to be public switch off TOR just fro bitcoin
|
|
||||||
# until IBD is done. background service will after that switch TOR on
|
|
||||||
if [ "${ibdBehindTor}" = "off" ]; then
|
|
||||||
echo "ibdBehindTor --> OFF"
|
|
||||||
sudo /home/admin/config.scripts/internet.tor.sh btcconf-off
|
|
||||||
else
|
|
||||||
echo "ibdBehindTor --> ON"
|
|
||||||
fi
|
|
||||||
|
|
||||||
else
|
|
||||||
echo "runBehindTor --> OFF"
|
|
||||||
fi
|
|
||||||
|
|
||||||
###### START NETWORK SERVICE
|
|
||||||
echo ""
|
|
||||||
echo "*** Start ${network} ***"
|
|
||||||
echo "- This can take a while .."
|
|
||||||
sudo cp /home/admin/assets/${network}d.service /etc/systemd/system/${network}d.service
|
|
||||||
#sudo chmod +x /etc/systemd/system/${network}d.service
|
|
||||||
sudo systemctl daemon-reload
|
|
||||||
sudo systemctl enable ${network}d.service
|
|
||||||
sudo systemctl start ${network}d.service
|
|
||||||
|
|
||||||
# check if bitcoin has started
|
|
||||||
bitcoinRunning=0
|
|
||||||
loopcount=0
|
|
||||||
while [ ${bitcoinRunning} -eq 0 ]
|
|
||||||
do
|
|
||||||
>&2 echo "# (${loopcount}/200) checking if ${network}d is running ... "
|
|
||||||
bitcoinRunning=$(${network}-cli getblockchaininfo 2>/dev/null | grep "initialblockdownload" -c)
|
|
||||||
sleep 2
|
|
||||||
sync
|
|
||||||
loopcount=$(($loopcount +1))
|
|
||||||
if [ ${loopcount} -gt 200 ]; then
|
|
||||||
/home/admin/XXdebugLogs.sh
|
|
||||||
echo "***********************************"
|
|
||||||
echo "FAIL: ${network} failed to start :("
|
|
||||||
echo "Get support or try again the command: raspiblitz"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# set SetupState
|
|
||||||
sudo sed -i "s/^setupStep=.*/setupStep=60/g" /home/admin/raspiblitz.info
|
|
||||||
|
|
||||||
./10setupBlitz.sh
|
|
|
@ -1,489 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
## get basic info
|
|
||||||
source /home/admin/raspiblitz.info
|
|
||||||
source /mnt/hdd/raspiblitz.conf
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "*** 70initLND.sh ***"
|
|
||||||
|
|
||||||
# CHECK #########
|
|
||||||
|
|
||||||
echo "*** Check Basic Config ***"
|
|
||||||
if [ ${#network} -eq 0 ]; then
|
|
||||||
echo "FAIL - missing: network"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if [ ${#chain} -eq 0 ]; then
|
|
||||||
echo "FAIL - missing: chain"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# CHECK #########
|
|
||||||
|
|
||||||
echo "*** Check ${network} Running ***"
|
|
||||||
bitcoinRunning=$(systemctl status ${network}d.service 2>/dev/null | grep -c running)
|
|
||||||
if [ ${bitcoinRunning} -eq 0 ]; then
|
|
||||||
bitcoinRunning=$(sudo -u bitcoin ${network}-cli -datadir=/home/bitcoin/.${network} getblockchaininfo | grep -c verificationprogress)
|
|
||||||
fi
|
|
||||||
if [ ${bitcoinRunning} -eq 0 ]; then
|
|
||||||
whiptail --title "70initLND - WARNING" --yes-button "Retry" --no-button "EXIT+Logs" --yesno "Service ${network}d is not running." 8 50
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
/home/admin/70initLND.sh
|
|
||||||
else
|
|
||||||
/home/admin/XXdebugLogs.sh
|
|
||||||
fi
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# CHECK #########
|
|
||||||
|
|
||||||
echo "*** Check ${network} Responding *** (can take a while)"
|
|
||||||
chainIsReady=0
|
|
||||||
loopCount=0
|
|
||||||
while [ ${chainIsReady} -eq 0 ]
|
|
||||||
do
|
|
||||||
loopCount=$(($loopCount +1))
|
|
||||||
result=$(sudo -u bitcoin ${network}-cli -datadir=/home/bitcoin/.${network} getblockchaininfo 2>error.out)
|
|
||||||
error=$(cat error.out)
|
|
||||||
rm error.out
|
|
||||||
if [ ${#error} -gt 0 ]; then
|
|
||||||
if [ ${loopCount} -gt 33 ]; then
|
|
||||||
echo "*** TAKES LONGER THEN EXCEPTED ***"
|
|
||||||
date +%s
|
|
||||||
echo "result(${result})"
|
|
||||||
echo "error(${error})"
|
|
||||||
testnetAdd=""
|
|
||||||
if [ "${chain}" = "test" ]; then
|
|
||||||
testnetAdd="testnet3/"
|
|
||||||
fi
|
|
||||||
sudo tail -n 5 /mnt/hdd/${network}/${testnetAdd}debug.log
|
|
||||||
echo "If you see an error -28 relax, just give it some time."
|
|
||||||
echo "Waiting 1 minute and then trying again ..."
|
|
||||||
sleep 60
|
|
||||||
else
|
|
||||||
echo "(${loopCount}/33) still waiting .."
|
|
||||||
sleep 10
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "OK - chainnetwork is working"
|
|
||||||
echo ""
|
|
||||||
chainIsReady=1
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# CHECK #########
|
|
||||||
|
|
||||||
echo "*** Check LND Config ***"
|
|
||||||
configExists=$( sudo ls /mnt/hdd/lnd/lnd.conf 2>/dev/null | grep -c lnd.conf )
|
|
||||||
if [ ${configExists} -eq 0 ]; then
|
|
||||||
echo "Creating LND config ..."
|
|
||||||
sudo mkdir /mnt/hdd/lnd 2> /dev/null
|
|
||||||
sudo chown -R bitcoin:bitcoin /mnt/hdd/lnd
|
|
||||||
sudo cp /home/admin/assets/lnd.${network}.conf /mnt/hdd/lnd/lnd.conf
|
|
||||||
sudo chown bitcoin:bitcoin /mnt/hdd/lnd/lnd.conf
|
|
||||||
if [ -d /home/bitcoin/.lnd ]; then
|
|
||||||
echo "OK - LND config written"
|
|
||||||
else
|
|
||||||
echo "FAIL - Was not able to setup LND"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "OK - exists"
|
|
||||||
fi
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
###### Init LND service & start
|
|
||||||
|
|
||||||
echo "*** Init LND Service & Start ***"
|
|
||||||
lndRunning=$(sudo systemctl status lnd.service 2>/dev/null | grep -c running)
|
|
||||||
if [ ${lndRunning} -eq 0 ]; then
|
|
||||||
|
|
||||||
echo "stopping lnd .."
|
|
||||||
sudo systemctl stop lnd 2>/dev/null
|
|
||||||
sudo systemctl disable lnd 2>/dev/null
|
|
||||||
|
|
||||||
sed -i "5s/.*/Wants=${network}d.service/" /home/admin/assets/lnd.service
|
|
||||||
sed -i "6s/.*/After=${network}d.service/" /home/admin/assets/lnd.service
|
|
||||||
sudo cp /home/admin/assets/lnd.service /etc/systemd/system/lnd.service
|
|
||||||
#sudo chmod +x /etc/systemd/system/lnd.service
|
|
||||||
|
|
||||||
###### ACTIVATE TOR IF SET DURING SETUP
|
|
||||||
if [ "${runBehindTor}" = "on" ]; then
|
|
||||||
echo "TOR was selected"
|
|
||||||
sudo /home/admin/config.scripts/internet.tor.sh lndconf-on
|
|
||||||
else
|
|
||||||
echo "TOR was not selected"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Starting LND Service ..."
|
|
||||||
sudo systemctl enable lnd
|
|
||||||
sudo systemctl start lnd
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "waiting ."
|
|
||||||
sleep 10
|
|
||||||
echo "waiting .."
|
|
||||||
sleep 10
|
|
||||||
echo "waiting ..."
|
|
||||||
sleep 10
|
|
||||||
dialog --pause " Starting LND - please wait .." 8 58 90
|
|
||||||
fi
|
|
||||||
|
|
||||||
###### Check LND starting
|
|
||||||
|
|
||||||
while [ ${lndRunning} -eq 0 ]
|
|
||||||
do
|
|
||||||
lndRunning=$(sudo systemctl status lnd.service | grep -c running)
|
|
||||||
if [ ${lndRunning} -eq 0 ]; then
|
|
||||||
date +%s
|
|
||||||
echo "LND not ready yet ... waiting another 60 seconds."
|
|
||||||
echo "If this takes too long (more then 10min total) --> CTRL+c and report Problem"
|
|
||||||
sleep 60
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
echo "OK - LND is running"
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
###### Check LND health/fails (to be extended)
|
|
||||||
fail=""
|
|
||||||
tlsExists=$(sudo ls /mnt/hdd/lnd/tls.cert 2>/dev/null | grep -c "tls.cert")
|
|
||||||
if [ ${tlsExists} -eq 0 ]; then
|
|
||||||
fail="LND was starting, but missing /mnt/hdd/lnd/tls.cert"
|
|
||||||
fi
|
|
||||||
if [ ${#fail} -gt 0 ]; then
|
|
||||||
whiptail --title "70initLND - WARNING" --yes-button "Retry" --no-button "EXIT+Logs" --yesno "${fail}" 8 50
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
/home/admin/70initLND.sh
|
|
||||||
else
|
|
||||||
/home/admin/XXdebugLogs.sh
|
|
||||||
fi
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
###### Instructions on Creating/Restoring LND Wallet
|
|
||||||
walletExists=$(sudo ls /mnt/hdd/lnd/data/chain/${network}/${chain}net/wallet.db 2>/dev/null | grep wallet.db -c)
|
|
||||||
echo "walletExists(${walletExists})"
|
|
||||||
sleep 2
|
|
||||||
if [ ${walletExists} -eq 0 ]; then
|
|
||||||
|
|
||||||
# UI: Ask if user wants NEW wallet or RECOVER a wallet
|
|
||||||
OPTIONS=(NEW "Setup a brand new Lightning Node (DEFAULT)" \
|
|
||||||
OLD "I had an old Node I want to recover/restore")
|
|
||||||
CHOICE=$(dialog --backtitle "RaspiBlitz" --clear --title "LND Setup" --menu "LND Data & Wallet" 11 60 6 "${OPTIONS[@]}" 2>&1 >/dev/tty)
|
|
||||||
echo "choice($CHOICE)"
|
|
||||||
|
|
||||||
if [ "${CHOICE}" == "NEW" ]; then
|
|
||||||
|
|
||||||
############################
|
|
||||||
# NEW WALLET
|
|
||||||
############################
|
|
||||||
|
|
||||||
# let user enter password c
|
|
||||||
sudo shred -u /var/cache/raspiblitz/.pass.tmp 2>/dev/null
|
|
||||||
sudo touch /var/cache/raspiblitz/.pass.tmp
|
|
||||||
sudo chown admin:admin /var/cache/raspiblitz/.pass.tmp
|
|
||||||
sudo /home/admin/config.scripts/blitz.setpassword.sh x "Set your Password C for the LND Wallet Unlock" /var/cache/raspiblitz/.pass.tmp
|
|
||||||
passwordC=$(sudo cat /var/cache/raspiblitz/.pass.tmp)
|
|
||||||
sudo shred -u /var/cache/raspiblitz/.pass.tmp 2>/dev/null
|
|
||||||
|
|
||||||
# make sure passwordC is set
|
|
||||||
if [ ${#passwordC} -eq 0 ]; then
|
|
||||||
/home/admin/70initLND.sh
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# generate wallet with seed and set passwordC
|
|
||||||
clear
|
|
||||||
echo "Generating new Wallet ...."
|
|
||||||
sudo touch /var/cache/raspiblitz/.seed.tmp
|
|
||||||
sudo chown admin:admin /var/cache/raspiblitz/.seed.tmp
|
|
||||||
python3 /home/admin/config.scripts/lnd.initwallet.py new ${passwordC} > /var/cache/raspiblitz/.seed.tmp
|
|
||||||
source /var/cache/raspiblitz/.seed.tmp
|
|
||||||
sudo shred -u /var/cache/raspiblitz/.seed.tmp 2>/dev/null
|
|
||||||
|
|
||||||
# in case of error - retry
|
|
||||||
if [ ${#err} -gt 0 ]; then
|
|
||||||
whiptail --title "lnd.initwallet.py - ERROR" --msgbox "${err}" 8 50
|
|
||||||
/home/admin/70initLND.sh
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
if [ ${#seedwords} -eq 0 ]; then
|
|
||||||
echo "FAIL!! -> MISSING seedwords data - but also no err data ?!?"
|
|
||||||
echo "CHECK output data above - PRESS ENTER to restart 70initLND.sh"
|
|
||||||
read key
|
|
||||||
/home/admin/70initLND.sh
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ${#seedwords6x4} -eq 0 ]; then
|
|
||||||
seedwords6x4="${seedwords}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
ack=0
|
|
||||||
while [ ${ack} -eq 0 ]
|
|
||||||
do
|
|
||||||
whiptail --title "IMPORTANT SEED WORDS - PLEASE WRITE DOWN" --msgbox "LND Wallet got created. Store these numbered words in a safe location:\n\n${seedwords6x4}" 12 76
|
|
||||||
whiptail --title "Please Confirm" --yes-button "Show Again" --no-button "CONTINUE" --yesno " Are you sure that you wrote down the word list?" 8 55
|
|
||||||
if [ $? -eq 1 ]; then
|
|
||||||
ack=1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ ${setupStep} -lt 100 ]; then
|
|
||||||
sudo sed -i "s/^setupStep=.*/setupStep=65/g" /home/admin/raspiblitz.info
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "waiting ."
|
|
||||||
sleep 10
|
|
||||||
|
|
||||||
else
|
|
||||||
|
|
||||||
############################
|
|
||||||
# RECOVER OLD WALLET
|
|
||||||
############################
|
|
||||||
|
|
||||||
OPTIONS=(LNDRESCUE "LND tar.gz-Backupfile (BEST)" \
|
|
||||||
SEED+SCB "Seed & channel.backup file (OK)" \
|
|
||||||
ONLYSEED "Only Seed Word List (FALLBACK)")
|
|
||||||
CHOICE=$(dialog --backtitle "RaspiBlitz" --clear --title "RECOVER LND DATA & WALLET" --menu "Data you have to recover from?" 11 60 6 "${OPTIONS[@]}" 2>&1 >/dev/tty)
|
|
||||||
|
|
||||||
# LND RESCUE
|
|
||||||
if [ "${CHOICE}" == "LNDRESCUE" ]; then
|
|
||||||
sudo /home/admin/config.scripts/lnd.rescue.sh restore
|
|
||||||
echo ""
|
|
||||||
echo "PRESS ENTER to continue."
|
|
||||||
read key
|
|
||||||
/home/admin/70initLND.sh
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# WARNING ON ONLY SEED
|
|
||||||
if [ "${CHOICE}" == "ONLYSEED" ]; then
|
|
||||||
|
|
||||||
# let people know about the difference between SEED & SEED+SCB
|
|
||||||
whiptail --title "IMPORTANT INFO" --yes-button "Continue" --no-button "Go Back" --yesno "
|
|
||||||
Using JUST SEED WORDS will only recover your on-chain funds.
|
|
||||||
To also try to recover the open channel funds you need the
|
|
||||||
channel.backup file (since RaspiBlitz v1.2 / LND 0.6-beta)
|
|
||||||
or having a complete LND rescue-backup from your old node.
|
|
||||||
" 11 65
|
|
||||||
if [ $? -eq 1 ]; then
|
|
||||||
/home/admin/70initLND.sh
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# IF SEED and SCB - make user upload channel.backup file now
|
|
||||||
# and it will get automated activated after syncs are ready
|
|
||||||
# TODO: later activate directly with call to lnd.iniwallet.py
|
|
||||||
if [ "${CHOICE}" == "SEED+SCB" ]; then
|
|
||||||
|
|
||||||
# let lnd.rescue script do the upload process
|
|
||||||
/home/admin/config.scripts/lnd.rescue.sh scb-up
|
|
||||||
|
|
||||||
# check exit code of script
|
|
||||||
if [ $? -eq 1 ]; then
|
|
||||||
echo "USER CANCEL --> back to menu"
|
|
||||||
/home/admin/70initLND.sh
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
clear
|
|
||||||
echo "channel.backup will get checked/activated after blockchain/lightning is synced"
|
|
||||||
sleep 2
|
|
||||||
echo "NEXT --> Set password for new LND wallet"
|
|
||||||
sleep 3
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
clear
|
|
||||||
|
|
||||||
# let user enter password c
|
|
||||||
sudo shred -u /var/cache/raspiblitz/.pass.tmp 2>/dev/null
|
|
||||||
sudo touch /var/cache/raspiblitz/.pass.tmp
|
|
||||||
sudo chown admin:admin /var/cache/raspiblitz/.pass.tmp
|
|
||||||
sudo /home/admin/config.scripts/blitz.setpassword.sh x "Set your Password C for the LND Wallet Unlock" /var/cache/raspiblitz/.pass.tmp
|
|
||||||
passwordC=$(sudo cat /var/cache/raspiblitz/.pass.tmp)
|
|
||||||
sudo shred -u /var/cache/raspiblitz/.pass.tmp 2>/dev/null
|
|
||||||
|
|
||||||
# get seed word list
|
|
||||||
if [ "${CHOICE}" == "SEED+SCB" ] || [ "${CHOICE}" == "ONLYSEED" ]; then
|
|
||||||
|
|
||||||
wordsCorrect=0
|
|
||||||
while [ ${wordsCorrect} -eq 0 ]
|
|
||||||
do
|
|
||||||
# dialog to enter
|
|
||||||
sudo touch /var/cache/raspiblitz/.seed.tmp
|
|
||||||
sudo chown admin:admin /var/cache/raspiblitz/.seed.tmp
|
|
||||||
dialog --backtitle "RaspiBlitz - LND Recover" --inputbox "Please enter/paste the SEED WORD LIST:\n(just the words, separated by spaces, in correct order as numbered)" 9 78 2>/var/cache/raspiblitz/.seed.tmp
|
|
||||||
wordstring=$( cat /var/cache/raspiblitz/.seed.tmp | sed 's/[^a-zA-Z0-9 ]//g' )
|
|
||||||
shred -u /var/cache/raspiblitz/.seed.tmp
|
|
||||||
echo "processing ... ${wordstring}"
|
|
||||||
|
|
||||||
# check correct number of words
|
|
||||||
wordcount=$(echo "${wordstring}" | wc -w)
|
|
||||||
if [ ${wordcount} -eq 24 ]; then
|
|
||||||
echo "OK - 24 words"
|
|
||||||
wordsCorrect=1
|
|
||||||
else
|
|
||||||
whiptail --title " WARNING " \
|
|
||||||
--yes-button "Try Again" \
|
|
||||||
--no-button "Cancel" \
|
|
||||||
--yesno "
|
|
||||||
The word list has ${wordcount} words. But it must be 24.
|
|
||||||
Please check your list and try again.
|
|
||||||
|
|
||||||
Best is to write words in external editor
|
|
||||||
and then copy and paste them into dialog.
|
|
||||||
|
|
||||||
The Word list should look like this:
|
|
||||||
wordone wordtwo wordthree ...
|
|
||||||
|
|
||||||
" 16 52
|
|
||||||
|
|
||||||
if [ $? -eq 1 ]; then
|
|
||||||
/home/admin/70initLND.sh
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# ask if seed was protected by password D
|
|
||||||
passwordD=""
|
|
||||||
dialog --title "SEED PASSWORD" --yes-button "No extra Password" --no-button "Yes" --yesno "
|
|
||||||
Are your seed words protected by an extra password?
|
|
||||||
|
|
||||||
During wallet creation LND offers to set an extra password
|
|
||||||
to protect the seed words. Most users did not set this.
|
|
||||||
" 11 65
|
|
||||||
if [ $? -eq 1 ]; then
|
|
||||||
sudo shred -u /var/cache/raspiblitz/.pass.tmp 2>/dev/null
|
|
||||||
sudo touch /var/cache/raspiblitz/.pass.tmp
|
|
||||||
sudo chown admin:admin /var/cache/raspiblitz/.pass.tmp
|
|
||||||
sudo /home/admin/config.scripts/blitz.setpassword.sh x "Enter extra Password D" /var/cache/raspiblitz/.pass.tmp empty-allowed
|
|
||||||
passwordD=$(sudo cat /var/cache/raspiblitz/.pass.tmp)
|
|
||||||
sudo shred -u /var/cache/raspiblitz/.pass.tmp 2>/dev/null
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
# FOR NOW: let channel.backup file get activated by lncli after syncs
|
|
||||||
# LATER: make different call to lnd.initwallet.py
|
|
||||||
if [ "${CHOICE}" == "SEED+SCB" ] || [ "${CHOICE}" == "ONLYSEED" ]; then
|
|
||||||
|
|
||||||
# trigger wallet recovery
|
|
||||||
source <(python3 /home/admin/config.scripts/lnd.initwallet.py seed ${passwordC} "${wordstring}" ${passwordD} 2>/dev/null)
|
|
||||||
|
|
||||||
# check if wallet was created for real
|
|
||||||
if [ ${#err} -eq 0 ]; then
|
|
||||||
walletExists=$(sudo ls /mnt/hdd/lnd/data/chain/${network}/${chain}net/wallet.db 2>/dev/null | grep wallet.db -c)
|
|
||||||
if [ ${walletExists} -eq 0 ]; then
|
|
||||||
err="Was not able to create wallet (unknown error)."
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# set fundRecovery=1 in raspiblitz.info
|
|
||||||
sed -i "s/^fundRecovery=.*/fundRecovery=1/g" /home/admin/raspiblitz.info
|
|
||||||
|
|
||||||
# user feedback
|
|
||||||
if [ ${#err} -eq 0 ]; then
|
|
||||||
dialog --title " SUCCESS " --msgbox "
|
|
||||||
Looks good :) LND was able to recover the wallet.
|
|
||||||
|
|
||||||
IMPORTANT: LND needs now to scan the blockchain
|
|
||||||
for your funds - this can take some extra time.
|
|
||||||
" 10 60
|
|
||||||
clear
|
|
||||||
|
|
||||||
else
|
|
||||||
whiptail --title " FAIL " --msgbox "
|
|
||||||
Something went wrong - see info below:
|
|
||||||
|
|
||||||
${err}
|
|
||||||
${errMore}
|
|
||||||
" 13 72
|
|
||||||
clear
|
|
||||||
echo "Restarting LND Wallet Setup .."
|
|
||||||
sleep 2
|
|
||||||
echo
|
|
||||||
/home/admin/70initLND.sh
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi # END OLD WALLET
|
|
||||||
|
|
||||||
else
|
|
||||||
echo "OK - LND wallet already exists."
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
echo "waiting .."
|
|
||||||
sleep 10
|
|
||||||
dialog --pause " Waiting for LND - please wait .." 8 58 45
|
|
||||||
|
|
||||||
############################
|
|
||||||
# Copy LND macaroons to admin
|
|
||||||
############################
|
|
||||||
|
|
||||||
clear
|
|
||||||
echo ""
|
|
||||||
echo "*** Copy LND Macaroons to user admin ***"
|
|
||||||
|
|
||||||
# check if macaroon exists and if not try to unlock LND wallet first
|
|
||||||
macaroonExists=$(sudo -u bitcoin ls -la /home/bitcoin/.lnd/data/chain/${network}/${chain}net/admin.macaroon 2>/dev/null | grep -c admin.macaroon)
|
|
||||||
if [ ${macaroonExists} -eq 0 ]; then
|
|
||||||
/home/admin/config.scripts/lnd.unlock.sh
|
|
||||||
sleep 3
|
|
||||||
fi
|
|
||||||
|
|
||||||
# check if macaroon exists now - if not fail
|
|
||||||
macaroonExists=$(sudo -u bitcoin ls -la /home/bitcoin/.lnd/data/chain/${network}/${chain}net/admin.macaroon 2>/dev/null | grep -c admin.macaroon)
|
|
||||||
if [ ${macaroonExists} -eq 0 ]; then
|
|
||||||
sudo -u bitcoin ls -la /home/bitcoin/.lnd/data/chain/${network}/${chain}net/admin.macaroon
|
|
||||||
echo ""
|
|
||||||
echo "FAIL - LND Macaroons not created"
|
|
||||||
echo "Please check the following LND issue:"
|
|
||||||
echo "https://github.com/lightningnetwork/lnd/issues/890"
|
|
||||||
echo "You may want try again with starting ./70initLND.sh"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# copy macaroons to all needed users
|
|
||||||
sudo /home/admin/config.scripts/lnd.credentials.sh sync
|
|
||||||
echo "OK - LND Macaroons created and copied"
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
###### Unlock Wallet (if needed)
|
|
||||||
echo "*** Check Wallet Lock ***"
|
|
||||||
locked=$(sudo tail -n 1 /mnt/hdd/lnd/logs/${network}/${chain}net/lnd.log 2>/dev/null | grep -c unlock)
|
|
||||||
if [ ${locked} -gt 0 ]; then
|
|
||||||
echo "OK - Wallet is locked ... starting unlocking dialog"
|
|
||||||
/home/admin/config.scripts/lnd.unlock.sh
|
|
||||||
else
|
|
||||||
echo "OK - Wallet is already unlocked"
|
|
||||||
fi
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
if [ ${setupStep} -lt 100 ]; then
|
|
||||||
|
|
||||||
# set SetupState (scan is done - so its 80%)
|
|
||||||
sudo sed -i "s/^setupStep=.*/setupStep=80/g" /home/admin/raspiblitz.info
|
|
||||||
|
|
||||||
###### finishSetup
|
|
||||||
sudo /home/admin/90finishSetup.sh
|
|
||||||
sudo /home/admin/95finalSetup.sh
|
|
||||||
|
|
||||||
else
|
|
||||||
|
|
||||||
# its important that RaspiBlitz dont get rebooted
|
|
||||||
# before LND rescan is finished
|
|
||||||
whiptail --title "RESET DONE" --msgbox "
|
|
||||||
OK LND Reset is done.
|
|
||||||
You may now give it
|
|
||||||
extra time to rescan.
|
|
||||||
" 10 25
|
|
||||||
|
|
||||||
fi
|
|
|
@ -1,274 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
source /home/admin/_version.info
|
|
||||||
source /home/admin/raspiblitz.info
|
|
||||||
source /mnt/hdd/raspiblitz.conf
|
|
||||||
|
|
||||||
# all system/service info gets detected by blitz.statusscan.sh
|
|
||||||
source <(sudo /home/admin/config.scripts/blitz.statusscan.sh)
|
|
||||||
source <(sudo /home/admin/config.scripts/internet.sh status)
|
|
||||||
|
|
||||||
# when admin and no other error found run LND setup check
|
|
||||||
if [ "$USER" == "admin" ] && [ ${#lndErrorFull} -eq 0 ]; then
|
|
||||||
lndErrorFull=$(sudo /home/admin/config.scripts/lnd.check.sh basic-setup | grep "err=" | tail -1)
|
|
||||||
fi
|
|
||||||
|
|
||||||
# set follow up info different for LCD and ADMIN
|
|
||||||
adminStr="ssh admin@${localip} ->Password A"
|
|
||||||
if [ "$USER" == "admin" ]; then
|
|
||||||
adminStr="Use CTRL+c to EXIT to Terminal"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# waiting for Internet connection
|
|
||||||
if [ "${state}" = "nointernet" ]; then
|
|
||||||
l1="Waiting for Internet ...\n"
|
|
||||||
l2="Please check infrastructure:\n"
|
|
||||||
l3="Router online? Network connected?\n"
|
|
||||||
dialog --backtitle "RaspiBlitz ${codeVersion} ${localip}" --infobox "$l1$l2$l3" 5 45
|
|
||||||
sleep 3
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# bitcoin errors always first
|
|
||||||
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="May needs restart node when done.\n"
|
|
||||||
l3="Restart from Terminal: restart"
|
|
||||||
dialog --backtitle "RaspiBlitz ${codeVersion} (${state}) ${localIP}" --infobox "$l1$l2$l3" 5 45
|
|
||||||
sleep 3
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
####################
|
|
||||||
# On Bitcoin Error
|
|
||||||
####################
|
|
||||||
|
|
||||||
height=6
|
|
||||||
width=43
|
|
||||||
title="Blockchain Info"
|
|
||||||
|
|
||||||
if [ ${#bitcoinErrorShort} -eq 0 ]; then
|
|
||||||
bitcoinErrorShort="Initial Startup - Please Wait"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$USER" != "admin" ]; then
|
|
||||||
|
|
||||||
if [ ${uptime} -gt 600 ]; then
|
|
||||||
if [ ${uptime} -gt 1000 ] || [ ${#bitcoinErrorFull} -gt 0 ] || [ "${1}" == "blockchain-error" ]; then
|
|
||||||
infoStr=" The ${network}d service is NOT RUNNING!\n ${bitcoinErrorShort}\n Login for more details & options:"
|
|
||||||
else
|
|
||||||
infoStr=" The ${network}d service is running:\n ${bitcoinErrorShort}\n Login with SSH for more details:"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
infoStr=" The ${network}d service is starting:\n ${bitcoinErrorShort}\n Login with SSH for more details:"
|
|
||||||
fi
|
|
||||||
|
|
||||||
else
|
|
||||||
|
|
||||||
# output when user login in as admin and bitcoind is not running
|
|
||||||
if [ ${uptime} -lt 600 ]; then
|
|
||||||
infoStr=" The ${network}d service is starting:\n ${bitcoinErrorShort}\n Please wait at least 10min ..."
|
|
||||||
elif [[ "${bitcoinErrorFull}" == *"error code: -28"* ]]; then
|
|
||||||
infoStr=" The ${network}d service is warming up:\n ${bitcoinErrorShort}\n Please wait ..."
|
|
||||||
elif [ ${#bitcoinErrorFull} -gt 0 ] || [ "${bitcoinErrorShort}" == "Error found in Logs" ] || [ "${1}" == "blockchain-error" ]; then
|
|
||||||
clear
|
|
||||||
echo ""
|
|
||||||
echo "*****************************************"
|
|
||||||
echo "* The ${network}d service is not running."
|
|
||||||
echo "*****************************************"
|
|
||||||
echo "If you just started some config/setup, this might be OK."
|
|
||||||
echo
|
|
||||||
if [ ${startcountBlockchain} -gt 1 ]; then
|
|
||||||
echo "${startcountBlockchain} RESTARTS DETECTED - ${network}d might be in a error loop"
|
|
||||||
cat /home/admin/systemd.blockchain.log | grep "ERROR" | tail -n -1
|
|
||||||
echo
|
|
||||||
fi
|
|
||||||
if [ ${#bitcoinErrorFull} -gt 0 ]; then
|
|
||||||
echo "More Error Detail:"
|
|
||||||
echo ${bitcoinErrorFull}
|
|
||||||
echo
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "POSSIBLE OPTIONS:"
|
|
||||||
source <(/home/admin/config.scripts/network.txindex.sh status)
|
|
||||||
if [ "${txindex}" == "1" ]; then
|
|
||||||
echo "-> Use command 'repair' and then choose 'DELETE-INDEX' to try rebuilding transaction index."
|
|
||||||
fi
|
|
||||||
echo "-> Use command 'repair' and then choose 'RESET-CHAIN' to try downloading new blockchain."
|
|
||||||
echo "-> Use command 'debug' for more log output you can use for getting support."
|
|
||||||
echo "-> Use command 'menu' to open main menu."
|
|
||||||
echo "-> Have you tried to turn it off and on again? Use command 'restart'"
|
|
||||||
echo ""
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
# LND errors second
|
|
||||||
elif [ ${lndActive} -eq 0 ] || [ ${#lndErrorFull} -gt 0 ] || [ "${1}" == "lightning-error" ]; then
|
|
||||||
|
|
||||||
####################
|
|
||||||
# On LND Error
|
|
||||||
####################
|
|
||||||
|
|
||||||
height=6
|
|
||||||
width=43
|
|
||||||
title="Lightning Info"
|
|
||||||
if [ ${uptime} -gt 600 ] || [ "${1}" == "lightning-error" ]; then
|
|
||||||
if [ ${#lndErrorShort} -gt 0 ]; then
|
|
||||||
height=6
|
|
||||||
lndErrorShort=" ${lndErrorShort}\n"
|
|
||||||
fi
|
|
||||||
if [ ${lndActive} -eq 0 ]; then
|
|
||||||
infoStr=" The LND service is not running.\n${lndErrorShort} Login for more details:"
|
|
||||||
else
|
|
||||||
infoStr=" The LND service is running with error.\n${lndErrorShort} Login for more details:"
|
|
||||||
fi
|
|
||||||
if [ "$USER" == "admin" ]; then
|
|
||||||
clear
|
|
||||||
echo ""
|
|
||||||
echo "****************************************"
|
|
||||||
if [ ${lndActive} -eq 0 ]; then
|
|
||||||
echo "* The LND service is not running."
|
|
||||||
else
|
|
||||||
echo "* The LND service is running with error."
|
|
||||||
fi
|
|
||||||
echo "****************************************"
|
|
||||||
echo "If you just started some config/setup, this might be OK."
|
|
||||||
echo
|
|
||||||
if [ ${startcountLightning} -gt 1 ]; then
|
|
||||||
echo "${startcountLightning} RESTARTS DETECTED - LND might be in a error loop"
|
|
||||||
cat /home/admin/systemd.lightning.log | grep "ERROR" | tail -n -1
|
|
||||||
fi
|
|
||||||
sudo journalctl -u lnd -b --no-pager -n14 | grep "lnd\["
|
|
||||||
sudo /home/admin/config.scripts/lnd.check.sh basic-setup | grep "err="
|
|
||||||
if [ ${#lndErrorFull} -gt 0 ]; then
|
|
||||||
echo "More Error Detail:"
|
|
||||||
echo ${lndErrorFull}
|
|
||||||
fi
|
|
||||||
echo
|
|
||||||
echo "-> Use command 'repair' and then choose 'BACKUP-LND' to make a just in case backup."
|
|
||||||
echo "-> Use command 'debug' for more log output you can use for getting support."
|
|
||||||
echo "-> Use command 'menu' to open main menu."
|
|
||||||
echo "-> Have you tried to turn it off and on again? Use command 'restart'"
|
|
||||||
echo ""
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
source <(sudo /home/admin/config.scripts/lnd.check.sh basic-setup)
|
|
||||||
if [ ${wallet} -eq 0 ] || [ ${macaroon} -eq 0 ] || [ ${config} -eq 0 ] || [ ${tls} -eq 0 ]; then
|
|
||||||
infoStr=" The LND service needs RE-SETUP.\n Login with SSH to continue:"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
infoStr=" The LND service is starting.\n Login for more details:"
|
|
||||||
if [ "$USER" == "admin" ]; then
|
|
||||||
infoStr=" The LND service is starting.\n Please wait up to 5min ..."
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# if LND wallet is locked
|
|
||||||
elif [ ${walletLocked} -gt 0 ]; then
|
|
||||||
|
|
||||||
height=5
|
|
||||||
width=43
|
|
||||||
|
|
||||||
if [ "${autoUnlock}" = "on" ]; then
|
|
||||||
title="Auto Unlock"
|
|
||||||
infoStr=" Waiting for Wallet Auto-Unlock.\n Please wait up to 5min ..."
|
|
||||||
else
|
|
||||||
|
|
||||||
if [ "$USER" == "admin" ]; then
|
|
||||||
/home/admin/config.scripts/lnd.unlock.sh
|
|
||||||
else
|
|
||||||
title="Action Required"
|
|
||||||
infoStr=" LND WALLET IS LOCKED !!!\n"
|
|
||||||
if [ "${rtlWebinterface}" = "on" ]; then
|
|
||||||
height=6
|
|
||||||
infoStr="${infoStr} Browser: http://${localip}:3000\n PasswordB=login / PasswordC=unlock"
|
|
||||||
else
|
|
||||||
infoStr="${infoStr} Please use SSH to unlock:"
|
|
||||||
fi
|
|
||||||
if [ ${startcountLightning} -gt 1 ]; then
|
|
||||||
width=45
|
|
||||||
height=$((height+3))
|
|
||||||
infoStr=" LIGHTNING RESTARTED - login for details\n${infoStr}"
|
|
||||||
adminStr="${adminStr}\n or choose 'INFO' in main menu\n or type 'raspiblitz' on terminal"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
else
|
|
||||||
|
|
||||||
####################
|
|
||||||
# Sync Progress
|
|
||||||
####################
|
|
||||||
|
|
||||||
# check number of peers
|
|
||||||
source <(sudo -u admin /home/admin/config.scripts/network.monitor.sh peer-status)
|
|
||||||
|
|
||||||
# basic dialog info
|
|
||||||
height=6
|
|
||||||
width=45
|
|
||||||
title="Node is Syncing"
|
|
||||||
actionString="Please wait - this can take some time"
|
|
||||||
|
|
||||||
# formatting BLOCKCHAIN SYNC PROGRESS
|
|
||||||
if [ ${#syncProgress} -eq 0 ]; then
|
|
||||||
if [ ${startcountBlockchain} -lt 2 ]; then
|
|
||||||
syncProgress="waiting"
|
|
||||||
else
|
|
||||||
syncProgress="${startcountBlockchain} restarts"
|
|
||||||
actionString="Login with SSH for more details:"
|
|
||||||
fi
|
|
||||||
elif [ ${#syncProgress} -lt 6 ]; then
|
|
||||||
syncProgress=" ${syncProgress} % ${peers} peers"
|
|
||||||
else
|
|
||||||
syncProgress="${syncProgress} % ${peers} peers"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# formatting LIGHTNING SCAN PROGRESS
|
|
||||||
if [ ${#scanProgress} -eq 0 ]; then
|
|
||||||
|
|
||||||
# in case of LND RPC is not ready yet
|
|
||||||
if [ ${scanTimestamp} -eq -2 ]; then
|
|
||||||
|
|
||||||
scanProgress="prepare sync"
|
|
||||||
|
|
||||||
# in case LND restarting >2
|
|
||||||
elif [ ${startcountLightning} -gt 2 ]; then
|
|
||||||
|
|
||||||
scanProgress="${startcountLightning} restarts"
|
|
||||||
actionString="Login with SSH for more details:"
|
|
||||||
|
|
||||||
# check if a specific error can be identified for restarts
|
|
||||||
lndSetupErrorCount=$(sudo /home/admin/config.scripts/lnd.check.sh basic-setup | grep -c "err=")
|
|
||||||
if [ ${lndSetupErrorCount} -gt 0 ]; then
|
|
||||||
scanProgress="possible error"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# unkown cases
|
|
||||||
else
|
|
||||||
scanProgress="waiting"
|
|
||||||
fi
|
|
||||||
|
|
||||||
elif [ ${#scanProgress} -lt 6 ]; then
|
|
||||||
scanProgress=" ${scanProgress} % ${lndPeers} peers"
|
|
||||||
else
|
|
||||||
scanProgress="${scanProgress} % ${lndPeers} peers"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# setting info string
|
|
||||||
infoStr=" Blockchain Progress : ${syncProgress}\n Lightning Progress : ${scanProgress}\n ${actionString}"
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
# display info to user
|
|
||||||
dialog --title " ${title} " --backtitle "RaspiBlitz ${codeVersion} ${hostname} / ${network} / ${chain} / ${tempCelsius}°C" --infobox "${infoStr}\n ${adminStr}" ${height} ${width}
|
|
|
@ -1,65 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
# add bonus scripts (auto install deactivated to reduce third party repos)
|
|
||||||
/home/admin/91addBonus.sh
|
|
||||||
|
|
||||||
###### SWAP File
|
|
||||||
source <(sudo /home/admin/config.scripts/blitz.datadrive.sh status)
|
|
||||||
if [ ${isSwapExternal} -eq 0 ]; then
|
|
||||||
|
|
||||||
echo "No external SWAP found - creating ... "
|
|
||||||
sudo /home/admin/config.scripts/blitz.datadrive.sh swap on
|
|
||||||
|
|
||||||
else
|
|
||||||
echo "SWAP already OK"
|
|
||||||
fi
|
|
||||||
|
|
||||||
####### FIREWALL - just install (not configure)
|
|
||||||
echo ""
|
|
||||||
echo "*** Setting and Activating Firewall ***"
|
|
||||||
echo "deny incoming connection on other ports"
|
|
||||||
sudo ufw default deny incoming
|
|
||||||
echo "allow outgoing connections"
|
|
||||||
sudo ufw default allow outgoing
|
|
||||||
echo "allow: ssh"
|
|
||||||
sudo ufw allow ssh
|
|
||||||
echo "allow: bitcoin testnet"
|
|
||||||
sudo ufw allow 18333 comment 'bitcoin testnet'
|
|
||||||
echo "allow: bitcoin mainnet"
|
|
||||||
sudo ufw allow 8333 comment 'bitcoin mainnet'
|
|
||||||
echo "allow: litecoin mainnet"
|
|
||||||
sudo ufw allow 9333 comment 'litecoin mainnet'
|
|
||||||
echo 'allow: lightning testnet'
|
|
||||||
sudo ufw allow 19735 comment 'lightning testnet'
|
|
||||||
echo "allow: lightning mainnet"
|
|
||||||
sudo ufw allow 9735 comment 'lightning mainnet'
|
|
||||||
echo "allow: lightning gRPC"
|
|
||||||
sudo ufw allow 10009 comment 'lightning gRPC'
|
|
||||||
echo "allow: lightning REST API"
|
|
||||||
sudo ufw allow 8080 comment 'lightning REST API'
|
|
||||||
echo "allow: transmission"
|
|
||||||
sudo ufw allow 49200:49250/tcp comment 'rtorrent'
|
|
||||||
echo "allow: public web HTTP"
|
|
||||||
sudo ufw allow from any to any port 80 comment 'allow public web HTTP'
|
|
||||||
echo "allow: local web admin HTTPS"
|
|
||||||
sudo ufw allow from 10.0.0.0/8 to any port 443 comment 'allow local LAN HTTPS'
|
|
||||||
sudo ufw allow from 172.16.0.0/12 to any port 443 comment 'allow local LAN HTTPS'
|
|
||||||
sudo ufw allow from 192.168.0.0/16 to any port 443 comment 'allow local LAN HTTPS'
|
|
||||||
echo "open firewall for auto nat discover (see issue #129)"
|
|
||||||
sudo ufw allow proto udp from 10.0.0.0/8 port 1900 to any comment 'allow local LAN SSDP for UPnP discovery'
|
|
||||||
sudo ufw allow proto udp from 172.16.0.0/12 port 1900 to any comment 'allow local LAN SSDP for UPnP discovery'
|
|
||||||
sudo ufw allow proto udp from 192.168.0.0/16 port 1900 to any comment 'allow local LAN SSDP for UPnP discovery'
|
|
||||||
echo "enable lazy firewall"
|
|
||||||
sudo ufw --force enable
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
# update system
|
|
||||||
echo ""
|
|
||||||
echo "*** Update System ***"
|
|
||||||
sudo apt-mark hold raspberrypi-bootloader
|
|
||||||
sudo apt-get update -y
|
|
||||||
echo "OK - System is now up to date"
|
|
||||||
|
|
||||||
# mark setup is done
|
|
||||||
sudo sed -i "s/^setupStep=.*/setupStep=100/g" /home/admin/raspiblitz.info
|
|
|
@ -1,12 +0,0 @@
|
||||||
|
|
||||||
mkdir /home/admin/tmpScriptDL
|
|
||||||
cd /home/admin/tmpScriptDL
|
|
||||||
echo "installing bash completion for bitcoin-cli and lncli"
|
|
||||||
wget https://raw.githubusercontent.com/bitcoin/bitcoin/master/contrib/bitcoin-cli.bash-completion
|
|
||||||
wget https://raw.githubusercontent.com/lightningnetwork/lnd/master/contrib/lncli.bash-completion
|
|
||||||
sudo cp *.bash-completion /etc/bash_completion.d/
|
|
||||||
echo "OK - bash completion available after next login"
|
|
||||||
echo "type \"bitcoin-cli getblockch\", press [Tab] → bitcoin-cli getblockchaininfo"
|
|
||||||
rm -r /home/admin/tmpScriptDL
|
|
||||||
|
|
||||||
cd
|
|
|
@ -1,50 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
# load setup config
|
|
||||||
source /home/admin/raspiblitz.info
|
|
||||||
|
|
||||||
# in case the config already exists
|
|
||||||
source /mnt/hdd/raspiblitz.conf 2>/dev/null
|
|
||||||
|
|
||||||
# load version
|
|
||||||
source /home/admin/_version.info
|
|
||||||
|
|
||||||
# show info to user
|
|
||||||
sudo sed -i "s/^state=.*/state=reboot/g" /home/admin/raspiblitz.info
|
|
||||||
dialog --backtitle "RaspiBlitz - Setup" --title " RaspiBlitz Setup is done :) " --msgbox "
|
|
||||||
After reboot RaspiBlitz
|
|
||||||
needs to be unlocked and
|
|
||||||
sync with the network.
|
|
||||||
|
|
||||||
Press OK for a final reboot.
|
|
||||||
" 10 42
|
|
||||||
|
|
||||||
# let migration/init script do the rest
|
|
||||||
/home/admin/_bootstrap.migration.sh
|
|
||||||
|
|
||||||
# copy logfile to analyse setup
|
|
||||||
cp $logFile /home/admin/raspiblitz.setup.log
|
|
||||||
|
|
||||||
# set the name of the node
|
|
||||||
echo "Setting the Name/Alias/Hostname .."
|
|
||||||
sudo /home/admin/config.scripts/lnd.setname.sh ${hostname}
|
|
||||||
|
|
||||||
# expanding the root of the sd card
|
|
||||||
if [ "${baseimage}" = "raspbian" ] || [ "${baseimage}" = "raspios_arm64" ]; then
|
|
||||||
sudo raspi-config --expand-rootfs
|
|
||||||
sudo sed -i "s/^fsexpanded=.*/fsexpanded=1/g" /home/admin/raspiblitz.info
|
|
||||||
elif [ "${baseimage}" = "armbian" ]; then
|
|
||||||
sudo /usr/lib/armbian/armbian-resize-filesystem start
|
|
||||||
sudo sed -i "s/^fsexpanded=.*/fsexpanded=1/g" /home/admin/raspiblitz.info
|
|
||||||
fi
|
|
||||||
|
|
||||||
# mark setup is done
|
|
||||||
sudo sed -i "s/^setupStep=.*/setupStep=100/g" /home/admin/raspiblitz.info
|
|
||||||
|
|
||||||
clear
|
|
||||||
echo "Setup done. Rebooting now."
|
|
||||||
sudo -u bitcoin ${network}-cli stop
|
|
||||||
|
|
||||||
sleep 3
|
|
||||||
sudo /home/admin/XXshutdown.sh reboot
|
|
|
@ -4,9 +4,19 @@
|
||||||
source /home/admin/raspiblitz.info
|
source /home/admin/raspiblitz.info
|
||||||
source /mnt/hdd/raspiblitz.conf
|
source /mnt/hdd/raspiblitz.conf
|
||||||
|
|
||||||
|
if [ "$1" = "-h" ] || [ "$1" = "-help" ];then
|
||||||
|
echo "Usage:"
|
||||||
|
echo "97addMobileWallet.sh <lnd|cl> <mainnet|testnet|signet>"
|
||||||
|
echo "defaults from the configs are:"
|
||||||
|
echo "ligthning=${lightning}"
|
||||||
|
echo "chain=${chain}"
|
||||||
|
fi
|
||||||
|
|
||||||
justLocal=1
|
justLocal=1
|
||||||
aks4IP2TOR=0
|
aks4IP2TOR=0
|
||||||
|
|
||||||
|
source <(/home/admin/config.scripts/network.aliases.sh getvars $1 $2)
|
||||||
|
|
||||||
# if TOR is activated then outside reach is possible (no notice)
|
# if TOR is activated then outside reach is possible (no notice)
|
||||||
if [ "${runBehindTor}" = "on" ]; then
|
if [ "${runBehindTor}" = "on" ]; then
|
||||||
echo "# runBehindTor ON"
|
echo "# runBehindTor ON"
|
||||||
|
@ -131,23 +141,30 @@ checkIP2TOR()
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Also Zap-Android deactivated for now - see: https://github.com/rootzoll/raspiblitz/issues/2198#issuecomment-822808428
|
OPTIONS=()
|
||||||
#OPTIONS=(ZAP_ANDROID "Zap Wallet (Android)" \
|
|
||||||
# ZAP_IOS "Zap Wallet (iOS)" \
|
|
||||||
OPTIONS=(ZEUS_IOS "Zeus Wallet (iOS)" \
|
|
||||||
ZEUS_ANDROID "Zeus Wallet (Android)" \
|
|
||||||
SPHINX "Sphinx Chat (Android or iOS)"
|
|
||||||
)
|
|
||||||
|
|
||||||
# add SEND MANY APP
|
if [ "${lightning}" == "lnd" ] || [ "${lnd}" == "on" ]; then
|
||||||
OPTIONS+=(SENDMANY_ANDROID "SendMany (Android)")
|
# Zap deactivated for now - see: https://github.com/rootzoll/raspiblitz/issues/2198#issuecomment-822808428
|
||||||
|
OPTIONS+=(ZEUS_IOS "Zeus to LND (iOS)")
|
||||||
# Additional Options with TOR
|
OPTIONS+=(ZEUS_ANDROID "Zeus to LND (Android)")
|
||||||
if [ "${runBehindTor}" = "on" ]; then
|
OPTIONS+=(SPHINX "Sphinx Chat to LND (Android/iOS)")
|
||||||
OPTIONS+=(FULLY_NODED "Fully Noded (IOS+TOR)")
|
OPTIONS+=(SENDMANY_ANDROID "SendMany to LND (Android)")
|
||||||
|
OPTIONS+=(FULLYNODED_LND "Fully Noded to LND REST (iOS+Tor)")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
CHOICE=$(whiptail --clear --title "Choose Mobile Wallet" --menu "" 14 50 8 "${OPTIONS[@]}" 2>&1 >/dev/tty)
|
if [ "${lightning}" == "cl" ] || [ "${cl}" == "on" ]; then
|
||||||
|
OPTIONS+=(ZEUS_CLREST "Zeus to C-lightningREST (Android or iOS)")
|
||||||
|
OPTIONS+=(ZEUS_SPARK "Zeus to Sparko (Android or iOS)")
|
||||||
|
OPTIONS+=(SPARK "Spark Wallet to Sparko (Android - EXPERIMENTAL)" )
|
||||||
|
OPTIONS+=(FULLYNODED_CL "Fully Noded to CL REST (iOS+Tor)")
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Additional Options with Tor
|
||||||
|
if [ "${runBehindTor}" = "on" ]; then
|
||||||
|
OPTIONS+=(FULLYNODED_BTC "Fully Noded to bitcoinRPC (iOS+Tor)")
|
||||||
|
fi
|
||||||
|
|
||||||
|
CHOICE=$(whiptail --clear --title "Choose Mobile Wallet" --menu "" 16 75 10 "${OPTIONS[@]}" 2>&1 >/dev/tty)
|
||||||
|
|
||||||
/home/admin/config.scripts/blitz.display.sh hide
|
/home/admin/config.scripts/blitz.display.sh hide
|
||||||
|
|
||||||
|
@ -155,7 +172,7 @@ clear
|
||||||
echo "creating install info ..."
|
echo "creating install info ..."
|
||||||
case $CHOICE in
|
case $CHOICE in
|
||||||
CLOSE)
|
CLOSE)
|
||||||
exit 1;
|
exit 0;
|
||||||
;;
|
;;
|
||||||
SPHINX)
|
SPHINX)
|
||||||
if [ "${sphinxrelay}" != "on" ]; then
|
if [ "${sphinxrelay}" != "on" ]; then
|
||||||
|
@ -173,16 +190,16 @@ case $CHOICE in
|
||||||
fi
|
fi
|
||||||
# make pairing thru sphinx relay script
|
# make pairing thru sphinx relay script
|
||||||
/home/admin/config.scripts/bonus.sphinxrelay.sh menu
|
/home/admin/config.scripts/bonus.sphinxrelay.sh menu
|
||||||
exit 1;
|
exit 0;
|
||||||
;;
|
;;
|
||||||
ZAP_IOS)
|
ZAP_IOS)
|
||||||
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.display.sh qr ${appstoreLink}
|
#/home/admin/config.scripts/blitz.display.sh qr ${appstoreLink}
|
||||||
#whiptail --title "Install Testflight and Zap on your iOS device" \
|
#whiptail --title "Install Testflight and Zap on your iOS device" \
|
||||||
# --yes-button "continue" \
|
# --yes-button "continue" \
|
||||||
# --no-button "link as QR code" \
|
# --no-button "link as QR code" \
|
||||||
# --yesno "Search for 'Zap Bitcoin' in Apple Appstore for basic version\nOr join public beta test for latest features:\n${appstoreLink}\n\nJoin testing and follow ALL instructions.\n\nWhen installed and started -> continue" 11 65
|
# --yesno "Search for 'Zap Bitcoin' in Apple Appstore for basic version\nOr join public beta test for latest features:\n${appstoreLink}\n\nJoin testing and follow ALL instructions.\n\nWhen installed and started -> continue" 11 65
|
||||||
# if [ $? -eq 1 ]; then
|
# if [ $? -eq 1 ]; then
|
||||||
# /home/admin/config.scripts/blitz.display.sh qr-console ${appstoreLink}
|
# /home/admin/config.scripts/blitz.display.sh qr-console ${appstoreLink}
|
||||||
#fi
|
#fi
|
||||||
|
|
||||||
|
@ -206,7 +223,7 @@ Or scan the qr code on the LCD with your mobile phone.
|
||||||
choose_IP_or_TOR
|
choose_IP_or_TOR
|
||||||
fi
|
fi
|
||||||
/home/admin/config.scripts/bonus.lndconnect.sh zap-ios ${connect}
|
/home/admin/config.scripts/bonus.lndconnect.sh zap-ios ${connect}
|
||||||
exit 1;
|
exit 0;
|
||||||
;;
|
;;
|
||||||
ZAP_ANDROID)
|
ZAP_ANDROID)
|
||||||
appstoreLink="https://play.google.com/store/apps/details?id=zapsolutions.zap"
|
appstoreLink="https://play.google.com/store/apps/details?id=zapsolutions.zap"
|
||||||
|
@ -229,7 +246,7 @@ Or scan the qr code on the LCD with your mobile phone.
|
||||||
choose_IP_or_TOR
|
choose_IP_or_TOR
|
||||||
fi
|
fi
|
||||||
/home/admin/config.scripts/bonus.lndconnect.sh zap-android ${connect}
|
/home/admin/config.scripts/bonus.lndconnect.sh zap-android ${connect}
|
||||||
exit 1;
|
exit 0;
|
||||||
;;
|
;;
|
||||||
SENDMANY_ANDROID)
|
SENDMANY_ANDROID)
|
||||||
|
|
||||||
|
@ -241,7 +258,7 @@ To use the chat feature of the SendMany app, you need to activate the Keysend fe
|
||||||
|
|
||||||
Please go to MAINMENU > SERVICES and activate KEYSEND first.
|
Please go to MAINMENU > SERVICES and activate KEYSEND first.
|
||||||
" 12 65
|
" 12 65
|
||||||
exit 1
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
appstoreLink="https://github.com/fusion44/sendmany/releases"
|
appstoreLink="https://github.com/fusion44/sendmany/releases"
|
||||||
|
@ -256,22 +273,22 @@ Please go to MAINMENU > SERVICES and activate KEYSEND first.
|
||||||
/home/admin/config.scripts/blitz.display.sh hide
|
/home/admin/config.scripts/blitz.display.sh hide
|
||||||
checkIP2TOR LND-GRPC-API
|
checkIP2TOR LND-GRPC-API
|
||||||
/home/admin/config.scripts/bonus.lndconnect.sh sendmany-android ${connect}
|
/home/admin/config.scripts/bonus.lndconnect.sh sendmany-android ${connect}
|
||||||
exit 1;
|
exit 0;
|
||||||
;;
|
;;
|
||||||
ZEUS_IOS)
|
ZEUS_IOS)
|
||||||
appstoreLink="https://testflight.apple.com/join/gpVFzEHN"
|
appstoreLink="https://apps.apple.com/us/app/zeus-ln/id1456038895"
|
||||||
/home/admin/config.scripts/blitz.display.sh image /home/admin/raspiblitz/pictures/app_zeus.png
|
/home/admin/config.scripts/blitz.display.sh image /home/admin/raspiblitz/pictures/app_zeus.png
|
||||||
whiptail --title "Install Testflight and Zeus on your iOS device" \
|
whiptail --title "Install Zeus on your iOS device" \
|
||||||
--yes-button "Continue" \
|
--yes-button "Continue" \
|
||||||
--no-button "Link as QR Code" \
|
--no-button "Link as QRcode" \
|
||||||
--yesno "At the moment this app is in public beta testing.\nFirst open Apple Apstore, search & install 'TestFlight' app.\n\nThen open the following link on your mobile:\n${appstoreLink}\n\nUse 'Open In TestFlight' option of your mobile browser.\nWhen Zeus is installed and started --> Continue." 14 65
|
--yesno "Open the Apple App Store on your mobile phone.\n\nSearch for --> 'zeus ln'\n\nCheck that logo is like on LCD and author is: Zeus LN LLC\nWhen the app is installed and started --> Continue." 12 65
|
||||||
if [ $? -eq 1 ]; then
|
if [ $? -eq 1 ]; then
|
||||||
/home/admin/config.scripts/blitz.display.sh qr ${appstoreLink}
|
/home/admin/config.scripts/blitz.display.sh qr ${appstoreLink}
|
||||||
/home/admin/config.scripts/blitz.display.sh qr-console ${appstoreLink}
|
/home/admin/config.scripts/blitz.display.sh qr-console ${appstoreLink}
|
||||||
fi
|
fi
|
||||||
/home/admin/config.scripts/blitz.display.sh hide
|
/home/admin/config.scripts/blitz.display.sh hide
|
||||||
/home/admin/config.scripts/bonus.lndconnect.sh zeus-ios tor
|
/home/admin/config.scripts/bonus.lndconnect.sh zeus-ios tor
|
||||||
exit 1;
|
exit 0;
|
||||||
;;
|
;;
|
||||||
ZEUS_ANDROID)
|
ZEUS_ANDROID)
|
||||||
appstoreLink="https://play.google.com/store/apps/details?id=app.zeusln.zeus"
|
appstoreLink="https://play.google.com/store/apps/details?id=app.zeusln.zeus"
|
||||||
|
@ -279,7 +296,7 @@ Please go to MAINMENU > SERVICES and activate KEYSEND first.
|
||||||
whiptail --title "Install Zeus on your Android Phone" \
|
whiptail --title "Install Zeus on your Android Phone" \
|
||||||
--yes-button "Continue" \
|
--yes-button "Continue" \
|
||||||
--no-button "StoreLink" \
|
--no-button "StoreLink" \
|
||||||
--yesno "Open the Android Play Store on your mobile phone.\n\nSearch for --> 'zeus bitcoin app'\n\nCheck that logo is like on LCD and author is: Evan Kaloudis\nWhen app is installed and started --> Continue." 12 65
|
--yesno "Open the Android Play Store on your mobile phone.\n\nSearch for --> 'zeus ln'\n\nCheck that logo is like on LCD and author is: Evan Kaloudis\nWhen app is installed and started --> Continue." 12 65
|
||||||
if [ $? -eq 1 ]; then
|
if [ $? -eq 1 ]; then
|
||||||
/home/admin/config.scripts/blitz.display.sh qr ${appstoreLink}
|
/home/admin/config.scripts/blitz.display.sh qr ${appstoreLink}
|
||||||
whiptail --title " App Store Link " --msgbox "\
|
whiptail --title " App Store Link " --msgbox "\
|
||||||
|
@ -290,9 +307,10 @@ Or scan the qr code on the LCD with your mobile phone.
|
||||||
fi
|
fi
|
||||||
/home/admin/config.scripts/blitz.display.sh hide
|
/home/admin/config.scripts/blitz.display.sh hide
|
||||||
/home/admin/config.scripts/bonus.lndconnect.sh zeus-android tor
|
/home/admin/config.scripts/bonus.lndconnect.sh zeus-android tor
|
||||||
exit 1;
|
exit 0;
|
||||||
;;
|
;;
|
||||||
FULLY_NODED)
|
|
||||||
|
FULLYNODED_BTC)
|
||||||
appstoreLink="https://apps.apple.com/us/app/fully-noded/id1436425586"
|
appstoreLink="https://apps.apple.com/us/app/fully-noded/id1436425586"
|
||||||
/home/admin/config.scripts/blitz.display.sh image /home/admin/raspiblitz/pictures/app_fullynoded.png
|
/home/admin/config.scripts/blitz.display.sh image /home/admin/raspiblitz/pictures/app_fullynoded.png
|
||||||
whiptail --title "Install Fully Noded on your iOS device" \
|
whiptail --title "Install Fully Noded on your iOS device" \
|
||||||
|
@ -309,6 +327,96 @@ Or scan the qr code on the LCD with your mobile phone.
|
||||||
fi
|
fi
|
||||||
/home/admin/config.scripts/blitz.display.sh hide
|
/home/admin/config.scripts/blitz.display.sh hide
|
||||||
/home/admin/config.scripts/bonus.fullynoded.sh
|
/home/admin/config.scripts/bonus.fullynoded.sh
|
||||||
exit 1;
|
exit 0;
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
FULLYNODED_LND)
|
||||||
|
appstoreLink="https://apps.apple.com/us/app/fully-noded/id1436425586"
|
||||||
|
/home/admin/config.scripts/blitz.display.sh image /home/admin/raspiblitz/pictures/app_fullynoded.png
|
||||||
|
whiptail --title "Install Fully Noded on your iOS device" \
|
||||||
|
--yes-button "Continue" \
|
||||||
|
--no-button "StoreLink" \
|
||||||
|
--yesno "Open the Apple App Store on your mobile phone.\n\nSearch for --> 'fully noded'\n\nCheck that logo is like on LCD and author is: Denton LLC\nWhen app is installed and started --> Continue." 12 65
|
||||||
|
if [ $? -eq 1 ]; then
|
||||||
|
/home/admin/config.scripts/blitz.display.sh qr ${appstoreLink}
|
||||||
|
whiptail --title " App Store Link " --msgbox "\
|
||||||
|
To install app open the following link:\n
|
||||||
|
${appstoreLink}\n
|
||||||
|
Or scan the qr code on the LCD with your mobile phone.
|
||||||
|
" 11 70
|
||||||
|
fi
|
||||||
|
/home/admin/config.scripts/blitz.display.sh hide
|
||||||
|
/home/admin/config.scripts/bonus.lndconnect.sh fullynoded-lnd tor
|
||||||
|
exit 0;
|
||||||
|
;;
|
||||||
|
|
||||||
|
FULLYNODED_CL)
|
||||||
|
if [ ! -L /home/bitcoin/cl-plugins-enabled/c-lightning-http-plugin ];then
|
||||||
|
/home/admin/config.scripts/cl-plugin.http.sh on
|
||||||
|
fi
|
||||||
|
appstoreLink="https://apps.apple.com/us/app/fully-noded/id1436425586"
|
||||||
|
/home/admin/config.scripts/blitz.display.sh image /home/admin/raspiblitz/pictures/app_fullynoded.png
|
||||||
|
whiptail --title "Install Fully Noded on your iOS device" \
|
||||||
|
--yes-button "Continue" \
|
||||||
|
--no-button "StoreLink" \
|
||||||
|
--yesno "Open the Apple App Store on your mobile phone.\n\nSearch for --> 'fully noded'\n\nCheck that logo is like on LCD and author is: Denton LLC\nWhen app is installed and started --> Continue." 12 65
|
||||||
|
if [ $? -eq 1 ]; then
|
||||||
|
/home/admin/config.scripts/blitz.display.sh qr ${appstoreLink}
|
||||||
|
whiptail --title " App Store Link " --msgbox "\
|
||||||
|
To install app open the following link:\n
|
||||||
|
${appstoreLink}\n
|
||||||
|
Or scan the qr code on the LCD with your mobile phone.
|
||||||
|
" 11 70
|
||||||
|
fi
|
||||||
|
/home/admin/config.scripts/blitz.display.sh hide
|
||||||
|
/home/admin/config.scripts/cl-plugin.http.sh connect
|
||||||
|
exit 0;
|
||||||
|
;;
|
||||||
|
|
||||||
|
ZEUS_CLREST)
|
||||||
|
/home/admin/config.scripts/blitz.display.sh image /home/admin/raspiblitz/pictures/app_zeus.png
|
||||||
|
whiptail --title "Install Zeus on your Android or iOS Phone" \
|
||||||
|
--yes-button "Continue" \
|
||||||
|
--no-button "Cancel" \
|
||||||
|
--yesno "Open the https://zeusln.app/ on your mobile phone to find the App Store link or binary for your phone.\n\nWhen the app is installed and started --> Continue." 12 65
|
||||||
|
if [ $? -eq 1 ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
/home/admin/config.scripts/blitz.display.sh hide
|
||||||
|
/home/admin/config.scripts/cl.rest.sh connect
|
||||||
|
exit 0;
|
||||||
|
;;
|
||||||
|
ZEUS_SPARK)
|
||||||
|
/home/admin/config.scripts/blitz.display.sh image /home/admin/raspiblitz/pictures/app_zeus.png
|
||||||
|
whiptail --title "Install Zeus on your Android or iOS Phone" \
|
||||||
|
--yes-button "Continue" \
|
||||||
|
--no-button "Cancel" \
|
||||||
|
--yesno "Open the https://zeusln.app/ on your mobile phone to find the App Store link or binary for your phone.\n\nWhen the app is installed and started --> Continue." 12 65
|
||||||
|
if [ $? -eq 1 ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
/home/admin/config.scripts/blitz.display.sh hide
|
||||||
|
/home/admin/config.scripts/cl-plugin.sparko.sh connect
|
||||||
|
exit 0;
|
||||||
|
;;
|
||||||
|
SPARK)
|
||||||
|
appstoreLink="https://github.com/shesek/spark-wallet#mobile-app"
|
||||||
|
/home/admin/config.scripts/blitz.display.sh image /home/admin/raspiblitz/pictures/app_zeus.png
|
||||||
|
whiptail --title "Install Zeus on your Android Phone" \
|
||||||
|
--yes-button "Continue" \
|
||||||
|
--no-button "GitHub link" \
|
||||||
|
--yesno "Open the ${appstoreLink} on Android to find the App Store link or binary for your phone.\n\nWhen the app is installed and started --> Continue." 12 65
|
||||||
|
if [ $? -eq 1 ]; then
|
||||||
|
/home/admin/config.scripts/blitz.display.sh qr ${appstoreLink}
|
||||||
|
whiptail --title " GitHub link " --msgbox "\
|
||||||
|
To install app open the following link:\n
|
||||||
|
${appstoreLink}\n
|
||||||
|
Or scan the QR code on the LCD with your mobile phone.
|
||||||
|
" 11 70
|
||||||
|
fi
|
||||||
|
/home/admin/config.scripts/blitz.display.sh hide
|
||||||
|
/home/admin/config.scripts/cl-plugin.sparko.sh connect
|
||||||
|
exit 0;
|
||||||
|
;;
|
||||||
|
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -26,14 +26,14 @@ elif [ "${CHOICE}" = "RESYNC" ]; then
|
||||||
dialog --pause "OK. System will reboot to activate changes." 8 58 8
|
dialog --pause "OK. System will reboot to activate changes." 8 58 8
|
||||||
clear
|
clear
|
||||||
echo "rebooting .. (please wait)"
|
echo "rebooting .. (please wait)"
|
||||||
sudo /home/admin/XXshutdown.sh reboot
|
sudo /home/admin/config.scripts/blitz.shutdown.sh reboot
|
||||||
|
|
||||||
elif [ "${CHOICE}" = "REINDEX" ]; then
|
elif [ "${CHOICE}" = "REINDEX" ]; then
|
||||||
echo "Starting REINDEX ..."
|
echo "Starting REINDEX ..."
|
||||||
sudo /home/admin/config.scripts/network.reindex.sh
|
sudo /home/admin/config.scripts/network.reindex.sh
|
||||||
|
|
||||||
elif [ "${CHOICE}" = "BACKUP" ]; then
|
elif [ "${CHOICE}" = "BACKUP" ]; then
|
||||||
sudo /home/admin/config.scripts/lnd.rescue.sh backup
|
sudo /home/admin/config.scripts/lnd.backup.sh lnd-export-gui
|
||||||
echo "PRESS ENTER to continue."
|
echo "PRESS ENTER to continue."
|
||||||
read key
|
read key
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ Download LND Data Backup now?
|
||||||
echo "*************************************"
|
echo "*************************************"
|
||||||
echo "please wait .."
|
echo "please wait .."
|
||||||
sleep 2
|
sleep 2
|
||||||
/home/admin/config.scripts/lnd.rescue.sh backup
|
/home/admin/config.scripts/lnd.backup.sh lnd-export-gui
|
||||||
echo
|
echo
|
||||||
echo "PRESS ENTER to continue once you are done downloading."
|
echo "PRESS ENTER to continue once you are done downloading."
|
||||||
read key
|
read key
|
||||||
|
@ -31,7 +31,7 @@ Download LND Data Backup now?
|
||||||
echo "*************************************"
|
echo "*************************************"
|
||||||
echo "please wait .."
|
echo "please wait .."
|
||||||
sleep 2
|
sleep 2
|
||||||
/home/admin/config.scripts/lnd.rescue.sh backup no-download
|
/home/admin/config.scripts/lnd.backup.sh lnd-export
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,136 +46,23 @@ RaspiBlitz image to your SD card.
|
||||||
" 12 40
|
" 12 40
|
||||||
}
|
}
|
||||||
|
|
||||||
copyHost()
|
OPTIONS=()
|
||||||
{
|
#OPTIONS+=(HARDWARE "Run Hardwaretest")
|
||||||
clear
|
OPTIONS+=(SOFTWARE "Run Softwaretest (DebugReport)")
|
||||||
echo
|
if [ "${lightning}" == "lnd" ] || [ "${lnd}" == "on" ]; then
|
||||||
echo "# *** Copy Blockchain Source Modus ***"
|
OPTIONS+=(BACKUP-LND "Backup your LND data (Rescue-File)")
|
||||||
|
OPTIONS+=(RESET-LND "Delete LND & start new node/wallet")
|
||||||
echo "# get IP of RaspiBlitz to copy to ..."
|
|
||||||
targetIP=$(whiptail --inputbox "\nPlease enter the LOCAL IP of the\nRaspiBlitz to copy Blockchain to:" 10 38 "" --title " Target IP " --backtitle "RaspiBlitz - Copy Blockchain" 3>&1 1>&2 2>&3)
|
|
||||||
targetIP=$(echo "${targetIP[0]}")
|
|
||||||
localIP=$(ip addr | grep 'state UP' -A2 | egrep -v 'docker0|veth' | grep 'eth0\|wlan0\|enp0' | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
|
|
||||||
if [ ${#targetIP} -eq 0 ]; then
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
if [ "${localIP}" == "${targetIP}" ]; then
|
|
||||||
whiptail --msgbox "Dont type in the local IP of this RaspiBlitz,\nthe LOCAL IP of the other RaspiBlitz is needed." 8 54 "" --title " Testing Target IP " --backtitle "RaspiBlitz - Copy Blockchain"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
canPingIP=$(ping ${targetIP} -c 1 | grep -c "1 received")
|
|
||||||
if [ ${canPingIP} -eq 0 ]; then
|
|
||||||
whiptail --msgbox "Was not able to contact/ping: ${targetIP}\n\n- check if IP of target RaspiBlitz is correct.\n- check to be on the same local network.\n- try again ..." 11 58 "" --title " Testing Target IP " --backtitle "RaspiBlitz - Copy Blockchain"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "# get Password of RaspiBlitz to copy to ..."
|
|
||||||
targetPassword=$(whiptail --passwordbox "\nPlease enter the PASSWORD A of the\nRaspiBlitz to copy Blockchain to:" 10 38 "" --title "Target Password" --backtitle "RaspiBlitz - Copy Blockchain" 3>&1 1>&2 2>&3)
|
|
||||||
if [ ${#targetPassword} -eq 0 ]; then
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
sudo rm /root/.ssh/known_hosts 2>/dev/null
|
|
||||||
canLogin=$(sudo sshpass -p "${targetPassword}" ssh -t -o StrictHostKeyChecking=no bitcoin@${targetIP} "echo 'working'" 2>/dev/null | grep -c 'working')
|
|
||||||
if [ ${canLogin} -eq 0 ]; then
|
|
||||||
whiptail --msgbox "Password was not working for IP: ${targetIP}\n\n- check thats the correct IP for correct RaspiBlitz\n- check that you used PASSWORD A and had no typo\n- If you tried too often, wait 1h try again" 11 58 "" --title " Testing Target Password " --backtitle "RaspiBlitz - Copy Blockchain"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "# stopping services ..."
|
|
||||||
sudo systemctl stop background
|
|
||||||
sudo systemctl stop lnd
|
|
||||||
sudo systemctl stop ${network}d
|
|
||||||
sudo systemctl disable ${network}d
|
|
||||||
sleep 5
|
|
||||||
sudo systemctl stop bitcoind 2>/dev/null
|
|
||||||
|
|
||||||
clear
|
|
||||||
echo
|
|
||||||
echo "# Starting copy over LAN (around 4-6 hours) ..."
|
|
||||||
sed -i "s/^state=.*/state=copysource/g" /home/admin/raspiblitz.info
|
|
||||||
cd /mnt/hdd/${network}
|
|
||||||
|
|
||||||
# transfer beginning flag
|
|
||||||
date +%s > /home/admin/copy_begin.time
|
|
||||||
sudo sshpass -p "${targetPassword}" rsync -avhW -e 'ssh -o StrictHostKeyChecking=no -p 22' /home/admin/copy_begin.time bitcoin@${targetIP}:/mnt/hdd/bitcoin
|
|
||||||
sudo rm -f /home/admin/copy_begin.time
|
|
||||||
|
|
||||||
# repeat the syncing of directories until
|
|
||||||
# a) there are no files left to transfer (be robust against failing connections, etc)
|
|
||||||
# b) the user hits a key to break loop after report
|
|
||||||
|
|
||||||
|
|
||||||
while :
|
|
||||||
do
|
|
||||||
|
|
||||||
# transfer blockchain data
|
|
||||||
rm -f ./transferred.rsync
|
|
||||||
sudo sshpass -p "${targetPassword}" rsync -avhW -e 'ssh -o StrictHostKeyChecking=no -p 22' --info=progress2 --log-file=./transferred.rsync ./chainstate ./blocks bitcoin@${targetIP}:/mnt/hdd/bitcoin
|
|
||||||
|
|
||||||
# check result
|
|
||||||
# the idea is even after successful transfer the loop will run a second time
|
|
||||||
# but on the second time there will be no files transferred (log lines are below 4)
|
|
||||||
# thats the signal that its done
|
|
||||||
linesInLogFile=$(wc -l ./transferred.rsync | cut -d " " -f 1)
|
|
||||||
if [ ${linesInLogFile} -lt 4 ]; then
|
|
||||||
echo ""
|
|
||||||
echo "OK all files transferred. DONE"
|
|
||||||
sleep 2
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
|
|
||||||
# wait 20 seconds for user exiting loop
|
|
||||||
echo ""
|
|
||||||
echo -en "OK on sync loop done ... will test in another if all was transferred."
|
|
||||||
echo -en "PRESS X TO MANUALLY FINISH SYNCING"
|
|
||||||
read -n 1 -t 6 keyPressed
|
|
||||||
if [ "${keyPressed}" = "x" ]; then
|
|
||||||
echo ""
|
|
||||||
echo "Ending Sync ..."
|
|
||||||
sleep 2
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
|
|
||||||
done
|
|
||||||
|
|
||||||
# transfer end flag
|
|
||||||
sed -i "s/^state=.*/state=/g" /home/admin/raspiblitz.info
|
|
||||||
date +%s > /home/admin/copy_end.time
|
|
||||||
sudo sshpass -p "${targetPassword}" rsync -avhW -e 'ssh -o StrictHostKeyChecking=no -p 22' /home/admin/copy_end.time bitcoin@${targetIP}:/mnt/hdd/bitcoin
|
|
||||||
sudo rm -f /home/admin/copy_end.time
|
|
||||||
|
|
||||||
echo "# start services again ..."
|
|
||||||
sudo systemctl enable ${network}d
|
|
||||||
sudo systemctl start ${network}d
|
|
||||||
sudo systemctl start lnd
|
|
||||||
sudo systemctl start background
|
|
||||||
|
|
||||||
echo "# show final message"
|
|
||||||
whiptail --msgbox "OK - Copy Process Finished.\n\nNow check on the target RaspiBlitz if it was successful." 10 40 "" --title " DONE " --backtitle "RaspiBlitz - Copy Blockchain"
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
# when called with parameter "sourcemode"
|
|
||||||
if [ "$1" == "sourcemode" ]; then
|
|
||||||
copyHost
|
|
||||||
raspiblitz
|
|
||||||
exit 0
|
|
||||||
fi
|
fi
|
||||||
|
if [ "${lightning}" == "cl" ] || [ "${cl}" == "on" ]; then
|
||||||
# Basic Options
|
OPTIONS+=(REPAIR-CL "Repair/Backup C-Lightning")
|
||||||
#OPTIONS=(HARDWARE "Run Hardwaretest" \
|
fi
|
||||||
OPTIONS=(SOFTWARE "Run Softwaretest (DebugReport)" \
|
OPTIONS+=(MIGRATION "Migrate Blitz Data to new Hardware")
|
||||||
BACKUP-LND "Backup your LND data (Rescue-File)" \
|
OPTIONS+=(COPY-SOURCE "Copy Blockchain Source Modus")
|
||||||
MIGRATION "Migrate Blitz Data to new Hardware" \
|
OPTIONS+=(RESET-CHAIN "Delete Blockchain & Re-Download")
|
||||||
COPY-SOURCE "Copy Blockchain Source Modus" \
|
OPTIONS+=(RESET-HDD "Delete HDD Data but keep Blockchain")
|
||||||
RESET-CHAIN "Delete Blockchain & Re-Download" \
|
OPTIONS+=(RESET-ALL "Delete HDD completely to start fresh")
|
||||||
RESET-LND "Delete LND & start new node/wallet" \
|
OPTIONS+=(DELETE-ELEC "Delete Electrum Index")
|
||||||
RESET-HDD "Delete HDD Data but keep Blockchain" \
|
OPTIONS+=(DELETE-INDEX "Delete Bitcoin Transaction-Index")
|
||||||
RESET-ALL "Delete HDD completely to start fresh" \
|
|
||||||
DELETE-ELEC "Delete Electrum Index" \
|
|
||||||
DELETE-INDEX "Delete Bitcoin Transaction-Index"
|
|
||||||
)
|
|
||||||
|
|
||||||
CHOICE=$(whiptail --clear --title "Repair Options" --menu "" 18 62 11 "${OPTIONS[@]}" 2>&1 >/dev/tty)
|
CHOICE=$(whiptail --clear --title "Repair Options" --menu "" 18 62 11 "${OPTIONS[@]}" 2>&1 >/dev/tty)
|
||||||
|
|
||||||
|
@ -184,16 +71,22 @@ case $CHOICE in
|
||||||
# HARDWARE)
|
# HARDWARE)
|
||||||
# ;;
|
# ;;
|
||||||
SOFTWARE)
|
SOFTWARE)
|
||||||
sudo /home/admin/XXdebugLogs.sh
|
sudo /home/admin/config.scripts/blitz.debug.sh
|
||||||
echo "Press ENTER to return to main menu."
|
echo "Press ENTER to return to main menu."
|
||||||
read key
|
read key
|
||||||
;;
|
;;
|
||||||
BACKUP-LND)
|
BACKUP-LND)
|
||||||
sudo /home/admin/config.scripts/lnd.rescue.sh backup
|
sudo /home/admin/config.scripts/lnd.backup.sh lnd-export-gui
|
||||||
echo
|
echo
|
||||||
echo "Press ENTER when your backup download is done to shutdown."
|
echo "Press ENTER when your backup download is done to shutdown."
|
||||||
read key
|
read key
|
||||||
/home/admin/XXshutdown.sh
|
/home/admin/config.scripts/blitz.shutdown.sh
|
||||||
|
;;
|
||||||
|
REPAIR-CL)
|
||||||
|
sudo /home/admin/99clRepairMenu.sh
|
||||||
|
echo
|
||||||
|
echo "Press ENTER to return to main menu."
|
||||||
|
read key
|
||||||
;;
|
;;
|
||||||
MIGRATION)
|
MIGRATION)
|
||||||
sudo /home/admin/config.scripts/blitz.migration.sh "export-gui"
|
sudo /home/admin/config.scripts/blitz.migration.sh "export-gui"
|
||||||
|
@ -212,20 +105,20 @@ case $CHOICE in
|
||||||
result=""
|
result=""
|
||||||
while [ ${#result} -eq 0 ]
|
while [ ${#result} -eq 0 ]
|
||||||
do
|
do
|
||||||
|
trap 'rm -f "$_temp"' EXIT
|
||||||
_temp=$(mktemp -p /dev/shm/)
|
_temp=$(mktemp -p /dev/shm/)
|
||||||
l1="Please enter the new name of your LND node:\n"
|
l1="Please enter the new name of your LND node:\n"
|
||||||
l2="different name is better for a fresh identity\n"
|
l2="different name is better for a fresh identity\n"
|
||||||
l3="one word, keep characters basic & not too long"
|
l3="one word, keep characters basic & not too long"
|
||||||
dialog --backtitle "RaspiBlitz - Setup (${network}/${chain})" --inputbox "$l1$l2$l3" 13 52 2>$_temp
|
dialog --backtitle "RaspiBlitz - Setup (${network}/${chain})" --inputbox "$l1$l2$l3" 13 52 2>$_temp
|
||||||
result=$( cat $_temp | tr -dc '[:alnum:]-.' | tr -d ' ' )
|
result=$( cat $_temp | tr -dc '[:alnum:]-.' | tr -d ' ' )
|
||||||
shred -u $_temp
|
|
||||||
echo "processing ..."
|
echo "processing ..."
|
||||||
sleep 3
|
sleep 3
|
||||||
done
|
done
|
||||||
|
|
||||||
# make sure host is named like in the raspiblitz config
|
# make sure host is named like in the raspiblitz config
|
||||||
echo "Setting the Name/Alias/Hostname .."
|
echo "Setting the Name/Alias/Hostname .."
|
||||||
sudo /home/admin/config.scripts/lnd.setname.sh ${result}
|
sudo /home/admin/config.scripts/lnd.setname.sh mainnet ${result}
|
||||||
sudo sed -i "s/^hostname=.*/hostname=${result}/g" /mnt/hdd/raspiblitz.conf
|
sudo sed -i "s/^hostname=.*/hostname=${result}/g" /mnt/hdd/raspiblitz.conf
|
||||||
|
|
||||||
echo "stopping lnd ..."
|
echo "stopping lnd ..."
|
||||||
|
@ -235,7 +128,7 @@ case $CHOICE in
|
||||||
|
|
||||||
# go back to main menu (and show)
|
# go back to main menu (and show)
|
||||||
/home/admin/00raspiblitz.sh
|
/home/admin/00raspiblitz.sh
|
||||||
exit 1;
|
exit 0;
|
||||||
;;
|
;;
|
||||||
RESET-HDD)
|
RESET-HDD)
|
||||||
askBackupCopy
|
askBackupCopy
|
||||||
|
@ -253,14 +146,14 @@ case $CHOICE in
|
||||||
;;
|
;;
|
||||||
DELETE-ELEC)
|
DELETE-ELEC)
|
||||||
/home/admin/config.scripts/bonus.electrs.sh off deleteindex
|
/home/admin/config.scripts/bonus.electrs.sh off deleteindex
|
||||||
exit 1;
|
exit 0;
|
||||||
;;
|
;;
|
||||||
DELETE-INDEX)
|
DELETE-INDEX)
|
||||||
/home/admin/config.scripts/network.txindex.sh delete
|
/home/admin/config.scripts/network.txindex.sh delete
|
||||||
exit 1;
|
exit 0;
|
||||||
;;
|
;;
|
||||||
COPY-SOURCE)
|
COPY-SOURCE)
|
||||||
copyHost
|
/home/admin/config.scripts/blitz.copychain.sh source
|
||||||
/home/admin/config.scripts/lnd.unlock.sh
|
/home/admin/config.scripts/lnd.unlock.sh
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
119
home.admin/99clMenu.sh
Normal file
119
home.admin/99clMenu.sh
Normal file
|
@ -0,0 +1,119 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# get raspiblitz config
|
||||||
|
echo "# get raspiblitz config"
|
||||||
|
source /home/admin/raspiblitz.info
|
||||||
|
source /mnt/hdd/raspiblitz.conf
|
||||||
|
|
||||||
|
source <(/home/admin/config.scripts/network.aliases.sh getvars cl $1)
|
||||||
|
|
||||||
|
# get the local network IP to be displayed on the LCD
|
||||||
|
source <(/home/admin/config.scripts/internet.sh status local)
|
||||||
|
|
||||||
|
# BASIC MENU INFO
|
||||||
|
WIDTH=64
|
||||||
|
BACKTITLE="RaspiBlitz"
|
||||||
|
TITLE=" C-Lightning Options (${CHAIN})"
|
||||||
|
MENU=""
|
||||||
|
OPTIONS=()
|
||||||
|
OPTIONS+=(FUNDING "Fund the C-lightning wallet onchain")
|
||||||
|
OPTIONS+=(PEERING "Connect to a peer")
|
||||||
|
OPTIONS+=(CHANNEL "Open a channel with peer")
|
||||||
|
OPTIONS+=(SEND "Pay an invoice / payment request")
|
||||||
|
OPTIONS+=(RECEIVE "Create an invoice / payment request")
|
||||||
|
OPTIONS+=(SUMMARY "Information about this node")
|
||||||
|
OPTIONS+=(NAME "Change the name / alias of the node")
|
||||||
|
ln_getInfo=$($lightningcli_alias getinfo 2>/dev/null)
|
||||||
|
ln_channels_online="$(echo "${ln_getInfo}" | jq -r '.num_active_channels')" 2>/dev/null
|
||||||
|
cl_num_inactive_channels="$(echo "${ln_getInfo}" | jq -r '.num_inactive_channels')" 2>/dev/null
|
||||||
|
openChannels=$((ln_channels_online+cl_num_inactive_channels))
|
||||||
|
if [ ${#openChannels} -gt 0 ] && [ ${openChannels} -gt 0 ]; then
|
||||||
|
OPTIONS+=(SUEZ "Visualize channels")
|
||||||
|
OPTIONS+=(CLOSEALL "Close all open channels on $CHAIN")
|
||||||
|
fi
|
||||||
|
OPTIONS+=(CASHOUT "Withdraw all funds onchain ($CHAIN)")
|
||||||
|
OPTIONS+=(SEED "Show Wallet Seed Words")
|
||||||
|
OPTIONS+=(REPAIR-CL "Repair options for C-lightning")
|
||||||
|
if [ "${lightning}" != "cl" ] && [ "${CHAIN}" == "mainnet" ]; then
|
||||||
|
OPTIONS+=(SWITCHLN "Use C-lightning as default")
|
||||||
|
fi
|
||||||
|
|
||||||
|
CHOICE_HEIGHT=$(("${#OPTIONS[@]}/2+1"))
|
||||||
|
HEIGHT=$((CHOICE_HEIGHT+6))
|
||||||
|
CHOICE=$(dialog --clear \
|
||||||
|
--backtitle "$BACKTITLE" \
|
||||||
|
--title "$TITLE" \
|
||||||
|
--ok-label "Select" \
|
||||||
|
--cancel-label "Main menu" \
|
||||||
|
--menu "$MENU" \
|
||||||
|
$HEIGHT $WIDTH $CHOICE_HEIGHT \
|
||||||
|
"${OPTIONS[@]}" \
|
||||||
|
2>&1 >/dev/tty)
|
||||||
|
|
||||||
|
case $CHOICE in
|
||||||
|
SUMMARY)
|
||||||
|
clear
|
||||||
|
/home/admin/config.scripts/cl-plugin.summary.sh $CHAIN
|
||||||
|
echo "Press ENTER to return to main menu."
|
||||||
|
read key
|
||||||
|
;;
|
||||||
|
PEERING)
|
||||||
|
/home/admin/BBconnectPeer.sh cl $CHAIN
|
||||||
|
;;
|
||||||
|
FUNDING)
|
||||||
|
/home/admin/BBfundWallet.sh cl $CHAIN
|
||||||
|
;;
|
||||||
|
CASHOUT)
|
||||||
|
/home/admin/BBcashoutWallet.sh cl $CHAIN
|
||||||
|
;;
|
||||||
|
CHANNEL)
|
||||||
|
/home/admin/BBopenChannel.sh cl $CHAIN
|
||||||
|
;;
|
||||||
|
SEND)
|
||||||
|
/home/admin/BBpayInvoice.sh cl $CHAIN
|
||||||
|
;;
|
||||||
|
RECEIVE)
|
||||||
|
/home/admin/BBcreateInvoice.sh cl $CHAIN
|
||||||
|
;;
|
||||||
|
SEED)
|
||||||
|
sudo /home/admin/config.scripts/cl.install.sh display-seed $CHAIN
|
||||||
|
;;
|
||||||
|
NAME)
|
||||||
|
sudo /home/admin/config.scripts/cl.setname.sh $CHAIN
|
||||||
|
;;
|
||||||
|
SUEZ)
|
||||||
|
clear
|
||||||
|
if [ ! -f /home/bitcoin/suez/suez ];then
|
||||||
|
/home/admin/config.scripts/bonus.suez.sh on
|
||||||
|
fi
|
||||||
|
cd /home/bitcoin/suez || exit 0
|
||||||
|
command="sudo -u bitcoin /home/bitcoin/.local/bin/poetry run ./suez --client=c-lightning --client-args=--conf=${CLCONF}"
|
||||||
|
echo "# Running the command:"
|
||||||
|
echo "${command}"
|
||||||
|
echo
|
||||||
|
$command
|
||||||
|
echo
|
||||||
|
echo "Press ENTER to return to main menu."
|
||||||
|
read key
|
||||||
|
;;
|
||||||
|
CLOSEALL)
|
||||||
|
/home/admin/BBcloseAllChannels.sh cl $CHAIN
|
||||||
|
echo "Press ENTER to return to main menu."
|
||||||
|
read key
|
||||||
|
;;
|
||||||
|
REPAIR-CL)
|
||||||
|
/home/admin/99clRepairMenu.sh $CHAIN
|
||||||
|
;;
|
||||||
|
SWITCHLN)
|
||||||
|
clear
|
||||||
|
echo
|
||||||
|
# setting value in the raspiblitz.conf
|
||||||
|
sudo sed -i "s/^lightning=.*/lightning=cl/g" /mnt/hdd/raspiblitz.conf
|
||||||
|
echo "# OK - lightning=cl is set in /mnt/hdd/raspiblitz.conf"
|
||||||
|
echo
|
||||||
|
echo "Press ENTER to return to main menu."
|
||||||
|
read key
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
exit 0
|
180
home.admin/99clRepairMenu.sh
Normal file
180
home.admin/99clRepairMenu.sh
Normal file
|
@ -0,0 +1,180 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# get raspiblitz config
|
||||||
|
echo "# get raspiblitz config"
|
||||||
|
source /home/admin/raspiblitz.info
|
||||||
|
source /mnt/hdd/raspiblitz.conf
|
||||||
|
|
||||||
|
source <(/home/admin/config.scripts/network.aliases.sh getvars cl $1)
|
||||||
|
|
||||||
|
# get the local network IP to be displayed on the LCD
|
||||||
|
source <(/home/admin/config.scripts/internet.sh status local)
|
||||||
|
NETclEncryptedHSM="${netprefix}clEncryptedHSM"
|
||||||
|
|
||||||
|
# BASIC MENU INFO
|
||||||
|
WIDTH=64
|
||||||
|
BACKTITLE="RaspiBlitz"
|
||||||
|
TITLE="C-lightning repair options for $CHAIN"
|
||||||
|
MENU=""
|
||||||
|
OPTIONS=()
|
||||||
|
|
||||||
|
if [ "$(eval echo \$${netprefix}clEncryptedHSM)" = "off" ];then
|
||||||
|
OPTIONS+=(ENCRYPT "Encrypt the hsm_secret")
|
||||||
|
elif [ "$(eval echo \$${netprefix}clEncryptedHSM)" = "on" ];then
|
||||||
|
OPTIONS+=(PASSWORD_C "Change the hsm_secret encryption password")
|
||||||
|
OPTIONS+=(DECRYPT "Decrypt the hsm_secret")
|
||||||
|
if [ ! -f "/root/.${netprefix}cl.pw" ]; then
|
||||||
|
OPTIONS+=(AUTOUNLOCK-ON "Auto-decrypt the hsm_secret after boot")
|
||||||
|
else
|
||||||
|
OPTIONS+=(AUTOUNLOCK-OFF "Do not auto-decrypt the hsm_secret after boot")
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
OPTIONS+=(BACKUP "Full backup (hsm_secret + lightningd.sqlite3")
|
||||||
|
OPTIONS+=(RESET "Reset the wallet and create new")
|
||||||
|
OPTIONS+=(FILERESTORE "Restore from a rescue file")
|
||||||
|
OPTIONS+=(SEEDRESTORE "Restore from a seed (onchain funds only)")
|
||||||
|
|
||||||
|
CHOICE_HEIGHT=$(("${#OPTIONS[@]}/2+1"))
|
||||||
|
HEIGHT=$((CHOICE_HEIGHT+6))
|
||||||
|
CHOICE=$(dialog --clear \
|
||||||
|
--backtitle "$BACKTITLE" \
|
||||||
|
--title "$TITLE" \
|
||||||
|
--ok-label "Select" \
|
||||||
|
--cancel-label "Main menu" \
|
||||||
|
--menu "$MENU" \
|
||||||
|
$HEIGHT $WIDTH $CHOICE_HEIGHT \
|
||||||
|
"${OPTIONS[@]}" \
|
||||||
|
2>&1 >/dev/tty)
|
||||||
|
|
||||||
|
case $CHOICE in
|
||||||
|
ENCRYPT)
|
||||||
|
/home/admin/config.scripts/cl.hsmtool.sh encrypt $CHAIN
|
||||||
|
source /mnt/hdd/raspiblitz.conf
|
||||||
|
;;
|
||||||
|
|
||||||
|
DECRYPT)
|
||||||
|
/home/admin/config.scripts/cl.hsmtool.sh decrypt $CHAIN
|
||||||
|
source /mnt/hdd/raspiblitz.conf
|
||||||
|
;;
|
||||||
|
|
||||||
|
PASSWORD_C)
|
||||||
|
/home/admin/config.scripts/cl.hsmtool.sh change-password $CHAIN
|
||||||
|
;;
|
||||||
|
|
||||||
|
AUTOUNLOCK-ON)
|
||||||
|
/home/admin/config.scripts/cl.hsmtool.sh autounlock-on $CHAIN
|
||||||
|
;;
|
||||||
|
|
||||||
|
AUTOUNLOCK-OFF)
|
||||||
|
/home/admin/config.scripts/cl.hsmtool.sh autounlock-off $CHAIN
|
||||||
|
;;
|
||||||
|
|
||||||
|
BACKUP)
|
||||||
|
## from dialogLightningWallet.sh
|
||||||
|
# run upload dialog and get result
|
||||||
|
_temp="/var/cache/raspiblitz/temp/.temp.tmp"
|
||||||
|
clear
|
||||||
|
/home/admin/config.scripts/cl.backup.sh cl-export-gui production $_temp
|
||||||
|
source $_temp 2>/dev/null
|
||||||
|
sudo rm $_temp 2>/dev/null
|
||||||
|
echo
|
||||||
|
echo "Press ENTER when finished downloading."
|
||||||
|
read key
|
||||||
|
;;
|
||||||
|
|
||||||
|
RESET)
|
||||||
|
# backup
|
||||||
|
## from dialogLightningWallet.sh
|
||||||
|
_temp="/var/cache/raspiblitz/temp/.temp.tmp"
|
||||||
|
clear
|
||||||
|
/home/admin/config.scripts/cl.backup.sh cl-export-gui production $_temp
|
||||||
|
source $_temp 2>/dev/null
|
||||||
|
sudo rm $_temp 2>/dev/null
|
||||||
|
echo
|
||||||
|
echo "The rescue file is stored on the SDcard named cl-rescue.*.tar.gz just in case."
|
||||||
|
echo
|
||||||
|
echo "The next step will overwrite the old C-lighthning $CHAIN wallet"
|
||||||
|
echo "Press ENTER to continue or CTRL+C to abort"
|
||||||
|
read key
|
||||||
|
# reset
|
||||||
|
sudo rm /home/bitcoin/.lightning/${CLNETWORK}/hsm_secret
|
||||||
|
sudo rm /home/bitcoin/.lightning/${CLNETWORK}/*.*
|
||||||
|
# make sure the new hsm_secret is treated as unencrypted and clear autounlock
|
||||||
|
sudo sed -i \
|
||||||
|
"s/^${netprefix}clEncryptedHSM=.*/${netprefix}clEncryptedHSM=off/g" \
|
||||||
|
/mnt/hdd/raspiblitz.conf
|
||||||
|
sudo sed -i \
|
||||||
|
"s/^${netprefix}clAutoUnlock=.*/${netprefix}clEncryptedHSM=off/g" \
|
||||||
|
/mnt/hdd/raspiblitz.conf
|
||||||
|
# new
|
||||||
|
/home/admin/config.scripts/cl.hsmtool.sh new $CHAIN
|
||||||
|
# set the lightningd service file on each active network
|
||||||
|
if [ "${cl}" == "on" ] || [ "${cl}" == "1" ]; then
|
||||||
|
/home/admin/config.scripts/cl.install-service.sh mainnet
|
||||||
|
fi
|
||||||
|
if [ "${tcl}" == "on" ] || [ "${tcl}" == "1" ]; then
|
||||||
|
/home/admin/config.scripts/cl.install-service.sh testnet
|
||||||
|
fi
|
||||||
|
if [ "${scl}" == "on" ] || [ "${scl}" == "1" ]; then
|
||||||
|
/home/admin/config.scripts/cl.install-service.sh signet
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
|
||||||
|
FILERESTORE)
|
||||||
|
# backup
|
||||||
|
## from dialogLightningWallet.sh
|
||||||
|
_temp="/var/cache/raspiblitz/temp/.temp.tmp"
|
||||||
|
clear
|
||||||
|
/home/admin/config.scripts/cl.backup.sh cl-export-gui production $_temp
|
||||||
|
source $_temp 2>/dev/null
|
||||||
|
sudo rm $_temp 2>/dev/null
|
||||||
|
echo
|
||||||
|
echo "The rescue file is stored on the SDcard named cl-rescue.*.tar.gz just in case."
|
||||||
|
echo
|
||||||
|
echo "The next step will overwrite the old C-lighthning $CHAIN wallet"
|
||||||
|
echo "Press ENTER to continue or CTRL+C to abort"
|
||||||
|
read key
|
||||||
|
# reset
|
||||||
|
sudo rm /home/bitcoin/.lightning/${CLNETWORK}/hsm_secret
|
||||||
|
sudo rm /home/bitcoin/.lightning/${CLNETWORK}/*.*
|
||||||
|
# import file
|
||||||
|
_temp="/var/cache/raspiblitz/temp/.temp.tmp"
|
||||||
|
clear
|
||||||
|
/home/admin/config.scripts/cl.backup.sh cl-import-gui production $_temp
|
||||||
|
source $_temp 2>/dev/null
|
||||||
|
sudo rm $_temp 2>/dev/null
|
||||||
|
;;
|
||||||
|
|
||||||
|
SEEDRESTORE)
|
||||||
|
# backup
|
||||||
|
## from dialogLightningWallet.sh
|
||||||
|
_temp="/var/cache/raspiblitz/temp/.temp.tmp"
|
||||||
|
clear
|
||||||
|
/home/admin/config.scripts/cl.backup.sh cl-export-gui production $_temp
|
||||||
|
source $_temp 2>/dev/null
|
||||||
|
sudo rm $_temp 2>/dev/null
|
||||||
|
echo
|
||||||
|
echo "The rescue file is stored on the SDcard named cl-rescue.*.tar.gz just in case."
|
||||||
|
echo
|
||||||
|
echo "The next step will overwrite the old C-lighthning $CHAIN wallet"
|
||||||
|
echo "Press ENTER to continue or CTRL+C to abort"
|
||||||
|
read key
|
||||||
|
# reset
|
||||||
|
sudo rm /home/bitcoin/.lightning/${CLNETWORK}/hsm_secret
|
||||||
|
sudo rm /home/bitcoin/.lightning/${CLNETWORK}/config
|
||||||
|
sudo rm /home/bitcoin/.lightning/${CLNETWORK}/*.*
|
||||||
|
# import seed
|
||||||
|
_temp="/var/cache/raspiblitz/.temp.tmp"
|
||||||
|
/home/admin/config.scripts/cl.backup.sh seed-import-gui $_temp
|
||||||
|
source $_temp
|
||||||
|
/home/admin/config.scripts/cl.hsmtool.sh seed-force "$CHAIN" "${seedWords}"
|
||||||
|
sudo rm $_temp 2>/dev/null
|
||||||
|
# regenerate config
|
||||||
|
/home/admin/config.scripts/cl.hsmtool.sh autounlock-off
|
||||||
|
/home/admin/config.scripts/cl.hsmtool.sh decrypt
|
||||||
|
/home/admin/config.scripts/cl.install.sh on $CHAIN
|
||||||
|
;;
|
||||||
|
|
||||||
|
esac
|
||||||
|
|
||||||
|
exit 0
|
|
@ -9,9 +9,7 @@ source /mnt/hdd/raspiblitz.conf
|
||||||
source <(/home/admin/config.scripts/internet.sh status local)
|
source <(/home/admin/config.scripts/internet.sh status local)
|
||||||
|
|
||||||
# BASIC MENU INFO
|
# BASIC MENU INFO
|
||||||
HEIGHT=12
|
|
||||||
WIDTH=64
|
WIDTH=64
|
||||||
CHOICE_HEIGHT=6
|
|
||||||
BACKTITLE="RaspiBlitz"
|
BACKTITLE="RaspiBlitz"
|
||||||
TITLE="Connect Options"
|
TITLE="Connect Options"
|
||||||
MENU=""
|
MENU=""
|
||||||
|
@ -20,20 +18,20 @@ OPTIONS=()
|
||||||
OPTIONS+=(MOBILE "Connect Mobile Wallet")
|
OPTIONS+=(MOBILE "Connect Mobile Wallet")
|
||||||
if [ "${ElectRS}" == "on" ]; then
|
if [ "${ElectRS}" == "on" ]; then
|
||||||
OPTIONS+=(ELECTRS "Electrum Rust Server")
|
OPTIONS+=(ELECTRS "Electrum Rust Server")
|
||||||
HEIGHT=$((HEIGHT+1))
|
|
||||||
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
|
|
||||||
fi
|
fi
|
||||||
if [ "${BTCPayServer}" == "on" ]; then
|
if [ "${BTCPayServer}" == "on" ]; then
|
||||||
OPTIONS+=(BTCPAY "Show LND connection string")
|
OPTIONS+=(BTCPAY "Show LND connection string")
|
||||||
HEIGHT=$((HEIGHT+1))
|
|
||||||
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
|
|
||||||
fi
|
fi
|
||||||
OPTIONS+=(${network}RPC "Connect Specter Desktop or JoinMarket")
|
OPTIONS+=(${network}RPC "Connect Specter Desktop or JoinMarket")
|
||||||
OPTIONS+=(BISQ "Connect Bisq to this node")
|
OPTIONS+=(BISQ "Connect Bisq to this node")
|
||||||
OPTIONS+=(EXPORT "Get Macaroons and TLS.cert")
|
if [ "${lightning}" == "lnd" ] || [ "${lnd}" == "on" ]; then
|
||||||
OPTIONS+=(RESET "Recreate LND Macaroons & tls.cert")
|
OPTIONS+=(EXPORT "Get Macaroons and TLS.cert")
|
||||||
OPTIONS+=(SYNC "Sync Macaroons & tls.cert with Apps/Users")
|
OPTIONS+=(RESET "Recreate LND Macaroons & tls.cert")
|
||||||
|
OPTIONS+=(SYNC "Sync Macaroons & tls.cert with Apps/Users")
|
||||||
|
fi
|
||||||
|
|
||||||
|
CHOICE_HEIGHT=$(("${#OPTIONS[@]}/2+1"))
|
||||||
|
HEIGHT=$((CHOICE_HEIGHT+6))
|
||||||
CHOICE=$(dialog --clear \
|
CHOICE=$(dialog --clear \
|
||||||
--backtitle "$BACKTITLE" \
|
--backtitle "$BACKTITLE" \
|
||||||
--title "$TITLE" \
|
--title "$TITLE" \
|
||||||
|
@ -58,7 +56,7 @@ case $CHOICE in
|
||||||
RESET)
|
RESET)
|
||||||
sudo /home/admin/config.scripts/lnd.credentials.sh reset
|
sudo /home/admin/config.scripts/lnd.credentials.sh reset
|
||||||
sudo /home/admin/config.scripts/lnd.credentials.sh sync
|
sudo /home/admin/config.scripts/lnd.credentials.sh sync
|
||||||
sudo /home/admin/XXshutdown.sh reboot
|
sudo /home/admin/config.scripts/blitz.shutdown.sh reboot
|
||||||
exit 0;;
|
exit 0;;
|
||||||
SYNC)
|
SYNC)
|
||||||
sudo /home/admin/config.scripts/lnd.credentials.sh sync
|
sudo /home/admin/config.scripts/lnd.credentials.sh sync
|
||||||
|
@ -78,7 +76,7 @@ case $CHOICE in
|
||||||
if [ $(grep -c "peerbloomfilters=1" < /mnt/hdd/bitcoin/bitcoin.conf) -gt 0 ]&&\
|
if [ $(grep -c "peerbloomfilters=1" < /mnt/hdd/bitcoin/bitcoin.conf) -gt 0 ]&&\
|
||||||
[ $(grep -c Bisq < /etc/tor/torrc) -gt 0 ];then
|
[ $(grep -c Bisq < /etc/tor/torrc) -gt 0 ];then
|
||||||
OPTIONS+=(SHOWBISQ "Show the Hidden Service to connect Bisq")
|
OPTIONS+=(SHOWBISQ "Show the Hidden Service to connect Bisq")
|
||||||
OPTIONS+=(REMOVEBISQ "Remove the Hidden Service for bisq")
|
OPTIONS+=(REMOVEBISQ "Remove the Hidden Service for Bisq")
|
||||||
fi
|
fi
|
||||||
CHOICE=$(dialog --clear \
|
CHOICE=$(dialog --clear \
|
||||||
--backtitle "" \
|
--backtitle "" \
|
||||||
|
@ -105,12 +103,12 @@ case $CHOICE in
|
||||||
if [ $(grep -c Bisq < /etc/tor/torrc) -eq 0 ];then
|
if [ $(grep -c Bisq < /etc/tor/torrc) -eq 0 ];then
|
||||||
echo "# Creating the Hidden Service for Bisq"
|
echo "# Creating the Hidden Service for Bisq"
|
||||||
echo "
|
echo "
|
||||||
# Hidden Service for Bisq (bitcoin RPC v2)
|
# Hidden Service for Bisq (bitcoin P2P v3)
|
||||||
HiddenServiceDir /mnt/hdd/tor/bisq
|
HiddenServiceDir /mnt/hdd/tor/bisq
|
||||||
HiddenServiceVersion 2
|
HiddenServiceVersion 3
|
||||||
HiddenServicePort 8333 127.0.0.1:8333" | sudo tee -a /etc/tor/torrc
|
HiddenServicePort 8333 127.0.0.1:8333" | sudo tee -a /etc/tor/torrc
|
||||||
echo "# Restarting Tor"
|
echo "# Reloading Tor"
|
||||||
sudo systemctl restart tor
|
sudo systemctl reload tor@default
|
||||||
sleep 10
|
sleep 10
|
||||||
TOR_ADDRESS=$(sudo cat /mnt/hdd/tor/bisq/hostname)
|
TOR_ADDRESS=$(sudo cat /mnt/hdd/tor/bisq/hostname)
|
||||||
if [ -z "$TOR_ADDRESS" ]; then
|
if [ -z "$TOR_ADDRESS" ]; then
|
||||||
|
@ -137,7 +135,7 @@ HiddenServicePort 8333 127.0.0.1:8333" | sudo tee -a /etc/tor/torrc
|
||||||
REMOVEBISQ)
|
REMOVEBISQ)
|
||||||
sudo sed -i '/Bisq/{N;N;N;d}' /etc/tor/torrc
|
sudo sed -i '/Bisq/{N;N;N;d}' /etc/tor/torrc
|
||||||
echo "# Restarting Tor"
|
echo "# Restarting Tor"
|
||||||
sudo systemctl restart tor;;
|
sudo systemctl reload tor@default;;
|
||||||
SHOWBISQ)
|
SHOWBISQ)
|
||||||
clear
|
clear
|
||||||
TOR_ADDRESS=$(sudo cat /mnt/hdd/tor/bisq/hostname)
|
TOR_ADDRESS=$(sudo cat /mnt/hdd/tor/bisq/hostname)
|
||||||
|
@ -166,12 +164,11 @@ HiddenServicePort 8333 127.0.0.1:8333" | sudo tee -a /etc/tor/torrc
|
||||||
echo "# Running on ${chain}net"
|
echo "# Running on ${chain}net"
|
||||||
echo
|
echo
|
||||||
localIPrange=$(ip addr | grep 'state UP' -A2 | grep -E -v 'docker0|veth' |\
|
localIPrange=$(ip addr | grep 'state UP' -A2 | grep -E -v 'docker0|veth' |\
|
||||||
grep 'eth0\|wlan0\|enp0' | tail -n1 | awk '{print $2}' |\
|
grep 'eth0\|wlan0\|enp0\|inet' | tail -n1 | awk '{print $2}' |\
|
||||||
awk -F. '{print $1"."$2"."$3".0/24"}')
|
awk -F. '{print $1"."$2"."$3".0/24"}')
|
||||||
localIP=$(ip addr | grep 'state UP' -A2 | grep -E -v 'docker0|veth' |\
|
localIP=$(hostname -I | awk '{print $1}')
|
||||||
grep 'eth0\|wlan0\|enp0' | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
|
|
||||||
allowIPrange=$(grep -c "rpcallowip=$localIPrange" < /mnt/hdd/${network}/${network}.conf)
|
allowIPrange=$(grep -c "rpcallowip=$localIPrange" < /mnt/hdd/${network}/${network}.conf)
|
||||||
bindIP=$(grep -c "rpcbind=$localIP" < /mnt/hdd/${network}/${network}.conf)
|
bindIP=$(grep -c "${chain}.rpcbind=$localIP" < /mnt/hdd/${network}/${network}.conf)
|
||||||
rpcTorService=$(grep -c "HiddenServicePort ${BITCOINRPCPORT} 127.0.0.1:${BITCOINRPCPORT}" < /etc/tor/torrc)
|
rpcTorService=$(grep -c "HiddenServicePort ${BITCOINRPCPORT} 127.0.0.1:${BITCOINRPCPORT}" < /etc/tor/torrc)
|
||||||
TorRPCaddress=$(sudo cat /mnt/hdd/tor/bitcoin${BITCOINRPCPORT}/hostname)
|
TorRPCaddress=$(sudo cat /mnt/hdd/tor/bitcoin${BITCOINRPCPORT}/hostname)
|
||||||
|
|
||||||
|
@ -239,7 +236,7 @@ HiddenServicePort 8333 127.0.0.1:8333" | sudo tee -a /etc/tor/torrc
|
||||||
restartCore=1
|
restartCore=1
|
||||||
fi
|
fi
|
||||||
if [ $bindIP -eq 0 ]; then
|
if [ $bindIP -eq 0 ]; then
|
||||||
echo "rpcbind=$localIP" | sudo tee -a /mnt/hdd/${network}/${network}.conf
|
echo "${chain}.rpcbind=$localIP" | sudo tee -a /mnt/hdd/${network}/${network}.conf
|
||||||
restartCore=1
|
restartCore=1
|
||||||
fi
|
fi
|
||||||
if [ $restartCore = 1 ];then
|
if [ $restartCore = 1 ];then
|
||||||
|
@ -286,7 +283,7 @@ HiddenServicePort 8333 127.0.0.1:8333" | sudo tee -a /etc/tor/torrc
|
||||||
restartCore=1
|
restartCore=1
|
||||||
fi
|
fi
|
||||||
if [ $bindIP -gt 0 ]; then
|
if [ $bindIP -gt 0 ]; then
|
||||||
sudo sed -i "/^rpcbind=$localIP/d" /mnt/hdd/${network}/${network}.conf
|
sudo sed -i "/^${chain}.rpcbind=$localIP/d" /mnt/hdd/${network}/${network}.conf
|
||||||
restartCore=1
|
restartCore=1
|
||||||
fi
|
fi
|
||||||
if [ $restartCore = 1 ];then
|
if [ $restartCore = 1 ];then
|
||||||
|
|
|
@ -1,116 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# get raspiblitz config
|
|
||||||
echo "get raspiblitz config"
|
|
||||||
source /home/admin/raspiblitz.info
|
|
||||||
source /mnt/hdd/raspiblitz.conf
|
|
||||||
|
|
||||||
# get the local network IP to be displayed on the LCD
|
|
||||||
source <(/home/admin/config.scripts/internet.sh status local)
|
|
||||||
|
|
||||||
# BASIC MENU INFO
|
|
||||||
HEIGHT=13
|
|
||||||
WIDTH=64
|
|
||||||
CHOICE_HEIGHT=7
|
|
||||||
BACKTITLE="RaspiBlitz"
|
|
||||||
TITLE="Lightning Options"
|
|
||||||
MENU=""
|
|
||||||
OPTIONS=()
|
|
||||||
|
|
||||||
OPTIONS+=(FUNDING "Fund your LND Wallet")
|
|
||||||
OPTIONS+=(PEERING "Connect to a Peer")
|
|
||||||
OPTIONS+=(CHANNEL "Open a Channel with Peer")
|
|
||||||
OPTIONS+=(SEND "Pay an Invoice/PaymentRequest")
|
|
||||||
OPTIONS+=(RECEIVE "Create Invoice/PaymentRequest")
|
|
||||||
|
|
||||||
if [ "${chain}" = "main" ]; then
|
|
||||||
OPTIONS+=(lnbalance "Detailed Wallet Balances")
|
|
||||||
OPTIONS+=(lnchannels "Lightning Channel List")
|
|
||||||
OPTIONS+=(lnfwdreport "Lightning Forwarding Events Report")
|
|
||||||
HEIGHT=$((HEIGHT+3))
|
|
||||||
CHOICE_HEIGHT=$((CHOICE_HEIGHT+3))
|
|
||||||
fi
|
|
||||||
|
|
||||||
OPTIONS+=(NAME "Change Name/Alias of Node")
|
|
||||||
|
|
||||||
openChannels=$(sudo -u bitcoin /usr/local/bin/lncli --chain=${network} --network=${chain}net listchannels 2>/dev/null | jq '.[] | length')
|
|
||||||
if [ ${#openChannels} -gt 0 ] && [ ${openChannels} -gt 0 ]; then
|
|
||||||
OPTIONS+=(CLOSEALL "Close all open Channels")
|
|
||||||
HEIGHT=$((HEIGHT+1))
|
|
||||||
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
|
|
||||||
fi
|
|
||||||
|
|
||||||
OPTIONS+=(CASHOUT "Remove Funds from LND")
|
|
||||||
|
|
||||||
CHOICE=$(dialog --clear \
|
|
||||||
--backtitle "$BACKTITLE" \
|
|
||||||
--title "$TITLE" \
|
|
||||||
--ok-label "Select" \
|
|
||||||
--cancel-label "Main menu" \
|
|
||||||
--menu "$MENU" \
|
|
||||||
$HEIGHT $WIDTH $CHOICE_HEIGHT \
|
|
||||||
"${OPTIONS[@]}" \
|
|
||||||
2>&1 >/dev/tty)
|
|
||||||
|
|
||||||
case $CHOICE in
|
|
||||||
lnbalance)
|
|
||||||
clear
|
|
||||||
echo "*** YOUR SATOSHI BALANCES ***"
|
|
||||||
/home/admin/config.scripts/lnd.balance.sh ${network}
|
|
||||||
echo "Press ENTER to return to main menu."
|
|
||||||
read key
|
|
||||||
;;
|
|
||||||
lnchannels)
|
|
||||||
clear
|
|
||||||
echo "*** YOUR LIGHTNING CHANNELS ***"
|
|
||||||
echo ""
|
|
||||||
echo "Capacity -> total sats in the channel (their side + your side)"
|
|
||||||
echo "Commit-Fee -> the fee that's charged if either side of the channel closes"
|
|
||||||
echo "Balance-Local -> sats on your side of the channel (outbound liquidity)"
|
|
||||||
echo "Balance-Remote -> sats on their side of the channel (inbound liquidity)"
|
|
||||||
echo "Fee-Base -> fixed fee (in millisatoshis) per forwarding on channel"
|
|
||||||
echo "Fee-PerMil -> amount based fee (millisatoshis per 1 satoshi) on forwarding"
|
|
||||||
/home/admin/config.scripts/lnd.channels.sh ${network}
|
|
||||||
echo "Press ENTER to return to main menu."
|
|
||||||
read key
|
|
||||||
;;
|
|
||||||
lnfwdreport)
|
|
||||||
/home/admin/config.scripts/lnd.fwdreport.sh -menu
|
|
||||||
echo "Press ENTER to return to main menu."
|
|
||||||
read key
|
|
||||||
;;
|
|
||||||
PEERING)
|
|
||||||
/home/admin/BBconnectPeer.sh
|
|
||||||
;;
|
|
||||||
FUNDING)
|
|
||||||
/home/admin/BBfundWallet.sh
|
|
||||||
;;
|
|
||||||
CASHOUT)
|
|
||||||
/home/admin/BBcashoutWallet.sh
|
|
||||||
;;
|
|
||||||
CHANNEL)
|
|
||||||
/home/admin/BBopenChannel.sh
|
|
||||||
;;
|
|
||||||
SEND)
|
|
||||||
/home/admin/BBpayInvoice.sh
|
|
||||||
;;
|
|
||||||
RECEIVE)
|
|
||||||
/home/admin/BBcreateInvoice.sh
|
|
||||||
;;
|
|
||||||
NAME)
|
|
||||||
sudo /home/admin/config.scripts/lnd.setname.sh
|
|
||||||
noreboot=$?
|
|
||||||
if [ "${noreboot}" = "0" ]; then
|
|
||||||
sudo -u bitcoin ${network}-cli stop
|
|
||||||
echo "Press ENTER to Reboot."
|
|
||||||
read key
|
|
||||||
sudo /home/admin/XXshutdown.sh reboot
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
CLOSEALL)
|
|
||||||
/home/admin/BBcloseAllChannels.sh
|
|
||||||
echo "Press ENTER to return to main menu."
|
|
||||||
read key
|
|
||||||
;;
|
|
||||||
esac
|
|
145
home.admin/99lndMenu.sh
Normal file
145
home.admin/99lndMenu.sh
Normal file
|
@ -0,0 +1,145 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# get raspiblitz config
|
||||||
|
echo "get raspiblitz config"
|
||||||
|
source /home/admin/raspiblitz.info
|
||||||
|
source /mnt/hdd/raspiblitz.conf
|
||||||
|
|
||||||
|
# get the local network IP to be displayed on the LCD
|
||||||
|
source <(/home/admin/config.scripts/internet.sh status local)
|
||||||
|
|
||||||
|
source <(/home/admin/config.scripts/network.aliases.sh getvars lnd $1)
|
||||||
|
|
||||||
|
# make sure lnd wallet is unlocked
|
||||||
|
/home/admin/config.scripts/lnd.unlock.sh chain-unlock ${CHAIN}
|
||||||
|
|
||||||
|
# BASIC MENU INFO
|
||||||
|
WIDTH=64
|
||||||
|
BACKTITLE="RaspiBlitz"
|
||||||
|
TITLE=" LND Lightning Options (${CHAIN}) "
|
||||||
|
MENU=""
|
||||||
|
OPTIONS=()
|
||||||
|
|
||||||
|
OPTIONS+=(FUNDING "Fund your LND Wallet")
|
||||||
|
OPTIONS+=(PEERING "Connect to a Peer")
|
||||||
|
OPTIONS+=(CHANNEL "Open a Channel with Peer")
|
||||||
|
OPTIONS+=(SEND "Pay an Invoice/PaymentRequest")
|
||||||
|
OPTIONS+=(RECEIVE "Create Invoice/PaymentRequest")
|
||||||
|
|
||||||
|
if [ "${chain}" = "main" ]; then
|
||||||
|
OPTIONS+=(lnbalance "Detailed Wallet Balances")
|
||||||
|
OPTIONS+=(lnchannels "Lightning Channel List")
|
||||||
|
OPTIONS+=(lnfwdreport "Lightning Forwarding Events Report")
|
||||||
|
fi
|
||||||
|
|
||||||
|
OPTIONS+=(NAME "Change Name/Alias of Node")
|
||||||
|
|
||||||
|
openChannels=$($lncli_alias listchannels 2>/dev/null | jq '.[] | length')
|
||||||
|
if [ ${#openChannels} -gt 0 ] && [ ${openChannels} -gt 0 ]; then
|
||||||
|
OPTIONS+=(SUEZ "Visualize channels")
|
||||||
|
OPTIONS+=(CLOSEALL "Close all open Channels on $CHAIN")
|
||||||
|
fi
|
||||||
|
|
||||||
|
OPTIONS+=(CASHOUT "Withdraw all funds from LND on $CHAIN")
|
||||||
|
|
||||||
|
if [ "${lightning}" != "lnd" ]; then
|
||||||
|
OPTIONS+=(SWITCHLN "Use LND as default")
|
||||||
|
fi
|
||||||
|
|
||||||
|
CHOICE_HEIGHT=$(("${#OPTIONS[@]}/2+1"))
|
||||||
|
HEIGHT=$((CHOICE_HEIGHT+6))
|
||||||
|
CHOICE=$(dialog --clear \
|
||||||
|
--backtitle "$BACKTITLE" \
|
||||||
|
--title "$TITLE" \
|
||||||
|
--ok-label "Select" \
|
||||||
|
--cancel-label "Main menu" \
|
||||||
|
--menu "$MENU" \
|
||||||
|
$HEIGHT $WIDTH $CHOICE_HEIGHT \
|
||||||
|
"${OPTIONS[@]}" \
|
||||||
|
2>&1 >/dev/tty)
|
||||||
|
|
||||||
|
case $CHOICE in
|
||||||
|
lnbalance)
|
||||||
|
clear
|
||||||
|
echo "*** YOUR SATOSHI BALANCES ***"
|
||||||
|
/home/admin/config.scripts/lnd.balance.sh ${network}
|
||||||
|
echo "Press ENTER to return to main menu."
|
||||||
|
read key
|
||||||
|
;;
|
||||||
|
lnchannels)
|
||||||
|
clear
|
||||||
|
echo "*** YOUR LIGHTNING CHANNELS ***"
|
||||||
|
echo ""
|
||||||
|
echo "Capacity -> total sats in the channel (their side + your side)"
|
||||||
|
echo "Commit-Fee -> the fee that's charged if either side of the channel closes"
|
||||||
|
echo "Balance-Local -> sats on your side of the channel (outbound liquidity)"
|
||||||
|
echo "Balance-Remote -> sats on their side of the channel (inbound liquidity)"
|
||||||
|
echo "Fee-Base -> fixed fee (in millisatoshis) per forwarding on channel"
|
||||||
|
echo "Fee-PerMil -> amount based fee (millisatoshis per 1 satoshi) on forwarding"
|
||||||
|
/home/admin/config.scripts/lnd.channels.sh ${network}
|
||||||
|
echo "Press ENTER to return to main menu."
|
||||||
|
read key
|
||||||
|
;;
|
||||||
|
lnfwdreport)
|
||||||
|
/home/admin/config.scripts/lnd.fwdreport.sh -menu
|
||||||
|
echo "Press ENTER to return to main menu."
|
||||||
|
read key
|
||||||
|
;;
|
||||||
|
PEERING)
|
||||||
|
/home/admin/BBconnectPeer.sh lnd $CHAIN
|
||||||
|
;;
|
||||||
|
FUNDING)
|
||||||
|
/home/admin/BBfundWallet.sh lnd $CHAIN
|
||||||
|
;;
|
||||||
|
CASHOUT)
|
||||||
|
/home/admin/BBcashoutWallet.sh lnd $CHAIN
|
||||||
|
;;
|
||||||
|
CHANNEL)
|
||||||
|
/home/admin/BBopenChannel.sh lnd $CHAIN
|
||||||
|
;;
|
||||||
|
SEND)
|
||||||
|
/home/admin/BBpayInvoice.sh lnd $CHAIN
|
||||||
|
;;
|
||||||
|
RECEIVE)
|
||||||
|
/home/admin/BBcreateInvoice.sh lnd $CHAIN
|
||||||
|
;;
|
||||||
|
NAME)
|
||||||
|
sudo /home/admin/config.scripts/lnd.setname.sh $CHAIN
|
||||||
|
noreboot=$?
|
||||||
|
if [ "${noreboot}" = "0" ]; then
|
||||||
|
sudo -u bitcoin ${network}-cli stop
|
||||||
|
echo "Press ENTER to Reboot."
|
||||||
|
read key
|
||||||
|
sudo /home/admin/config.scripts/blitz.shutdown.sh reboot
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
SUEZ)
|
||||||
|
clear
|
||||||
|
if [ ! -f /home/bitcoin/suez/suez ];then
|
||||||
|
/home/admin/config.scripts/bonus.suez.sh on
|
||||||
|
fi
|
||||||
|
cd /home/bitcoin/suez || exit 1
|
||||||
|
sudo -u bitcoin /home/bitcoin/.local/bin/poetry run ./suez \
|
||||||
|
--client-args=-n=${CHAIN} \
|
||||||
|
--client-args=--rpcserver=localhost:1${L2rpcportmod}009
|
||||||
|
echo
|
||||||
|
echo "Press ENTER to return to main menu."
|
||||||
|
read key
|
||||||
|
;;
|
||||||
|
CLOSEALL)
|
||||||
|
/home/admin/BBcloseAllChannels.sh lnd $CHAIN
|
||||||
|
echo "Press ENTER to return to main menu."
|
||||||
|
read key
|
||||||
|
;;
|
||||||
|
SWITCHLN)
|
||||||
|
clear
|
||||||
|
echo
|
||||||
|
# setting value in raspi blitz config
|
||||||
|
sudo sed -i "s/^lightning=.*/lightning=lnd/g" /mnt/hdd/raspiblitz.conf
|
||||||
|
echo "# OK - lightning=lnd is set in /mnt/hdd/raspiblitz.conf"
|
||||||
|
echo
|
||||||
|
echo "Press ENTER to return to main menu."
|
||||||
|
read key
|
||||||
|
;;
|
||||||
|
esac
|
|
@ -5,28 +5,39 @@ echo "get raspiblitz config"
|
||||||
source /home/admin/raspiblitz.info
|
source /home/admin/raspiblitz.info
|
||||||
source /mnt/hdd/raspiblitz.conf
|
source /mnt/hdd/raspiblitz.conf
|
||||||
|
|
||||||
|
# source <(/home/admin/config.scripts/network.aliases.sh getvars <lnd|cl> <mainnet|testnet|signet>)
|
||||||
|
source <(/home/admin/config.scripts/network.aliases.sh getvars cl $1)
|
||||||
|
|
||||||
# BASIC MENU INFO
|
# BASIC MENU INFO
|
||||||
HEIGHT=12 # add 6 to CHOICE_HEIGHT + MENU lines
|
|
||||||
WIDTH=64
|
WIDTH=64
|
||||||
CHOICE_HEIGHT=6 # 1 line / OPTIONS
|
|
||||||
BACKTITLE="RaspiBlitz"
|
BACKTITLE="RaspiBlitz"
|
||||||
TITLE="System Options"
|
TITLE=" ${CHAIN} System Options "
|
||||||
MENU="" # adds lines to HEIGHT
|
MENU="" # adds lines to HEIGHT
|
||||||
OPTIONS=() # adds lines to HEIGHt + CHOICE_HEIGHT
|
OPTIONS=() # adds lines to HEIGHt + CHOICE_HEIGHT
|
||||||
|
|
||||||
OPTIONS+=(${network}LOG "Monitor the debug.log")
|
OPTIONS+=(${network}LOG "Monitor the debug.log for ${CHAIN}")
|
||||||
OPTIONS+=(${network}CONF "Edit the bitcoin.conf")
|
OPTIONS+=(${network}CONF "Edit the bitcoin.conf")
|
||||||
OPTIONS+=(LNDLOG "Monitor the lnd.log")
|
|
||||||
OPTIONS+=(LNDCONF "Edit the lnd.conf")
|
|
||||||
|
|
||||||
if [ "${runBehindTor}" == "on" ]; then
|
if grep "^${netprefix}lnd=on" /mnt/hdd/raspiblitz.conf;then
|
||||||
|
OPTIONS+=(LNDLOG "Monitor the lnd.log for ${CHAIN}")
|
||||||
|
OPTIONS+=(LNDCONF "Edit the lnd.conf for ${CHAIN}")
|
||||||
|
fi
|
||||||
|
|
||||||
|
if grep "^${netprefix}cl=on" /mnt/hdd/raspiblitz.conf;then
|
||||||
|
OPTIONS+=(CLLOG "Monitor the CL log for ${CHAIN}")
|
||||||
|
OPTIONS+=(CLCONF "Edit the CL config for ${CHAIN}")
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${runBehindTor}" == "on" ] && [ "${netprefix}" == "" ]; then
|
||||||
OPTIONS+=(TORLOG "Monitor the Tor Service with Nyx")
|
OPTIONS+=(TORLOG "Monitor the Tor Service with Nyx")
|
||||||
OPTIONS+=(TORRC "Edit the Tor Configuration")
|
OPTIONS+=(TORRC "Edit the Tor Configuration")
|
||||||
HEIGHT=$((HEIGHT+2))
|
|
||||||
CHOICE_HEIGHT=$((CHOICE_HEIGHT+2))
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
OPTIONS+=(CUSTOMLOG "Monitor a custom service")
|
OPTIONS+=(CUSTOMLOG "Monitor a custom service")
|
||||||
OPTIONS+=(CUSTOMRESTART "Restart a custom service")
|
OPTIONS+=(CUSTOMRESTART "Restart a custom service")
|
||||||
|
|
||||||
|
CHOICE_HEIGHT=$(("${#OPTIONS[@]}/2+1"))
|
||||||
|
HEIGHT=$((CHOICE_HEIGHT+6))
|
||||||
CHOICE=$(dialog --clear \
|
CHOICE=$(dialog --clear \
|
||||||
--backtitle "$BACKTITLE" \
|
--backtitle "$BACKTITLE" \
|
||||||
--title "$TITLE" \
|
--title "$TITLE" \
|
||||||
|
@ -39,26 +50,33 @@ CHOICE=$(dialog --clear \
|
||||||
|
|
||||||
case $CHOICE in
|
case $CHOICE in
|
||||||
${network}LOG)
|
${network}LOG)
|
||||||
|
if [ ${CHAIN} = signet ]; then
|
||||||
|
bitcoinlogpath="/mnt/hdd/bitcoin/signet/debug.log"
|
||||||
|
elif [ ${CHAIN} = testnet ]; then
|
||||||
|
bitcoinlogpath="/mnt/hdd/bitcoin/testnet3/debug.log"
|
||||||
|
elif [ ${CHAIN} = mainnet ]; then
|
||||||
|
bitcoinlogpath="/mnt/hdd/bitcoin/debug.log"
|
||||||
|
fi
|
||||||
clear
|
clear
|
||||||
echo
|
echo
|
||||||
echo "Will follow the /mnt/hdd/${network}/debug.log"
|
echo "Will follow the ${bitcoinlogpath}"
|
||||||
echo "running: 'sudo tail -n 30 -f /mnt/hdd/${network}/debug.log'"
|
echo "running: 'sudo tail -n 30 -f ${bitcoinlogpath}'"
|
||||||
echo
|
echo
|
||||||
echo "Press ENTER to continue"
|
echo "Press ENTER to continue"
|
||||||
echo "use CTRL+C any time to abort .. then use command 'raspiblitz' to return to menu"
|
echo "use CTRL+C any time to abort .. then use command 'raspiblitz' to return to menu"
|
||||||
echo "###############################################################################"
|
echo "###############################################################################"
|
||||||
read key
|
read key
|
||||||
sudo tail -n 30 -f /mnt/hdd/${network}/debug.log;;
|
sudo tail -n 30 -f ${bitcoinlogpath};;
|
||||||
${network}CONF)
|
${network}CONF)
|
||||||
if /home/admin/config.scripts/blitz.setconf.sh "/mnt/hdd/${network}/${network}.conf" "root"
|
if /home/admin/config.scripts/blitz.setconf.sh "/mnt/hdd/${network}/${network}.conf" "root"
|
||||||
then
|
then
|
||||||
whiptail \
|
whiptail \
|
||||||
--title "Restart" --yes-button "Restart" --no-button "Not now" \
|
--title "Restart" --yes-button "Restart" --no-button "Not now" \
|
||||||
--yesno "To apply the new settings ${network}d needs to restart.
|
--yesno "To apply the new settings ${netprefix}${network}d needs to restart.
|
||||||
Do you want to restart ${network}d now?" 10 55
|
Do you want to restart ${netprefix}${network}d now?" 10 55
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
echo "# Restarting ${network}d"
|
echo "# Restarting ${netprefix}${network}d"
|
||||||
sudo systemctl restart ${network}d
|
sudo systemctl restart ${netprefix}${network}d
|
||||||
else
|
else
|
||||||
echo "# Continue without restarting."
|
echo "# Continue without restarting."
|
||||||
fi
|
fi
|
||||||
|
@ -77,7 +95,7 @@ case $CHOICE in
|
||||||
read key
|
read key
|
||||||
sudo tail -n 30 -f /mnt/hdd/lnd/logs/${network}/${chain}net/lnd.log;;
|
sudo tail -n 30 -f /mnt/hdd/lnd/logs/${network}/${chain}net/lnd.log;;
|
||||||
LNDCONF)
|
LNDCONF)
|
||||||
if /home/admin/config.scripts/blitz.setconf.sh "/mnt/hdd/lnd/lnd.conf" "root"
|
if /home/admin/config.scripts/blitz.setconf.sh "/mnt/hdd/lnd/${netprefix}lnd.conf" "root"
|
||||||
then
|
then
|
||||||
whiptail \
|
whiptail \
|
||||||
--title "Restart" --yes-button "Restart" --no-button "Not now" \
|
--title "Restart" --yes-button "Restart" --no-button "Not now" \
|
||||||
|
@ -85,25 +103,52 @@ case $CHOICE in
|
||||||
Do you want to restart LND now?" 10 55
|
Do you want to restart LND now?" 10 55
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
echo "# Restarting LND"
|
echo "# Restarting LND"
|
||||||
sudo systemctl restart lnd
|
sudo systemctl restart ${netprefix}lnd
|
||||||
else
|
else
|
||||||
echo "# Continue without restarting."
|
echo "# Continue without restarting."
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "# No change made"
|
echo "# No change made"
|
||||||
fi;;
|
fi;;
|
||||||
|
CLLOG)
|
||||||
|
clear
|
||||||
|
echo
|
||||||
|
echo "Will follow the /home/bitcoin/.lightning/${CLNETWORK}/cl.log"
|
||||||
|
echo "running 'sudo tail -n 30 -f /home/bitcoin/.lightning/${CLNETWORK}/cl.log'"
|
||||||
|
echo
|
||||||
|
echo "Press ENTER to continue"
|
||||||
|
echo "use CTRL+C any time to abort .. then use command 'raspiblitz' to return to menu"
|
||||||
|
echo "###############################################################################"
|
||||||
|
read key
|
||||||
|
sudo tail -n 30 -f /home/bitcoin/.lightning/${CLNETWORK}/cl.log;;
|
||||||
|
CLCONF)
|
||||||
|
if /home/admin/config.scripts/blitz.setconf.sh "${CLCONF}" "root"
|
||||||
|
then
|
||||||
|
whiptail \
|
||||||
|
--title "Restart" --yes-button "Restart" --no-button "Not now" \
|
||||||
|
--yesno "To apply the new settings C-lightning needs to restart.
|
||||||
|
Do you want to restart C-lightning now?" 0 0
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "# Restarting C-lightning"
|
||||||
|
sudo systemctl restart ${netprefix}lightningd
|
||||||
|
else
|
||||||
|
echo "# Continue without restarting."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "# No change made"
|
||||||
|
fi;;
|
||||||
TORLOG)
|
TORLOG)
|
||||||
sudo -u debian-tor nyx;;
|
sudo -u debian-tor nyx;;
|
||||||
TORRC)
|
TORRC)
|
||||||
if /home/admin/config.scripts/blitz.setconf.sh "/etc/tor/torrc" "debian-tor"
|
if /home/admin/config.scripts/blitz.setconf.sh "/etc/tor/torrc" "debian-tor"
|
||||||
then
|
then
|
||||||
whiptail \
|
whiptail \
|
||||||
--title "Restart" --yes-button "Restart" --no-button "Not now" \
|
--title "Reload" --yes-button "Reload" --no-button "Not now" \
|
||||||
--yesno "To apply the new settings Tor needs to restart.
|
--yesno "To apply the new settings need to reload Tor.
|
||||||
Do you want to restart Tor now?" 10 55
|
Do you want to restart Tor now?" 10 55
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
echo "# Restarting tor"
|
echo "# Restarting tor"
|
||||||
sudo systemctl restart tor@default
|
sudo systemctl reload tor@default
|
||||||
else
|
else
|
||||||
echo "# Continue without restarting."
|
echo "# Continue without restarting."
|
||||||
fi
|
fi
|
||||||
|
@ -115,9 +160,9 @@ case $CHOICE in
|
||||||
echo
|
echo
|
||||||
echo "Example list:
|
echo "Example list:
|
||||||
btc-rpc-explorer, btcpayserver, circuitbreaker,
|
btc-rpc-explorer, btcpayserver, circuitbreaker,
|
||||||
cryptoadvance-specter, getty@tty1, electrs, litd,
|
specter, getty@tty1, electrs, litd,
|
||||||
lnbits, mempool, nbxlorer, nginx, RTL, telegraf,
|
lnbits, mempool, nbxlorer, nginx, RTL, telegraf,
|
||||||
thunderhub, tor@default, tor@lnd, tor
|
thunderhub, tor@default, tor
|
||||||
"
|
"
|
||||||
echo "Type the name of the service you would like to monitor:"
|
echo "Type the name of the service you would like to monitor:"
|
||||||
read SERVICE
|
read SERVICE
|
||||||
|
@ -133,9 +178,9 @@ thunderhub, tor@default, tor@lnd, tor
|
||||||
echo
|
echo
|
||||||
echo "Example list:
|
echo "Example list:
|
||||||
btc-rpc-explorer, btcpayserver, circuitbreaker,
|
btc-rpc-explorer, btcpayserver, circuitbreaker,
|
||||||
cryptoadvance-specter, getty@tty1, electrs, litd,
|
specter, getty@tty1, electrs, litd,
|
||||||
lnbits, mempool, nbxlorer, nginx, RTL, telegraf,
|
lnbits, mempool, nbxlorer, nginx, RTL, telegraf,
|
||||||
thunderhub, tor@default, tor@lnd, tor
|
thunderhub, tor@default, tor
|
||||||
"
|
"
|
||||||
echo "Type the name of the service you would like to restart:"
|
echo "Type the name of the service you would like to restart:"
|
||||||
read SERVICE
|
read SERVICE
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# load raspiblitz config data
|
# load raspiblitz config data
|
||||||
source /home/admin/raspiblitz.info
|
|
||||||
source /mnt/hdd/raspiblitz.conf
|
|
||||||
source /home/admin/_version.info
|
source /home/admin/_version.info
|
||||||
|
source /home/admin/raspiblitz.info
|
||||||
|
source /mnt/hdd/raspiblitz.conf 2>/dev/null
|
||||||
|
|
||||||
## PROCEDURES
|
## PROCEDURES
|
||||||
|
|
||||||
|
@ -21,35 +21,51 @@ No need to close channels or download blockchain again.
|
||||||
Do you want to start the Update now?
|
Do you want to start the Update now?
|
||||||
" 16 62
|
" 16 62
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
exit 1
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
whiptail --title "LND Data Backup" --yes-button "Download Backup" --no-button "Skip" --yesno "
|
if [ "${lightning}" != "" ]; then
|
||||||
Before we start the RaspiBlitz Update process,
|
|
||||||
its recommended to make a backup of all your LND Data
|
|
||||||
and download that file to your laptop.
|
|
||||||
|
|
||||||
Do you want to download LND Data Backup now?
|
whiptail --title "Lightning Data Backup" --yes-button "Download Backup" --no-button "Skip" --yesno "
|
||||||
|
Before we start the RaspiBlitz Update process,
|
||||||
|
its recommended to make a backup of all your Lightning
|
||||||
|
Channel Data and download that file to your laptop.
|
||||||
|
|
||||||
|
Do you want to download Lightning Data Backup now?
|
||||||
" 12 58
|
" 12 58
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
clear
|
clear
|
||||||
echo "*************************************"
|
echo "*************************************"
|
||||||
echo "* PREPARING LND BACKUP DOWNLOAD"
|
echo "* PREPARING LIGHTNING BACKUP DOWNLOAD"
|
||||||
echo "*************************************"
|
echo "*************************************"
|
||||||
echo "please wait .."
|
echo "please wait .."
|
||||||
sleep 2
|
sleep 2
|
||||||
/home/admin/config.scripts/lnd.rescue.sh backup
|
if [ "${lightning}" == "lnd" ]; then
|
||||||
echo
|
/home/admin/config.scripts/lnd.backup.sh lnd-export-gui
|
||||||
echo "PRESS ENTER to continue once you're done downloading."
|
elif [ "${lightning}" == "cl" ]; then
|
||||||
read key
|
/home/admin/config.scripts/cl.backup.sh cl-export-gui
|
||||||
else
|
else
|
||||||
clear
|
echo "TODO: Implement Data Backup for '${lightning}'"
|
||||||
echo "*************************************"
|
fi
|
||||||
echo "* JUST MAKING BACKUP TO OLD SD CARD"
|
echo
|
||||||
echo "*************************************"
|
echo "PRESS ENTER to continue once you're done downloading."
|
||||||
echo "please wait .."
|
read key
|
||||||
sleep 2
|
else
|
||||||
/home/admin/config.scripts/lnd.rescue.sh backup no-download
|
clear
|
||||||
|
echo "*************************************"
|
||||||
|
echo "* JUST MAKING BACKUP TO OLD SD CARD"
|
||||||
|
echo "*************************************"
|
||||||
|
echo "please wait .."
|
||||||
|
sleep 2
|
||||||
|
if [ "${lightning}" == "lnd" ]; then
|
||||||
|
/home/admin/config.scripts/lnd.backup.sh lnd-export
|
||||||
|
elif [ "${lightning}" == "cl" ]; then
|
||||||
|
/home/admin/config.scripts/cl.backup.sh cl-export
|
||||||
|
else
|
||||||
|
echo "TODO: Implement Data Backup for '${lightning}'"
|
||||||
|
sleep 3
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
whiptail --title "READY TO UPDATE?" --yes-button "START UPDATE" --no-button "Cancel" --yesno "If you start the update: The RaspiBlitz will power down.
|
whiptail --title "READY TO UPDATE?" --yes-button "START UPDATE" --no-button "Cancel" --yesno "If you start the update: The RaspiBlitz will power down.
|
||||||
|
@ -68,8 +84,9 @@ and do you WANT TO START UPDATE NOW?
|
||||||
dialog --title " Update Canceled " --msgbox "
|
dialog --title " Update Canceled " --msgbox "
|
||||||
OK. RaspiBlitz will NOT update now.
|
OK. RaspiBlitz will NOT update now.
|
||||||
" 7 39
|
" 7 39
|
||||||
sudo systemctl start lnd
|
sudo systemctl start lnd 2>/dev/null
|
||||||
exit 1
|
sudo systemctl start lightningd 2>/dev/null
|
||||||
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
clear
|
clear
|
||||||
|
@ -93,7 +110,7 @@ hotfix the code and might compromise your security.
|
||||||
Do you want to Patch your RaspiBlitz now?
|
Do you want to Patch your RaspiBlitz now?
|
||||||
" 18 58
|
" 18 58
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
exit 1
|
exit 0
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,7 +118,7 @@ patch()
|
||||||
{
|
{
|
||||||
|
|
||||||
# get sync info
|
# get sync info
|
||||||
source <(sudo /home/admin/XXsyncScripts.sh info)
|
source <(sudo /home/admin/config.scripts/blitz.github.sh info)
|
||||||
|
|
||||||
# Patch Options
|
# Patch Options
|
||||||
OPTIONS=(PATCH "Patch/Sync RaspiBlitz with GitHub Repo" \
|
OPTIONS=(PATCH "Patch/Sync RaspiBlitz with GitHub Repo" \
|
||||||
|
@ -115,7 +132,7 @@ patch()
|
||||||
clear
|
clear
|
||||||
case $CHOICE in
|
case $CHOICE in
|
||||||
PATCH)
|
PATCH)
|
||||||
sudo -u admin /home/admin/XXsyncScripts.sh -run
|
sudo -u admin /home/admin/config.scripts/blitz.github.sh -run
|
||||||
sleep 4
|
sleep 4
|
||||||
whiptail --title " Patching/Syncing " --yes-button "Reboot" --no-button "Skip Reboot" --yesno " OK patching/syncing done.
|
whiptail --title " Patching/Syncing " --yes-button "Reboot" --no-button "Skip Reboot" --yesno " OK patching/syncing done.
|
||||||
|
|
||||||
|
@ -126,12 +143,13 @@ patch()
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
clear
|
clear
|
||||||
echo "REBOOT .."
|
echo "REBOOT .."
|
||||||
/home/admin/XXshutdown.sh reboot
|
/home/admin/config.scripts/blitz.shutdown.sh reboot
|
||||||
sleep 8
|
sleep 8
|
||||||
|
exit 1
|
||||||
else
|
else
|
||||||
echo "SKIP REBOOT .."
|
echo "SKIP REBOOT .."
|
||||||
|
exit 0
|
||||||
fi
|
fi
|
||||||
exit 1
|
|
||||||
;;
|
;;
|
||||||
REPO)
|
REPO)
|
||||||
clear
|
clear
|
||||||
|
@ -142,13 +160,13 @@ patch()
|
||||||
newGitHubUser=$(echo "${newGitHubUser}" | cut -d " " -f1)
|
newGitHubUser=$(echo "${newGitHubUser}" | cut -d " " -f1)
|
||||||
echo "--> " ${newGitHubUser}
|
echo "--> " ${newGitHubUser}
|
||||||
error=""
|
error=""
|
||||||
source <(sudo -u admin /home/admin/XXsyncScripts.sh -clean ${activeBranch} ${newGitHubUser})
|
source <(sudo -u admin /home/admin/config.scripts/blitz.github.sh -clean ${activeBranch} ${newGitHubUser})
|
||||||
if [ ${#error} -gt 0 ]; then
|
if [ ${#error} -gt 0 ]; then
|
||||||
whiptail --title "ERROR" --msgbox "${error}" 8 30
|
whiptail --title "ERROR" --msgbox "${error}" 8 30
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
patch
|
patch
|
||||||
exit 1
|
exit 0
|
||||||
;;
|
;;
|
||||||
BRANCH)
|
BRANCH)
|
||||||
clear
|
clear
|
||||||
|
@ -159,13 +177,13 @@ patch()
|
||||||
newGitHubBranch=$(echo "${newGitHubBranch}" | cut -d " " -f1)
|
newGitHubBranch=$(echo "${newGitHubBranch}" | cut -d " " -f1)
|
||||||
echo "--> " $newGitHubBranch
|
echo "--> " $newGitHubBranch
|
||||||
error=""
|
error=""
|
||||||
source <(sudo -u admin /home/admin/XXsyncScripts.sh ${newGitHubBranch})
|
source <(sudo -u admin /home/admin/config.scripts/blitz.github.sh ${newGitHubBranch})
|
||||||
if [ ${#error} -gt 0 ]; then
|
if [ ${#error} -gt 0 ]; then
|
||||||
whiptail --title "ERROR" --msgbox "${error}" 8 30
|
whiptail --title "ERROR" --msgbox "${error}" 8 30
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
patch
|
patch
|
||||||
exit 1
|
exit 0
|
||||||
;;
|
;;
|
||||||
PR)
|
PR)
|
||||||
clear
|
clear
|
||||||
|
@ -178,15 +196,15 @@ patch()
|
||||||
cd /home/admin/raspiblitz
|
cd /home/admin/raspiblitz
|
||||||
git fetch origin pull/${pullRequestID}/head:pr${pullRequestID}
|
git fetch origin pull/${pullRequestID}/head:pr${pullRequestID}
|
||||||
error=""
|
error=""
|
||||||
source <(sudo -u admin /home/admin/XXsyncScripts.sh pr${pullRequestID})
|
source <(sudo -u admin /home/admin/config.scripts/blitz.github.sh pr${pullRequestID})
|
||||||
if [ ${#error} -gt 0 ]; then
|
if [ ${#error} -gt 0 ]; then
|
||||||
whiptail --title "ERROR" --msgbox "${error}" 8 30
|
whiptail --title "ERROR" --msgbox "${error}" 8 30
|
||||||
else
|
else
|
||||||
echo "# update installs .."
|
echo "# update installs .."
|
||||||
/home/admin/XXsyncScripts.sh -justinstall
|
/home/admin/config.scripts/blitz.github.sh -justinstall
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
exit 1
|
exit 0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
@ -212,7 +230,7 @@ lnd()
|
||||||
VERIFIED)
|
VERIFIED)
|
||||||
if [ ${lndUpdateInstalled} -eq 1 ]; then
|
if [ ${lndUpdateInstalled} -eq 1 ]; then
|
||||||
whiptail --title "ALREADY INSTALLED" --msgbox "The LND version ${lndUpdateVersion} is already installed." 8 30
|
whiptail --title "ALREADY INSTALLED" --msgbox "The LND version ${lndUpdateVersion} is already installed." 8 30
|
||||||
exit 1
|
exit 0
|
||||||
fi
|
fi
|
||||||
whiptail --title "OPTIONAL LND UPDATE" --yes-button "Cancel" --no-button "Update" --yesno "BEWARE on updating to LND v${lndUpdateVersion}:
|
whiptail --title "OPTIONAL LND UPDATE" --yes-button "Cancel" --no-button "Update" --yesno "BEWARE on updating to LND v${lndUpdateVersion}:
|
||||||
|
|
||||||
|
@ -222,7 +240,7 @@ Do you really want to update LND now?
|
||||||
" 16 58
|
" 16 58
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
echo "# cancel update"
|
echo "# cancel update"
|
||||||
exit 1
|
exit 0
|
||||||
fi
|
fi
|
||||||
# if loop is installed remove
|
# if loop is installed remove
|
||||||
if [ "${loop}" == "on" ]; then
|
if [ "${loop}" == "on" ]; then
|
||||||
|
@ -238,7 +256,7 @@ Do you really want to update LND now?
|
||||||
if [ "${loop}" == "on" ]; then
|
if [ "${loop}" == "on" ]; then
|
||||||
sudo -u admin /home/admin/config.scripts/bonus.loop.sh on
|
sudo -u admin /home/admin/config.scripts/bonus.loop.sh on
|
||||||
fi
|
fi
|
||||||
/home/admin/XXshutdown.sh reboot
|
/home/admin/config.scripts/blitz.shutdown.sh reboot
|
||||||
sleep 8
|
sleep 8
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
@ -255,20 +273,89 @@ Do you really want to update LND now?
|
||||||
" 16 58
|
" 16 58
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
echo "# cancel update"
|
echo "# cancel update"
|
||||||
exit 1
|
exit 0
|
||||||
fi
|
fi
|
||||||
error=""
|
error=""
|
||||||
source <(sudo -u admin /home/admin/config.scripts/lnd.update.sh reckless)
|
source <(sudo -u admin /home/admin/config.scripts/lnd.update.sh reckless)
|
||||||
if [ ${#error} -gt 0 ]; then
|
if [ ${#error} -gt 0 ]; then
|
||||||
whiptail --title "ERROR" --msgbox "${error}" 8 30
|
whiptail --title "ERROR" --msgbox "${error}" 8 30
|
||||||
else
|
else
|
||||||
/home/admin/XXshutdown.sh reboot
|
/home/admin/config.scripts/blitz.shutdown.sh reboot
|
||||||
sleep 8
|
sleep 8
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cl()
|
||||||
|
{
|
||||||
|
|
||||||
|
# get cl info
|
||||||
|
source <(sudo -u admin /home/admin/config.scripts/cl.update.sh info)
|
||||||
|
|
||||||
|
# C-lightning Update Options
|
||||||
|
OPTIONS=()
|
||||||
|
if [ ${clUpdateInstalled} -eq 0 ]; then
|
||||||
|
OPTIONS+=(VERIFIED "Optional C-lightning update to ${clUpdateVersion}")
|
||||||
|
fi
|
||||||
|
OPTIONS+=(RECKLESS "Experimental C-lightning update to ${clLatestVersion}")
|
||||||
|
|
||||||
|
CHOICE=$(whiptail --clear --title "Update C-lightning Options" --menu "" 9 60 2 "${OPTIONS[@]}" 2>&1 >/dev/tty)
|
||||||
|
|
||||||
|
clear
|
||||||
|
case $CHOICE in
|
||||||
|
VERIFIED)
|
||||||
|
if [ ${clUpdateInstalled} -eq 1 ]; then
|
||||||
|
whiptail --title "ALREADY INSTALLED" --msgbox "The C-lightning version ${clUpdateVersion} is already installed." 8 30
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
whiptail --title "OPTIONAL C-lightning UPDATE" --yes-button "Cancel" --no-button "Update" --yesno "BEWARE on updating to C-lightning v${clUpdateVersion}:
|
||||||
|
|
||||||
|
${clUpdateComment}
|
||||||
|
|
||||||
|
Do you really want to update C-lightning now?
|
||||||
|
" 16 58
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "# cancel update"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
error=""
|
||||||
|
warn=""
|
||||||
|
source <(sudo -u admin /home/admin/config.scripts/cl.update.sh verified)
|
||||||
|
if [ ${#error} -gt 0 ]; then
|
||||||
|
whiptail --title "ERROR" --msgbox "${error}" 8 30
|
||||||
|
else
|
||||||
|
echo "# C-lightning was updated successfully"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
RECKLESS)
|
||||||
|
whiptail --title "RECKLESS C-lightning UPDATE to ${clLatestVersion}" --yes-button "Cancel" --no-button "Update" --yesno "Using the 'RECKLESS' C-lightning update will simply
|
||||||
|
grab the latest C-lightning release published on the C-lightning GitHub page (also release candidates).
|
||||||
|
|
||||||
|
There will be no security checks on signature, etc.
|
||||||
|
|
||||||
|
This update mode is only recommended for testing and
|
||||||
|
development nodes with no serious funding.
|
||||||
|
|
||||||
|
Do you really want to update C-lightning now?
|
||||||
|
" 16 58
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "# cancel update"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
error=""
|
||||||
|
source <(sudo -u admin /home/admin/config.scripts/cl.update.sh reckless)
|
||||||
|
if [ ${#error} -gt 0 ]; then
|
||||||
|
whiptail --title "ERROR" --msgbox "${error}" 8 30
|
||||||
|
else
|
||||||
|
echo "# C-lightning was updated successfully"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
bitcoinUpdate() {
|
bitcoinUpdate() {
|
||||||
# get bitcoin info
|
# get bitcoin info
|
||||||
source <(sudo -u admin /home/admin/config.scripts/bitcoin.update.sh info)
|
source <(sudo -u admin /home/admin/config.scripts/bitcoin.update.sh info)
|
||||||
|
@ -296,7 +383,7 @@ bitcoinUpdate() {
|
||||||
if [ ${bitcoinUpdateInstalled} -eq 1 ]; then
|
if [ ${bitcoinUpdateInstalled} -eq 1 ]; then
|
||||||
whiptail --title "ALREADY INSTALLED" \
|
whiptail --title "ALREADY INSTALLED" \
|
||||||
--msgbox "The Bitcoin Core version ${bitcoinUpdateVersion} is already installed." 8 30
|
--msgbox "The Bitcoin Core version ${bitcoinUpdateVersion} is already installed." 8 30
|
||||||
exit 1
|
exit 0
|
||||||
fi
|
fi
|
||||||
whiptail --title "OPTIONAL Bitcoin Core update" --yes-button "Cancel" --no-button "Update" \
|
whiptail --title "OPTIONAL Bitcoin Core update" --yes-button "Cancel" --no-button "Update" \
|
||||||
--yesno "Info on updating to Bitcoin Core v${bitcoinVersion}:
|
--yesno "Info on updating to Bitcoin Core v${bitcoinVersion}:
|
||||||
|
@ -308,7 +395,7 @@ Do you really want to update Bitcoin Core now?
|
||||||
" 12 58
|
" 12 58
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
echo "# cancel update"
|
echo "# cancel update"
|
||||||
exit 1
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
error=""
|
error=""
|
||||||
|
@ -332,7 +419,7 @@ Do you really want to update Bitcoin Core now?
|
||||||
" 16 58
|
" 16 58
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
echo "# cancel update"
|
echo "# cancel update"
|
||||||
exit 1
|
exit 0
|
||||||
fi
|
fi
|
||||||
error=""
|
error=""
|
||||||
source <(sudo -u admin /home/admin/config.scripts/bitcoin.update.sh reckless)
|
source <(sudo -u admin /home/admin/config.scripts/bitcoin.update.sh reckless)
|
||||||
|
@ -355,58 +442,53 @@ if [ "$1" == "github" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Basic Options Menu
|
# Basic Options Menu
|
||||||
HEIGHT=10 # add 6 to CHOICE_HEIGHT + MENU lines
|
|
||||||
WIDTH=55
|
WIDTH=55
|
||||||
CHOICE_HEIGHT=4 # 1 line / OPTIONS
|
OPTIONS=()
|
||||||
OPTIONS=(
|
OPTIONS+=(RELEASE "RaspiBlitz Release Update/Recovery")
|
||||||
RELEASE "RaspiBlitz Release Update/Recovery"
|
OPTIONS+=(PATCH "Patch RaspiBlitz v${codeVersion}")
|
||||||
PATCH "Patch RaspiBlitz v${codeVersion}"
|
OPTIONS+=(BITCOIN "Bitcoin Core Update Options")
|
||||||
LND "Interim LND Update Options"
|
|
||||||
BITCOIN "Bitcoin Core Update Options"
|
if [ "${lightning}" == "lnd" ] || [ "${lnd}" == "on" ]; then
|
||||||
)
|
OPTIONS+=(LND "Interim LND Update Options")
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${lightning}" == "cl" ] || [ "${cl}" == "on" ]; then
|
||||||
|
OPTIONS+=(CL "Interim C-lightning Update Options")
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "${bos}" == "on" ]; then
|
if [ "${bos}" == "on" ]; then
|
||||||
OPTIONS+=(BOS "Update Balance of Satoshis")
|
OPTIONS+=(BOS "Update Balance of Satoshis")
|
||||||
HEIGHT=$((HEIGHT+1))
|
|
||||||
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${thunderhub}" == "on" ]; then
|
if [ "${thunderhub}" == "on" ]; then
|
||||||
OPTIONS+=(THUB "Update ThunderHub")
|
OPTIONS+=(THUB "Update ThunderHub")
|
||||||
HEIGHT=$((HEIGHT+1))
|
|
||||||
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${specter}" == "on" ]; then
|
if [ "${specter}" == "on" ]; then
|
||||||
OPTIONS+=(SPECTER "Update Cryptoadvance Specter")
|
OPTIONS+=(SPECTER "Update Specter Desktop")
|
||||||
HEIGHT=$((HEIGHT+1))
|
|
||||||
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
|
|
||||||
fi
|
|
||||||
if [ "${rtlWebinterface}" == "on" ]; then
|
|
||||||
OPTIONS+=(RTL "Update RTL")
|
|
||||||
HEIGHT=$((HEIGHT+1))
|
|
||||||
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${sphinxrelay}" == "on" ]; then
|
if [ "${sphinxrelay}" == "on" ]; then
|
||||||
OPTIONS+=(SPHINX "Update Sphinx Server Relay")
|
OPTIONS+=(SPHINX "Update Sphinx Server Relay")
|
||||||
HEIGHT=$((HEIGHT+1))
|
|
||||||
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${pyblock}" == "on" ]; then
|
if [ "${pyblock}" == "on" ]; then
|
||||||
OPTIONS+=(PYBLOCK "Update PyBLOCK")
|
OPTIONS+=(PYBLOCK "Update PyBLOCK")
|
||||||
HEIGHT=$((HEIGHT+1))
|
|
||||||
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${mempoolExplorer}" == "on" ]; then
|
if [ "${mempoolExplorer}" == "on" ]; then
|
||||||
OPTIONS+=(MEMPOOL "Update Mempool Explorer")
|
OPTIONS+=(MEMPOOL "Update Mempool Explorer")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${runBehindTor}" == "on" ]; then
|
if [ "${runBehindTor}" == "on" ]; then
|
||||||
OPTIONS+=(TOR "Update Tor from the source code")
|
OPTIONS+=(TOR "Update Tor from the source code")
|
||||||
HEIGHT=$((HEIGHT+1))
|
|
||||||
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
CHOICE_HEIGHT=$(("${#OPTIONS[@]}/2+1"))
|
||||||
|
HEIGHT=$((CHOICE_HEIGHT+6))
|
||||||
CHOICE=$(dialog --clear \
|
CHOICE=$(dialog --clear \
|
||||||
--backtitle "" \
|
--backtitle "" \
|
||||||
--title "Update Options" \
|
--title " Update Options " \
|
||||||
--ok-label "Select" \
|
--ok-label "Select" \
|
||||||
--cancel-label "Main menu" \
|
--cancel-label "Main menu" \
|
||||||
--menu "" \
|
--menu "" \
|
||||||
|
@ -424,6 +506,9 @@ case $CHOICE in
|
||||||
LND)
|
LND)
|
||||||
lnd
|
lnd
|
||||||
;;
|
;;
|
||||||
|
CL)
|
||||||
|
cl
|
||||||
|
;;
|
||||||
BITCOIN)
|
BITCOIN)
|
||||||
bitcoinUpdate
|
bitcoinUpdate
|
||||||
;;
|
;;
|
||||||
|
@ -434,10 +519,7 @@ case $CHOICE in
|
||||||
/home/admin/config.scripts/bonus.thunderhub.sh update
|
/home/admin/config.scripts/bonus.thunderhub.sh update
|
||||||
;;
|
;;
|
||||||
SPECTER)
|
SPECTER)
|
||||||
/home/admin/config.scripts/bonus.cryptoadvance-specter.sh update
|
/home/admin/config.scripts/bonus.specter.sh update
|
||||||
;;
|
|
||||||
RTL)
|
|
||||||
/home/admin/config.scripts/bonus.rtl.sh update
|
|
||||||
;;
|
;;
|
||||||
SPHINX)
|
SPHINX)
|
||||||
/home/admin/config.scripts/bonus.sphinxrelay.sh update
|
/home/admin/config.scripts/bonus.sphinxrelay.sh update
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# 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
|
|
||||||
|
|
||||||
clear
|
|
||||||
echo ""
|
|
||||||
echo "****************************************************************************"
|
|
||||||
echo "Unlock LND Wallet --> lncli --chain=${network} unlock"
|
|
||||||
echo "****************************************************************************"
|
|
||||||
echo "HELP: Enter your PASSWORD C"
|
|
||||||
echo "You may wait some seconds until you get asked for password."
|
|
||||||
echo "****************************************************************************"
|
|
||||||
while :
|
|
||||||
do
|
|
||||||
sudo -u bitcoin /usr/local/bin/lncli --chain=${network} unlock
|
|
||||||
sleep 4
|
|
||||||
locked=$(sudo tail -n 1 /mnt/hdd/lnd/logs/${network}/${chain}net/lnd.log 2>/dev/null | grep -c unlock)
|
|
||||||
if [ ${locked} -eq 0 ]; then
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "network(${network}) chain(${chain})"
|
|
||||||
sudo tail -n 1 /mnt/hdd/lnd/logs/${network}/${chain}net/lnd.log
|
|
||||||
echo "Wallet still locked - please try again or"
|
|
||||||
echo "Cancel with CTRL+C - back to setup with command: raspiblitz"
|
|
||||||
done
|
|
|
@ -1,4 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
trap 'rm -f "$_temp"' EXIT
|
||||||
|
trap 'rm -f "$_error"' EXIT
|
||||||
_temp=$(mktemp -p /dev/shm/)
|
_temp=$(mktemp -p /dev/shm/)
|
||||||
_error=$(mktemp -p /dev/shm/)
|
_error=$(mktemp -p /dev/shm/)
|
||||||
|
|
||||||
|
@ -7,40 +9,59 @@ echo "please wait ..."
|
||||||
# load raspiblitz config data (with backup from old config)
|
# load raspiblitz config data (with backup from old config)
|
||||||
source /home/admin/raspiblitz.info
|
source /home/admin/raspiblitz.info
|
||||||
source /mnt/hdd/raspiblitz.conf
|
source /mnt/hdd/raspiblitz.conf
|
||||||
if [ ${#network} -eq 0 ]; then network=`cat .network`; fi
|
if [ ${#network} -eq 0 ]; then network=$(cat .network); fi
|
||||||
if [ ${#network} -eq 0 ]; then network="bitcoin"; fi
|
if [ ${#network} -eq 0 ]; then network="bitcoin"; fi
|
||||||
if [ ${#chain} -eq 0 ]; then
|
if [ ${#chain} -eq 0 ]; then
|
||||||
chain=$(${network}-cli -datadir=/home/bitcoin/.${network} getblockchaininfo | jq -r '.chain')
|
chain=$($bitcoincli_alias getblockchaininfo | jq -r '.chain')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
source <(/home/admin/config.scripts/network.aliases.sh getvars $1 $2)
|
||||||
|
|
||||||
# check if user has money in lightning channels - info about close all
|
# check if user has money in lightning channels - info about close all
|
||||||
openChannels=$(lncli --chain=${network} --network=${chain}net listchannels 2>/dev/null | jq '.[] | length')
|
if [ $LNTYPE = cl ];then
|
||||||
|
ln_getInfo=$($lightningcli_alias getinfo 2>/dev/null)
|
||||||
|
ln_channels_online="$(echo "${ln_getInfo}" | jq -r '.num_active_channels')" 2>/dev/null
|
||||||
|
cl_num_inactive_channels="$(echo "${ln_getInfo}" | jq -r '.num_inactive_channels')" 2>/dev/null
|
||||||
|
openChannels=$((ln_channels_online+cl_num_inactive_channels))
|
||||||
|
elif [ $LNTYPE = lnd ];then
|
||||||
|
openChannels=$($lncli_alias listchannels 2>/dev/null | jq '.[] | length')
|
||||||
|
fi
|
||||||
if [ ${#openChannels} -eq 0 ]; then
|
if [ ${#openChannels} -eq 0 ]; then
|
||||||
clear
|
clear
|
||||||
echo "*** IMPORTANT **********************************"
|
echo "*** IMPORTANT **********************************"
|
||||||
echo "It looks like LND is not responding."
|
echo "It looks like $LNTYPE is not responding."
|
||||||
echo "Still starting up, is locked or is not running?"
|
echo "Still starting up, is locked or is not running?"
|
||||||
echo "Try later, try reboot or check ./XXdebugLogs.sh"
|
echo "Try later, try reboot or run command: debug"
|
||||||
echo "************************************************"
|
echo "************************************************"
|
||||||
echo "Press ENTER to return to main menu."
|
echo "Press ENTER to return to main menu."
|
||||||
read key
|
read key
|
||||||
exit 1
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ${openChannels} -gt 0 ]; then
|
if [ ${openChannels} -gt 0 ]; then
|
||||||
whiptail --title 'Info' --yes-button='Cashout Anyway' --no-button='Go Back' --yesno 'You still have funds in open Lightning Channels.\nUse CLOSEALL first if you want to cashout all funds.\nNOTICE: Just confirmed on-chain funds can be moved.' 10 56
|
whiptail --title 'Info' --yes-button='Cashout Anyway' --no-button='Go Back' --yesno 'You still have funds in open Lightning Channels.\nUse CLOSEALL first if you want to cashout all funds.\nNOTICE: Just confirmed on-chain funds can be moved.' 10 56
|
||||||
if [ $? -eq 1 ]; then
|
if [ $? -eq 1 ]; then
|
||||||
exit 1
|
exit 0
|
||||||
fi
|
fi
|
||||||
echo "..."
|
echo "..."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check if money is waiting to get confirmed
|
# check if money is waiting to get confirmed
|
||||||
unconfirmed=$(lncli --chain=${network} --network=${chain}net walletbalance | grep '"unconfirmed_balance"' | cut -d '"' -f4)
|
if [ $LNTYPE = cl ];then
|
||||||
|
ln_walletbalance_wait=0
|
||||||
|
cl_listfunds=$($lightningcli_alias listfunds 2>/dev/null)
|
||||||
|
for i in $(echo "$cl_listfunds" \
|
||||||
|
|jq .outputs[]|jq 'select(.status=="unconfirmed")'|grep value|awk '{print $2}'|cut -d, -f1);do
|
||||||
|
ln_walletbalance_wait=$((ln_walletbalance_wait+i))
|
||||||
|
done
|
||||||
|
unconfirmed=$ln_walletbalance_wait
|
||||||
|
elif [ $LNTYPE = lnd ];then
|
||||||
|
unconfirmed=$($lncli_alias walletbalance | grep '"unconfirmed_balance"' | cut -d '"' -f4)
|
||||||
|
fi
|
||||||
if [ ${unconfirmed} -gt 0 ]; then
|
if [ ${unconfirmed} -gt 0 ]; then
|
||||||
whiptail --title 'Info' --yes-button='Cashout Anyway' --no-button='Go Back' --yesno "Still waiting confirmation for (some of) your funds.\nNOTICE: Just confirmed on-chain funds can be moved." 8 58
|
whiptail --title 'Info' --yes-button='Cashout Anyway' --no-button='Go Back' --yesno "Still waiting confirmation for (some of) your funds.\nNOTICE: Just confirmed on-chain funds can be moved." 8 58
|
||||||
if [ $? -eq 1 ]; then
|
if [ $? -eq 1 ]; then
|
||||||
exit 1
|
exit 0
|
||||||
fi
|
fi
|
||||||
echo "..."
|
echo "..."
|
||||||
fi
|
fi
|
||||||
|
@ -53,7 +74,7 @@ then
|
||||||
echo "ok pressed"
|
echo "ok pressed"
|
||||||
else
|
else
|
||||||
echo "cancel pressed"
|
echo "cancel pressed"
|
||||||
exit 1
|
exit 0
|
||||||
fi
|
fi
|
||||||
address=$(cat $_temp | xargs)
|
address=$(cat $_temp | xargs)
|
||||||
shred -u $_temp
|
shred -u $_temp
|
||||||
|
@ -61,7 +82,7 @@ if [ ${#address} -eq 0 ]; then
|
||||||
echo "FAIL - not a valid address (${address})"
|
echo "FAIL - not a valid address (${address})"
|
||||||
echo "Press ENTER to return to main menu."
|
echo "Press ENTER to return to main menu."
|
||||||
read key
|
read key
|
||||||
exit 1
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
clear
|
clear
|
||||||
|
@ -70,22 +91,27 @@ echo "Sweep all possible Funds"
|
||||||
echo "******************************"
|
echo "******************************"
|
||||||
|
|
||||||
# execute command
|
# execute command
|
||||||
command="lncli --chain=${network} --network=${chain}net sendcoins --sweepall --addr=${address} --conf_target=36"
|
if [ ${LNTYPE} = "cl" ];then
|
||||||
|
# withdraw destination satoshi [feerate] [minconf] [utxos]
|
||||||
|
command="$lightningcli_alias withdraw ${address} all slow"
|
||||||
|
elif [ ${LNTYPE} = "lnd" ];then
|
||||||
|
command="$lncli_alias sendcoins --sweepall --addr=${address} --conf_target=36"
|
||||||
|
fi
|
||||||
echo "$command"
|
echo "$command"
|
||||||
result=$($command 2>$_error)
|
result=$($command 2>$_error)
|
||||||
error=`cat ${_error}`
|
error=$(cat ${_error})
|
||||||
echo ""
|
echo
|
||||||
if [ ${#error} -gt 0 ]; then
|
if [ ${#error} -gt 0 ]; then
|
||||||
echo "FAIL: $error"
|
echo "FAIL: $error"
|
||||||
echo ""
|
echo
|
||||||
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
||||||
echo "FAIL --> Was not able to send transaction (see error above)"
|
echo "FAIL --> Was not able to send transaction (see error above)"
|
||||||
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
||||||
else
|
else
|
||||||
echo "Result: $result"
|
echo "Result: $result"
|
||||||
echo ""
|
echo
|
||||||
echo "********************************************************************"
|
echo "********************************************************************"
|
||||||
fi
|
fi
|
||||||
echo ""
|
echo
|
||||||
echo "Press ENTER to return to main menu."
|
echo "Press ENTER to return to main menu."
|
||||||
read key
|
read key
|
|
@ -3,42 +3,88 @@
|
||||||
# load raspiblitz config data (with backup from old config)
|
# load raspiblitz config data (with backup from old config)
|
||||||
source /home/admin/raspiblitz.info
|
source /home/admin/raspiblitz.info
|
||||||
source /mnt/hdd/raspiblitz.conf
|
source /mnt/hdd/raspiblitz.conf
|
||||||
if [ ${#network} -eq 0 ]; then network=`cat .network`; fi
|
if [ ${#network} -eq 0 ]; then network=$(cat .network); fi
|
||||||
if [ ${#network} -eq 0 ]; then network="bitcoin"; fi
|
if [ ${#network} -eq 0 ]; then network="bitcoin"; fi
|
||||||
if [ ${#chain} -eq 0 ]; then
|
if [ ${#chain} -eq 0 ]; then
|
||||||
chain=$(${network}-cli getblockchaininfo | jq -r '.chain')
|
chain=$(${network}-cli getblockchaininfo | jq -r '.chain')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# precheck: AutoPilot
|
source <(/home/admin/config.scripts/network.aliases.sh getvars $1 $2)
|
||||||
if [ "${autoPilot}" = "on" ]; then
|
|
||||||
dialog --title 'Info' --msgbox 'You need to turn OFF the LND AutoPilot first,\nso that closed channels are not opening up again.\nYou find the AutoPilot -----> SERVICES section' 7 55
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
command="lncli --chain=${network} --network=${chain}net closeallchannels --force"
|
if [ $LNTYPE = cl ];then
|
||||||
|
# https://lightning.readthedocs.io/lightning-close.7.html
|
||||||
|
peerlist=$($lightningcli_alias listpeers|grep '"id":'|awk '{print $2}'|cut -d, -f1)
|
||||||
|
# to display
|
||||||
|
function cl_closeall_command {
|
||||||
|
for i in $peerlist; do
|
||||||
|
# close id [unilateraltimeout] [destination] [fee_negotiation_step] [*wrong_funding*]
|
||||||
|
echo "$lightningcli_alias close $i 30;"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
command=$(cl_closeall_command)
|
||||||
|
# to run
|
||||||
|
function cl_closeall {
|
||||||
|
for i in $peerlist; do
|
||||||
|
# close id [unilateraltimeout] [destination] [fee_negotiation_step] [*wrong_funding*]
|
||||||
|
echo "# Attempting a mutual close one-by-one with a 30 seconds timeout"
|
||||||
|
$lightningcli_alias close $i 30
|
||||||
|
done
|
||||||
|
}
|
||||||
|
elif [ $LNTYPE = lnd ];then
|
||||||
|
# precheck: AutoPilot
|
||||||
|
if [ "${autoPilot}" = "on" ]; then
|
||||||
|
dialog --title 'Info' --msgbox 'You need to turn OFF the LND AutoPilot first,\nso that closed channels are not opening up again.\nYou find the AutoPilot -----> SERVICES section' 7 55
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
command="$lncli_alias closeallchannels --force"
|
||||||
|
fi
|
||||||
|
|
||||||
clear
|
clear
|
||||||
echo "***********************************"
|
echo
|
||||||
echo "Closing All Channels (EXPERIMENTAL)"
|
echo "# Precheck" # PRECHECK) check if chain is in sync
|
||||||
echo "***********************************"
|
if [ $LNTYPE = cl ];then
|
||||||
echo ""
|
BLOCKHEIGHT=$($bitcoincli_alias getblockchaininfo|grep blocks|awk '{print $2}'|cut -d, -f1)
|
||||||
echo "COMMAND LINE: "
|
CLHEIGHT=$($lightningcli_alias getinfo | jq .blockheight)
|
||||||
echo $command
|
if [ $BLOCKHEIGHT -eq $CLHEIGHT ];then
|
||||||
echo ""
|
chainOutSync=0
|
||||||
echo "RESULT:"
|
else
|
||||||
|
chainOutSync=1
|
||||||
# PRECHECK) check if chain is in sync
|
fi
|
||||||
chainInSync=$(lncli --chain=${network} --network=${chain}net getinfo | grep '"synced_to_chain": true' -c)
|
elif [ $LNTYPE = lnd ];then
|
||||||
if [ ${chainInSync} -eq 0 ]; then
|
chainOutSync=$($lncli_alias getinfo | grep '"synced_to_chain": false' -c)
|
||||||
command=""
|
|
||||||
result="FAIL PRECHECK - lncli getinfo shows 'synced_to_chain': false - wait until chain is sync "
|
|
||||||
fi
|
fi
|
||||||
|
if [ ${chainOutSync} -eq 1 ]; then
|
||||||
|
if [ $LNTYPE = cl ];then
|
||||||
|
echo "# FAIL PRECHECK - '${netprefix}lightning-cli getinfo' blockheight is different from '${netprefix}bitcoind getblockchaininfo' - wait until chain is sync "
|
||||||
|
elif [ $LNTYPE = lnd ];then
|
||||||
|
echo "# FAIL PRECHECK - ${netprefix}lncli getinfo shows 'synced_to_chain': false - wait until chain is sync "
|
||||||
|
fi
|
||||||
|
echo
|
||||||
|
echo "# PRESS ENTER to return to menu"
|
||||||
|
read key
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "# OK - the chain is synced"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "#####################################"
|
||||||
|
echo "# Closing All Channels (EXPERIMENTAL)"
|
||||||
|
echo "#####################################"
|
||||||
|
echo
|
||||||
|
echo "# COMMAND LINE: "
|
||||||
|
echo $command
|
||||||
|
echo
|
||||||
|
echo "# RESULT:"
|
||||||
|
|
||||||
# execute command
|
# execute command
|
||||||
if [ ${#command} -gt 0 ]; then
|
if [ ${#command} -gt 0 ]; then
|
||||||
${command}
|
if [ $LNTYPE = cl ];then
|
||||||
|
cl_closeall
|
||||||
|
elif [ $LNTYPE = lnd ];then
|
||||||
|
${command}
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ""
|
echo
|
||||||
echo "OK - please recheck if channels really closed"
|
echo "# OK - please recheck if channels really closed"
|
||||||
sleep 5
|
sleep 5
|
|
@ -1,30 +1,29 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
trap 'rm -f "$_temp"' EXIT
|
||||||
|
trap 'rm -f "$_error"' EXIT
|
||||||
_temp=$(mktemp -p /dev/shm/)
|
_temp=$(mktemp -p /dev/shm/)
|
||||||
_error=$(mktemp -p /dev/shm/)
|
_error=$(mktemp -p /dev/shm/)
|
||||||
|
|
||||||
# load raspiblitz config data (with backup from old config)
|
# load raspiblitz config data (with backup from old config)
|
||||||
source /home/admin/raspiblitz.info
|
source /home/admin/raspiblitz.info
|
||||||
source /mnt/hdd/raspiblitz.conf
|
source /mnt/hdd/raspiblitz.conf
|
||||||
if [ ${#network} -eq 0 ]; then network=`cat .network`; fi
|
if [ ${#network} -eq 0 ]; then network=$(cat .network); fi
|
||||||
if [ ${#network} -eq 0 ]; then network="bitcoin"; fi
|
if [ ${#network} -eq 0 ]; then network="bitcoin"; fi
|
||||||
if [ ${#chain} -eq 0 ]; then
|
if [ ${#chain} -eq 0 ]; then
|
||||||
echo "gathering chain info ... please wait"
|
echo "gathering chain info ... please wait"
|
||||||
chain=$(${network}-cli getblockchaininfo | jq -r '.chain')
|
chain=$(${network}-cli getblockchaininfo | jq -r '.chain')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# set ntwork map info
|
source <(/home/admin/config.scripts/network.aliases.sh getvars $1 $2)
|
||||||
networkMap="https://lnmainnet.gaben.win"
|
|
||||||
if [ "$network" = "litecoin" ]; then
|
|
||||||
networkMap="https://lnexplorer.hcwong.me"
|
|
||||||
fi
|
|
||||||
if [ "$chain" = "test" ]; then
|
|
||||||
networkMap="https://explorer.acinq.co"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# let user enter a <pubkey>@host
|
# let user enter a <pubkey>@host
|
||||||
l1="Enter the node pubkey address with host information:"
|
l1="Enter the node pubkey address with host information:"
|
||||||
l2="example -----> 024ddf33[...]1f5f9f3@91.65.1.38:9735"
|
l2="example -----> 024ddf33[...]1f5f9f3@91.65.1.38:9735"
|
||||||
l3="node directory -> 1ml.com"
|
if [ "$chain" = "main" ]; then
|
||||||
|
l3="node directory -> https://1ml.com"
|
||||||
|
elif [ "$chain" = "test" ]; then
|
||||||
|
l3="node directory -> https://1ml.com/testnet"
|
||||||
|
fi
|
||||||
dialog --title "Open a Connection to a Peer" \
|
dialog --title "Open a Connection to a Peer" \
|
||||||
--backtitle "Lightning ( ${network} | ${chain} )" \
|
--backtitle "Lightning ( ${network} | ${chain} )" \
|
||||||
--inputbox "$l1\n$l2\n$l3" 10 60 2>$_temp
|
--inputbox "$l1\n$l2\n$l3" 10 60 2>$_temp
|
||||||
|
@ -35,21 +34,29 @@ if [ ${#_input} -eq 0 ]; then
|
||||||
echo
|
echo
|
||||||
echo "no peer entered - returning to menu ..."
|
echo "no peer entered - returning to menu ..."
|
||||||
sleep 2
|
sleep 2
|
||||||
exit 1
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
pubkey=$(echo "${_input}"|cut -d@ -f1)
|
||||||
|
# address=$(echo "${_input}"|cut -d@ -f2|cut -d: -f1)
|
||||||
|
# port=$(echo "${_input}"|cut -d: -f2)
|
||||||
# build command
|
# build command
|
||||||
command="lncli --chain=${network} --network=${chain}net connect ${_input}"
|
if [ $LNTYPE = cl ];then
|
||||||
|
# connect id [host port]
|
||||||
|
command="$lightningcli_alias connect ${_input}"
|
||||||
|
elif [ $LNTYPE = lnd ];then
|
||||||
|
command="$lncli_alias connect ${_input}"
|
||||||
|
fi
|
||||||
|
|
||||||
# info output
|
# info output
|
||||||
clear
|
clear
|
||||||
echo "******************************"
|
echo "******************************"
|
||||||
echo "Connect to A Lightning Node"
|
echo "Connect to a Lightning Node"
|
||||||
echo "******************************"
|
echo "******************************"
|
||||||
echo ""
|
echo
|
||||||
echo "COMMAND LINE: "
|
echo "COMMAND LINE: "
|
||||||
echo $command
|
echo $command
|
||||||
echo ""
|
echo
|
||||||
echo "RESULT (might have to wait for timeout):"
|
echo "RESULT (might have to wait for timeout):"
|
||||||
|
|
||||||
win=1
|
win=1
|
||||||
|
@ -59,7 +66,7 @@ info=""
|
||||||
if [ ${#_input} -lt 10 ]; then
|
if [ ${#_input} -lt 10 ]; then
|
||||||
win=0
|
win=0
|
||||||
info="node pubkey@host info is too short"
|
info="node pubkey@host info is too short"
|
||||||
else
|
elif [ $LNTYPE = lnd ];then
|
||||||
gotAt=$(echo $_input | grep '@' -c)
|
gotAt=$(echo $_input | grep '@' -c)
|
||||||
if [ ${gotAt} -eq 0 ]; then
|
if [ ${gotAt} -eq 0 ]; then
|
||||||
win=0
|
win=0
|
||||||
|
@ -82,13 +89,13 @@ if [ ${#result} -eq 0 ]; then
|
||||||
info="No return value. Error not known."
|
info="No return value. Error not known."
|
||||||
|
|
||||||
# try to get error output
|
# try to get error output
|
||||||
result=`cat ${_error}`
|
result=$(cat "${_error}")
|
||||||
echo "$result"
|
echo "$result"
|
||||||
|
|
||||||
# basic cli error
|
# basic cli error
|
||||||
cliError=$(echo "${result}" | grep "[lncli]" -c )
|
cliError=$(echo "${result}" | grep "[lncli]" -c )
|
||||||
if [ ${cliError} -gt 0 ]; then
|
if [ ${cliError} -gt 0 ]; then
|
||||||
info="Its possible that LND daemon is not running, not configured correct or not connected to the lncli."
|
info="It's possible that the lightning daemon is not running, not configured correct or not connected to the cli."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
|
@ -97,8 +104,11 @@ else
|
||||||
echo "$result"
|
echo "$result"
|
||||||
|
|
||||||
# check if the node is now in peer list
|
# check if the node is now in peer list
|
||||||
pubkey=$(echo $_input | cut -d '@' -f1)
|
if [ $LNTYPE = cl ];then
|
||||||
isPeer=$(lncli --chain=${network} --network=${chain}net listpeers 2>/dev/null| grep "${pubkey}" -c)
|
isPeer=$($lightningcli_alias listpeers 2>/dev/null| grep "${pubkey}" -c)
|
||||||
|
elif [ $LNTYPE = lnd ];then
|
||||||
|
isPeer=$($lncli_alias listpeers 2>/dev/null| grep "${pubkey}" -c)
|
||||||
|
fi
|
||||||
if [ ${isPeer} -eq 0 ]; then
|
if [ ${isPeer} -eq 0 ]; then
|
||||||
|
|
||||||
# basic error message
|
# basic error message
|
||||||
|
@ -108,20 +118,21 @@ else
|
||||||
# TODO: try to find out more details from cli output
|
# TODO: try to find out more details from cli output
|
||||||
|
|
||||||
else
|
else
|
||||||
|
win=1
|
||||||
info="Perfect - a connection to that node got established :)"
|
info="Perfect - a connection to that node got established :)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# output info
|
# output info
|
||||||
echo ""
|
echo
|
||||||
if [ ${win} -eq 1 ]; then
|
if [ ${win} -eq 1 ]; then
|
||||||
echo "******************************"
|
echo "******************************"
|
||||||
echo "WIN"
|
echo "WIN"
|
||||||
echo "******************************"
|
echo "******************************"
|
||||||
echo "${info}"
|
echo "${info}"
|
||||||
echo ""
|
echo
|
||||||
echo "Whats next? --> Open a channel with that node."
|
echo "What's next? --> Open a channel with that node."
|
||||||
else
|
else
|
||||||
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
||||||
echo "FAIL"
|
echo "FAIL"
|
||||||
|
@ -129,6 +140,6 @@ else
|
||||||
echo "${info}"
|
echo "${info}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ""
|
echo
|
||||||
echo "Press ENTER to return to main menu."
|
echo "Press ENTER to return to main menu."
|
||||||
read key
|
read key
|
|
@ -1,5 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
clear
|
clear
|
||||||
|
trap 'rm -f "$_temp"' EXIT
|
||||||
|
trap 'rm -f "$_error"' EXIT
|
||||||
_temp=$(mktemp -p /dev/shm/)
|
_temp=$(mktemp -p /dev/shm/)
|
||||||
_error=$(mktemp -p /dev/shm/)
|
_error=$(mktemp -p /dev/shm/)
|
||||||
sudo chmod 7777 ${_error} 2>/dev/null
|
sudo chmod 7777 ${_error} 2>/dev/null
|
||||||
|
@ -7,23 +9,64 @@ sudo chmod 7777 ${_error} 2>/dev/null
|
||||||
# load raspiblitz config data (with backup from old config)
|
# load raspiblitz config data (with backup from old config)
|
||||||
source /home/admin/raspiblitz.info
|
source /home/admin/raspiblitz.info
|
||||||
source /mnt/hdd/raspiblitz.conf
|
source /mnt/hdd/raspiblitz.conf
|
||||||
if [ ${#network} -eq 0 ]; then network=`cat .network`; fi
|
if [ ${#network} -eq 0 ]; then network=$(cat .network); fi
|
||||||
if [ ${#network} -eq 0 ]; then network="bitcoin"; fi
|
if [ ${#network} -eq 0 ]; then network="bitcoin"; fi
|
||||||
if [ ${#chain} -eq 0 ]; then
|
if [ ${#chain} -eq 0 ]; then
|
||||||
echo "gathering chain info ... please wait"
|
echo "gathering chain info ... please wait"
|
||||||
chain=$(${network}-cli getblockchaininfo | jq -r '.chain')
|
chain=$(${network}-cli getblockchaininfo | jq -r '.chain')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if ready (chain in sync and channels open)
|
source <(/home/admin/config.scripts/network.aliases.sh getvars $1 $2)
|
||||||
./XXchainInSync.sh $network $chain
|
|
||||||
if [ $? != 0 ]; then
|
source <(/home/admin/config.scripts/network.aliases.sh getvars $LNTYPE ${chain}net)
|
||||||
exit 1
|
|
||||||
|
# check if chain is in sync
|
||||||
|
if [ $LNTYPE = cl ];then
|
||||||
|
lncommand="${netprefix}lightning-cli"
|
||||||
|
BLOCKHEIGHT=$($bitcoincli_alias getblockchaininfo|grep blocks|awk '{print $2}'|cut -d, -f1)
|
||||||
|
CLHEIGHT=$($lightningcli_alias getinfo | jq .blockheight)
|
||||||
|
if [ $BLOCKHEIGHT -eq $CLHEIGHT ];then
|
||||||
|
cmdChainInSync=1
|
||||||
|
else
|
||||||
|
cmdChainInSync=0
|
||||||
|
fi
|
||||||
|
elif [ $LNTYPE = lnd ];then
|
||||||
|
lncommand="${netprefix}lncli"
|
||||||
|
cmdChainInSync="$lncli_alias getinfo | grep '"synced_to_chain": true' -c"
|
||||||
|
fi
|
||||||
|
chainInSync=${cmdChainInSync}
|
||||||
|
while [ "${chainInSync}" == "0" ]; do
|
||||||
|
dialog --title "Fail: not in sync" \
|
||||||
|
--ok-label "Try now" \
|
||||||
|
--cancel-label "Give up" \
|
||||||
|
--pause "\n\n'$lncommand getinfo' shows 'synced_to_chain': false\n\nTry again in a few seconds." 15 60 5
|
||||||
|
|
||||||
|
if [ $? -gt 0 ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
chainInSync=${cmdChainInSync}
|
||||||
|
done
|
||||||
|
|
||||||
|
# check number of connected peers
|
||||||
|
echo "check for open channels"
|
||||||
|
if [ $LNTYPE = cl ];then
|
||||||
|
openChannels=$($lightningcli_alias listpeers | grep -c "CHANNELD_NORMAL")
|
||||||
|
elif [ $LNTYPE = lnd ];then
|
||||||
|
openChannels=$($lncli_alias listchannels 2>/dev/null | grep chan_id -c)
|
||||||
|
fi
|
||||||
|
if [ ${openChannels} -eq 0 ]; then
|
||||||
|
echo
|
||||||
|
echo "!!!!!!!!!!!!!!!!!!!"
|
||||||
|
echo "FAIL - You have NO ESTABLISHED CHANNELS .. open a channel first."
|
||||||
|
echo "!!!!!!!!!!!!!!!!!!!"
|
||||||
|
sleep 3
|
||||||
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# let user enter the invoice
|
# let user enter the invoice
|
||||||
l1="Enter the AMOUNT IN SATOSHI of the invoice:"
|
l1="Enter the AMOUNT IN SATOSHIS to invoice:"
|
||||||
l2="1 ${network} = 100 000 000 SAT"
|
l2="1 ${network} = 100 000 000 SAT"
|
||||||
dialog --title "Pay thru Lightning Network" \
|
dialog --title "Request payment through Lightning" \
|
||||||
--inputbox "$l1\n$l2" 9 50 2>$_temp
|
--inputbox "$l1\n$l2" 9 50 2>$_temp
|
||||||
amount=$(cat $_temp | xargs | tr -dc '0-9')
|
amount=$(cat $_temp | xargs | tr -dc '0-9')
|
||||||
shred -u $_temp
|
shred -u $_temp
|
||||||
|
@ -31,30 +74,37 @@ if [ ${#amount} -eq 0 ]; then
|
||||||
clear
|
clear
|
||||||
echo
|
echo
|
||||||
echo "no amount entered - returning to menu ..."
|
echo "no amount entered - returning to menu ..."
|
||||||
sleep 2
|
sleep 3
|
||||||
exit 1
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# TODO let user enter a description
|
# TODO let user enter a description
|
||||||
|
|
||||||
# build command
|
# build command
|
||||||
command="lncli --chain=${network} --network=${chain}net addinvoice ${amount}"
|
if [ $LNTYPE = cl ];then
|
||||||
|
label=$(date +%s) # seconds since 1970-01-01 00:00:00 UTC
|
||||||
|
# invoice msatoshi label description [expiry] [fallbacks] [preimage] [exposeprivatechannels] [cltv]
|
||||||
|
command="$lightningcli_alias invoice ${amount}sat $label ''"
|
||||||
|
# TODO warn about insufficient liquidity
|
||||||
|
elif [ $LNTYPE = lnd ];then
|
||||||
|
command="$lncli_alias addinvoice ${amount}"
|
||||||
|
fi
|
||||||
|
|
||||||
# info output
|
# info output
|
||||||
clear
|
clear
|
||||||
echo "******************************"
|
echo "******************************"
|
||||||
echo "Create Invoice / Payment Request"
|
echo "Create Invoice / Payment Request"
|
||||||
echo "******************************"
|
echo "******************************"
|
||||||
echo ""
|
echo
|
||||||
echo "COMMAND LINE: "
|
echo "COMMAND LINE: "
|
||||||
echo $command
|
echo $command
|
||||||
echo ""
|
echo
|
||||||
echo "RESULT:"
|
echo "RESULT:"
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
# execute command
|
# execute command
|
||||||
result=$($command 2>$_error)
|
result=$($command 2>$_error)
|
||||||
error=`cat ${_error} 2>/dev/null`
|
error=$(cat ${_error} 2>/dev/null)
|
||||||
|
|
||||||
#echo "result(${result})"
|
#echo "result(${result})"
|
||||||
#echo "error(${error})"
|
#echo "error(${error})"
|
||||||
|
@ -65,9 +115,12 @@ if [ ${#error} -gt 0 ]; then
|
||||||
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
||||||
echo "${error}"
|
echo "${error}"
|
||||||
else
|
else
|
||||||
|
if [ $LNTYPE = cl ];then
|
||||||
rhash=$(echo "$result" | grep r_hash | cut -d '"' -f4)
|
payReq=$(echo "$result" | grep bolt11 | cut -d '"' -f4)
|
||||||
payReq=$(echo "$result" | grep payment_request | cut -d '"' -f4)
|
elif [ $LNTYPE = lnd ];then
|
||||||
|
rhash=$(echo "$result" | grep r_hash | cut -d '"' -f4)
|
||||||
|
payReq=$(echo "$result" | grep payment_request | cut -d '"' -f4)
|
||||||
|
fi
|
||||||
/home/admin/config.scripts/blitz.display.sh qr "${payReq}"
|
/home/admin/config.scripts/blitz.display.sh qr "${payReq}"
|
||||||
|
|
||||||
if [ $(sudo dpkg-query -l | grep "ii qrencode" | wc -l) = 0 ]; then
|
if [ $(sudo dpkg-query -l | grep "ii qrencode" | wc -l) = 0 ]; then
|
||||||
|
@ -86,19 +139,27 @@ else
|
||||||
echo "${payReq}"
|
echo "${payReq}"
|
||||||
echo
|
echo
|
||||||
echo "Monitoring the Incoming Payment with:"
|
echo "Monitoring the Incoming Payment with:"
|
||||||
echo "lncli --chain=${network} --network=${chain}net lookupinvoice ${rhash}"
|
if [ $LNTYPE = cl ];then
|
||||||
|
echo "$lightningcli_alias waitinvoice $label"
|
||||||
|
elif [ $LNTYPE = lnd ];then
|
||||||
|
echo "$lncli_alias lookupinvoice ${rhash}"
|
||||||
|
fi
|
||||||
echo "Press x and hold to skip to menu."
|
echo "Press x and hold to skip to menu."
|
||||||
|
|
||||||
while :
|
while :
|
||||||
do
|
do
|
||||||
|
if [ $LNTYPE = cl ];then
|
||||||
result=$(lncli --chain=${network} --network=${chain}net lookupinvoice ${rhash})
|
result=$($lightningcli_alias waitinvoice $label)
|
||||||
wasPayed=$(echo $result | grep -c '"settled": true')
|
wasPayed=$(echo $result | grep -c 'paid')
|
||||||
|
elif [ $LNTYPE = lnd ];then
|
||||||
|
result=$($lncli_alias lookupinvoice ${rhash})
|
||||||
|
wasPayed=$(echo $result | grep -c '"settled": true')
|
||||||
|
fi
|
||||||
if [ ${wasPayed} -gt 0 ]; then
|
if [ ${wasPayed} -gt 0 ]; then
|
||||||
echo
|
echo
|
||||||
echo $result
|
echo $result
|
||||||
echo
|
echo
|
||||||
echo "Returning to menu - OK Invoice payed."
|
echo "OK the Invoice was paid - returning to menu."
|
||||||
/home/admin/config.scripts/blitz.display.sh hide
|
/home/admin/config.scripts/blitz.display.sh hide
|
||||||
/home/admin/config.scripts/blitz.display.sh image /home/admin/raspiblitz/pictures/ok.png
|
/home/admin/config.scripts/blitz.display.sh image /home/admin/raspiblitz/pictures/ok.png
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
|
@ -4,41 +4,68 @@ clear
|
||||||
# load raspiblitz config data (with backup from old config)
|
# load raspiblitz config data (with backup from old config)
|
||||||
source /home/admin/raspiblitz.info
|
source /home/admin/raspiblitz.info
|
||||||
source /mnt/hdd/raspiblitz.conf
|
source /mnt/hdd/raspiblitz.conf
|
||||||
if [ ${#network} -eq 0 ]; then network=`cat .network`; fi
|
if [ ${#network} -eq 0 ]; then network=$(cat .network); fi
|
||||||
if [ ${#network} -eq 0 ]; then network="bitcoin"; fi
|
if [ ${#network} -eq 0 ]; then network="bitcoin"; fi
|
||||||
if [ ${#chain} -eq 0 ]; then
|
if [ ${#chain} -eq 0 ]; then
|
||||||
echo "gathering chain info ... please wait"
|
echo "gathering chain info ... please wait"
|
||||||
chain=$(${network}-cli getblockchaininfo | jq -r '.chain')
|
chain=$(${network}-cli getblockchaininfo | jq -r '.chain')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
source <(/home/admin/config.scripts/network.aliases.sh getvars $1 $2)
|
||||||
|
|
||||||
# PRECHECK) check if chain is in sync
|
# PRECHECK) check if chain is in sync
|
||||||
chainOutSync=$(lncli --chain=${network} --network=${chain}net getinfo | grep '"synced_to_chain": false' -c)
|
if [ $LNTYPE = cl ];then
|
||||||
|
BLOCKHEIGHT=$($bitcoincli_alias getblockchaininfo|grep blocks|awk '{print $2}'|cut -d, -f1)
|
||||||
|
CLHEIGHT=$($lightningcli_alias getinfo | jq .blockheight)
|
||||||
|
if [ $BLOCKHEIGHT -eq $CLHEIGHT ];then
|
||||||
|
chainOutSync=0
|
||||||
|
else
|
||||||
|
chainOutSync=1
|
||||||
|
fi
|
||||||
|
elif [ $LNTYPE = lnd ];then
|
||||||
|
chainOutSync=$($lncli_alias getinfo | grep '"synced_to_chain": false' -c)
|
||||||
|
fi
|
||||||
if [ ${chainOutSync} -eq 1 ]; then
|
if [ ${chainOutSync} -eq 1 ]; then
|
||||||
echo "FAIL PRECHECK - lncli getinfo shows 'synced_to_chain': false - wait until chain is sync "
|
if [ $LNTYPE = cl ];then
|
||||||
echo ""
|
echo "# FAIL PRECHECK - lncli getinfo shows 'synced_to_chain': false - wait until chain is sync "
|
||||||
echo "PRESS ENTER to return to menu"
|
else
|
||||||
|
echo "# FAIL PRECHECK - 'lightning-cli getinfo' blockheight is different from 'bitcoind getblockchaininfo' - wait until chain is sync "
|
||||||
|
fi
|
||||||
|
echo
|
||||||
|
echo "# PRESS ENTER to return to menu"
|
||||||
read key
|
read key
|
||||||
exit 1
|
exit 0
|
||||||
|
else
|
||||||
|
echo "# OK - the chain is synced"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# execute command
|
# execute command
|
||||||
echo "calling lncli ... please wait"
|
if [ $LNTYPE = cl ];then
|
||||||
command="lncli --chain=${network} --network=${chain}net newaddress p2wkh"
|
command="$lightningcli_alias newaddr bech32"
|
||||||
|
elif [ $LNTYPE = lnd ];then
|
||||||
|
command="$lncli_alias newaddress p2wkh"
|
||||||
|
fi
|
||||||
|
echo "# Calling:"
|
||||||
echo "${command}"
|
echo "${command}"
|
||||||
|
echo
|
||||||
result=$($command)
|
result=$($command)
|
||||||
echo "$result"
|
echo "$result"
|
||||||
|
|
||||||
# on no result
|
# on no result
|
||||||
if [ ${#result} -eq 0 ]; then
|
if [ ${#result} -eq 0 ]; then
|
||||||
echo "Empty result - sorry something went wrong - thats unusual."
|
echo "# Empty result - sorry something went wrong - that is unusual."
|
||||||
echo ""
|
echo
|
||||||
echo "PRESS ENTER to return to menu"
|
echo "# Press ENTER to return to menu"
|
||||||
read key
|
read key
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# parse address from result
|
# parse address from result
|
||||||
address=$( echo "$result" | grep "address" | cut -d '"' -f4)
|
if [ $LNTYPE = cl ];then
|
||||||
|
address=$( echo "$result" | grep "bech32" | cut -d '"' -f4)
|
||||||
|
elif [ $LNTYPE = lnd ];then
|
||||||
|
address=$( echo "$result" | grep "address" | cut -d '"' -f4)
|
||||||
|
fi
|
||||||
|
|
||||||
# prepare coin info
|
# prepare coin info
|
||||||
coininfo="Bitcoin"
|
coininfo="Bitcoin"
|
||||||
|
@ -58,7 +85,7 @@ echo "generating QR code ... please wait"
|
||||||
/home/admin/config.scripts/blitz.display.sh qr "$network:${address}"
|
/home/admin/config.scripts/blitz.display.sh qr "$network:${address}"
|
||||||
|
|
||||||
# dialog with instructions while QR code is shown on LCD
|
# dialog with instructions while QR code is shown on LCD
|
||||||
whiptail --backtitle "Fund your on chain wallet" \
|
whiptail --backtitle "Fund your onchain wallet" \
|
||||||
--title "Send ${coininfo}" \
|
--title "Send ${coininfo}" \
|
||||||
--yes-button "DONE" \
|
--yes-button "DONE" \
|
||||||
--no-button "Console QRcode" \
|
--no-button "Console QRcode" \
|
||||||
|
@ -73,6 +100,11 @@ fi
|
||||||
/home/admin/config.scripts/blitz.display.sh hide
|
/home/admin/config.scripts/blitz.display.sh hide
|
||||||
|
|
||||||
# follow up info
|
# follow up info
|
||||||
whiptail --backtitle "Fund your on chain wallet" \
|
if [ $LNTYPE = cl ];then
|
||||||
|
string="Wait for confirmations."
|
||||||
|
elif [ $LNTYPE = lnd ];then
|
||||||
|
string="Wait for confirmations. \n\nYou can use info on LCD to check if funds have arrived. \n\nIf you want your lightning node to open channels automatically, activate the 'Autopilot' under 'Activate/Deactivate Services'"
|
||||||
|
fi
|
||||||
|
whiptail --backtitle "Fund your onchain wallet" \
|
||||||
--title "What's next?" \
|
--title "What's next?" \
|
||||||
--msgbox "Wait for confirmations. \n\nYou can use info on LCD to check if funds have arrived. \n\nIf you want your lighting node to open channels automatically, activate the 'Autopilot' under 'Activate/Deactivate Services'" 0 0
|
--msgbox "$string" 0 0
|
|
@ -1,62 +1,101 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
trap 'rm -f "$_temp"' EXIT
|
||||||
|
trap 'rm -f "$_error"' EXIT
|
||||||
_temp=$(mktemp -p /dev/shm/)
|
_temp=$(mktemp -p /dev/shm/)
|
||||||
_error=$(mktemp -p /dev/shm/)
|
_error=$(mktemp -p /dev/shm/)
|
||||||
|
|
||||||
# load raspiblitz config data (with backup from old config)
|
# load raspiblitz config data (with backup from old config)
|
||||||
source /home/admin/raspiblitz.info
|
source /home/admin/raspiblitz.info
|
||||||
source /mnt/hdd/raspiblitz.conf
|
source /mnt/hdd/raspiblitz.conf
|
||||||
if [ ${#network} -eq 0 ]; then network=`cat .network`; fi
|
if [ ${#network} -eq 0 ]; then network=$(cat .network); fi
|
||||||
if [ ${#network} -eq 0 ]; then network="bitcoin"; fi
|
if [ ${#network} -eq 0 ]; then network="bitcoin"; fi
|
||||||
if [ ${#chain} -eq 0 ]; then
|
if [ ${#chain} -eq 0 ]; then
|
||||||
echo "gathering chain info ... please wait"
|
echo "gathering chain info ... please wait"
|
||||||
chain=$(${network}-cli getblockchaininfo | jq -r '.chain')
|
chain=$(${network}-cli getblockchaininfo | jq -r '.chain')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ""
|
source <(/home/admin/config.scripts/network.aliases.sh getvars $1 $2)
|
||||||
echo "*** Precheck ***"
|
|
||||||
|
|
||||||
# check if chain is in sync
|
echo
|
||||||
chainInSync=$(lncli --chain=${network} --network=${chain}net getinfo | grep '"synced_to_chain": true' -c)
|
echo "# Precheck" # PRECHECK) check if chain is in sync
|
||||||
if [ ${chainInSync} -eq 0 ]; then
|
if [ $LNTYPE = cl ];then
|
||||||
echo "FAIL - 'lncli getinfo' shows 'synced_to_chain': false"
|
BLOCKHEIGHT=$($bitcoincli_alias getblockchaininfo|grep blocks|awk '{print $2}'|cut -d, -f1)
|
||||||
echo "Wait until chain is sync with LND and try again."
|
CLHEIGHT=$($lightningcli_alias getinfo | jq .blockheight)
|
||||||
echo ""
|
if [ $BLOCKHEIGHT -eq $CLHEIGHT ];then
|
||||||
echo "Press ENTER to return to main menu."
|
chainOutSync=0
|
||||||
|
else
|
||||||
|
chainOutSync=1
|
||||||
|
fi
|
||||||
|
elif [ $LNTYPE = lnd ];then
|
||||||
|
chainOutSync=$($lncli_alias getinfo | grep '"synced_to_chain": false' -c)
|
||||||
|
fi
|
||||||
|
if [ ${chainOutSync} -eq 1 ]; then
|
||||||
|
if [ $LNTYPE = cl ];then
|
||||||
|
echo "# FAIL PRECHECK - 'lightning-cli getinfo' blockheight is different from 'bitcoind getblockchaininfo' - wait until chain is sync "
|
||||||
|
elif [ $LNTYPE = lnd ];then
|
||||||
|
echo "# FAIL PRECHECK - lncli getinfo shows 'synced_to_chain': false - wait until chain is sync "
|
||||||
|
fi
|
||||||
|
echo
|
||||||
|
echo "# PRESS ENTER to return to menu"
|
||||||
read key
|
read key
|
||||||
exit 1
|
exit 0
|
||||||
|
else
|
||||||
|
echo "# OK - the chain is synced"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check available funding
|
# check available funding
|
||||||
confirmedBalance=$(lncli --chain=${network} --network=${chain}net walletbalance | grep '"confirmed_balance"' | cut -d '"' -f4)
|
if [ $LNTYPE = cl ];then
|
||||||
|
for i in $($lightningcli_alias \
|
||||||
|
listfunds|jq .outputs[]|jq 'select(.status=="confirmed")'|grep value|awk '{print $2}'|cut -d, -f1);do
|
||||||
|
confirmedBalance=$((confirmedBalance+i))
|
||||||
|
done
|
||||||
|
elif [ $LNTYPE = lnd ];then
|
||||||
|
confirmedBalance=$($lncli_alias walletbalance | grep '"confirmed_balance"' | cut -d '"' -f4)
|
||||||
|
fi
|
||||||
|
|
||||||
if [ ${confirmedBalance} -eq 0 ]; then
|
if [ ${confirmedBalance} -eq 0 ]; then
|
||||||
echo "FAIL - You have 0 SATOSHI in your confirmed LND On-Chain Wallet."
|
echo "FAIL - You have 0 SATOSHI in your confirmed LND On-Chain Wallet."
|
||||||
echo "Please fund your on-chain wallet first and wait until confirmed."
|
echo "Please fund your on-chain wallet first and wait until confirmed."
|
||||||
echo ""
|
echo
|
||||||
echo "Press ENTER to return to main menu."
|
echo "Press ENTER to return to main menu."
|
||||||
read key
|
read key
|
||||||
exit 1
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check number of connected peers
|
# check number of connected peers
|
||||||
numConnectedPeers=$(lncli --chain=${network} --network=${chain}net listpeers | grep pub_key -c)
|
if [ $LNTYPE = cl ];then
|
||||||
|
numConnectedPeers=$($lightningcli_alias listpeers | grep -c '"id":')
|
||||||
|
elif [ $LNTYPE = lnd ];then
|
||||||
|
numConnectedPeers=$($lncli_alias listpeers | grep pub_key -c)
|
||||||
|
fi
|
||||||
|
|
||||||
if [ ${numConnectedPeers} -eq 0 ]; then
|
if [ ${numConnectedPeers} -eq 0 ]; then
|
||||||
echo "FAIL - no peers connected on lightning network"
|
echo "FAIL - no peers connected on the lightning network"
|
||||||
echo "You can only open channels to peer nodes to connected to first."
|
echo "You can only open channels to peer nodes to connected to first."
|
||||||
echo "Use CONNECT peer option in main menu first."
|
echo "Use CONNECT peer option in main menu first."
|
||||||
echo ""
|
echo
|
||||||
echo "Press ENTER to return to main menu."
|
echo "Press ENTER to return to main menu."
|
||||||
read key
|
read key
|
||||||
exit 1
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# let user pick a peer to open a channels with
|
# let user pick a peer to open a channels with
|
||||||
OPTIONS=()
|
OPTIONS=()
|
||||||
while IFS= read -r grepLine
|
if [ $LNTYPE = cl ];then
|
||||||
do
|
while IFS= read -r grepLine
|
||||||
pubKey=$(echo ${grepLine} | cut -d '"' -f4)
|
do
|
||||||
#echo "grepLine(${pubKey})"
|
pubKey=$(echo ${grepLine} | cut -d '"' -f4)
|
||||||
OPTIONS+=(${pubKey} "")
|
# echo "grepLine(${pubKey})"
|
||||||
done < <(lncli --chain=${network} --network=${chain}net listpeers | grep pub_key)
|
OPTIONS+=(${pubKey} "")
|
||||||
|
done < <($lightningcli_alias listpeers | grep '"id":')
|
||||||
|
elif [ $LNTYPE = lnd ];then
|
||||||
|
while IFS= read -r grepLine
|
||||||
|
do
|
||||||
|
pubKey=$(echo ${grepLine} | cut -d '"' -f4)
|
||||||
|
# echo "grepLine(${pubKey})"
|
||||||
|
OPTIONS+=(${pubKey} "")
|
||||||
|
done < <($lncli_alias listpeers | grep pub_key)
|
||||||
|
fi
|
||||||
TITLE="Open (Payment) Channel"
|
TITLE="Open (Payment) Channel"
|
||||||
MENU="\nChoose a peer you connected to, to open the channel with: \n "
|
MENU="\nChoose a peer you connected to, to open the channel with: \n "
|
||||||
pubKey=$(dialog --clear \
|
pubKey=$(dialog --clear \
|
||||||
|
@ -68,11 +107,11 @@ pubKey=$(dialog --clear \
|
||||||
|
|
||||||
clear
|
clear
|
||||||
if [ ${#pubKey} -eq 0 ]; then
|
if [ ${#pubKey} -eq 0 ]; then
|
||||||
clear
|
clear
|
||||||
echo
|
echo
|
||||||
echo "no channel selected - returning to menu ..."
|
echo "no channel selected - returning to menu ..."
|
||||||
sleep 4
|
sleep 4
|
||||||
exit 1
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# find out what is the minimum amount
|
# find out what is the minimum amount
|
||||||
|
@ -82,15 +121,17 @@ minSat=20000
|
||||||
if [ "${network}" = "bitcoin" ]; then
|
if [ "${network}" = "bitcoin" ]; then
|
||||||
minSat=50000
|
minSat=50000
|
||||||
fi
|
fi
|
||||||
_error="./.error.out"
|
if [ $LNTYPE = lnd ];then
|
||||||
lncli --chain=${network} openchannel --network=${chain}net ${CHOICE} 1 0 2>$_error
|
_error="./.error.out"
|
||||||
error=`cat ${_error}`
|
$lncli_alias openchannel ${pubkey} 1 0 2>$_error
|
||||||
if [ $(echo "${error}" | grep "channel is too small" -c) -eq 1 ]; then
|
error=$(cat ${_error})
|
||||||
minSat=$(echo "${error}" | tr -dc '0-9')
|
if [ $(echo "${error}" | grep "channel is too small" -c) -eq 1 ]; then
|
||||||
|
minSat=$(echo "${error}" | tr -dc '0-9')
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# let user enter an amount
|
# let user enter an amount
|
||||||
l1="Amount in SATOSHI to fund this channel:"
|
l1="Amount in satoshis to fund this channel:"
|
||||||
l2="min required : ${minSat}"
|
l2="min required : ${minSat}"
|
||||||
l3="max available : ${confirmedBalance}"
|
l3="max available : ${confirmedBalance}"
|
||||||
dialog --title "Funding of Channel" \
|
dialog --title "Funding of Channel" \
|
||||||
|
@ -101,7 +142,7 @@ if [ ${#amount} -eq 0 ]; then
|
||||||
echo
|
echo
|
||||||
echo "no valid amount entered - returning to menu ..."
|
echo "no valid amount entered - returning to menu ..."
|
||||||
sleep 4
|
sleep 4
|
||||||
exit 1
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# let user enter a confirmation target
|
# let user enter a confirmation target
|
||||||
|
@ -115,26 +156,31 @@ if [ ${#conf_target} -eq 0 ]; then
|
||||||
echo
|
echo
|
||||||
echo "no valid target entered - returning to menu ..."
|
echo "no valid target entered - returning to menu ..."
|
||||||
sleep 4
|
sleep 4
|
||||||
exit 1
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# build command
|
# build command
|
||||||
command="lncli --chain=${network} --network=${chain}net openchannel --conf_target=${conf_target} ${pubKey} ${amount} 0"
|
if [ $LNTYPE = cl ];then
|
||||||
|
# fundchannel id amount [feerate] [announce] [minconf] [utxos] [push_msat] [close_to]
|
||||||
|
feerate=$($bitcoincli_alias estimatesmartfee $conf_target |grep feerate|awk '{print $2}'|cut -c 5-7|bc)
|
||||||
|
command="$lightningcli_alias fundchannel ${pubKey} ${amount} $feerate"
|
||||||
|
elif [ $LNTYPE = lnd ];then
|
||||||
|
command="$lncli_alias openchannel --conf_target=${conf_target} ${pubKey} ${amount} 0"
|
||||||
|
fi
|
||||||
# info output
|
# info output
|
||||||
clear
|
clear
|
||||||
echo "******************************"
|
echo "******************************"
|
||||||
echo "Open Channel"
|
echo "Open Channel"
|
||||||
echo "******************************"
|
echo "******************************"
|
||||||
echo ""
|
echo
|
||||||
echo "COMMAND LINE: "
|
echo "COMMAND LINE: "
|
||||||
echo $command
|
echo $command
|
||||||
echo ""
|
echo
|
||||||
echo "RESULT:"
|
echo "RESULT:"
|
||||||
|
|
||||||
# execute command
|
# execute command
|
||||||
result=$($command 2>$_error)
|
result=$(eval $command 2>$_error)
|
||||||
error=`cat ${_error}`
|
error=$(cat ${_error})
|
||||||
|
|
||||||
#echo "result(${result})"
|
#echo "result(${result})"
|
||||||
#echo "error(${error})"
|
#echo "error(${error})"
|
||||||
|
@ -149,20 +195,33 @@ else
|
||||||
echo "WIN"
|
echo "WIN"
|
||||||
echo "******************************"
|
echo "******************************"
|
||||||
echo "${result}"
|
echo "${result}"
|
||||||
echo ""
|
echo
|
||||||
echo "Whats next? --> You need to wait 3 confirmations, for the channel to be ready."
|
echo "What's next? --> You need to wait 3 confirmations for the channel to be ready."
|
||||||
fundingTX=$(echo "${result}" | grep 'funding_txid' | cut -d '"' -f4)
|
if [ $LNTYPE = cl ];then
|
||||||
|
fundingTX=$(echo "${result}" | grep 'txid' | cut -d '"' -f4)
|
||||||
|
elif [ $LNTYPE = lnd ];then
|
||||||
|
fundingTX=$(echo "${result}" | grep 'funding_txid' | cut -d '"' -f4)
|
||||||
|
fi
|
||||||
|
echo
|
||||||
if [ "${network}" = "bitcoin" ]; then
|
if [ "${network}" = "bitcoin" ]; then
|
||||||
if [ "${chain}" = "main" ]; then
|
if [ "${chain}" = "main" ]; then
|
||||||
echo "https://live.blockcypher.com/btc/tx/${fundingTX}"
|
#echo "https://live.blockcypher.com/btc/tx/${fundingTX}"
|
||||||
else
|
echo "https://mempool.space/tx/${fundingTX}"
|
||||||
echo "https://live.blockcypher.com/btc-testnet/tx/${fundingTX}"
|
elif [ "${chain}" = "test" ]||[ "${chain}" = "sig" ]; then
|
||||||
|
echo "https://mempool.space/${chain}net/tx/${fundingTX}"
|
||||||
|
fi
|
||||||
|
echo
|
||||||
|
echo "In the Tor Browser:"
|
||||||
|
if [ "${chain}" = "main" ]; then
|
||||||
|
echo "http://mempoolhqx4isw62xs7abwphsq7ldayuidyx2v2oethdhhj6mlo2r6ad.onion/tx/${fundingTX}"
|
||||||
|
elif [ "${chain}" = "test" ]||[ "${chain}" = "sig" ]; then
|
||||||
|
echo "http://mempoolhqx4isw62xs7abwphsq7ldayuidyx2v2oethdhhj6mlo2r6ad.onion/${chain}net/tx/${fundingTX}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ "${network}" = "litecoin" ]; then
|
if [ "${network}" = "litecoin" ]; then
|
||||||
echo "https://live.blockcypher.com/ltc/tx/${fundingTX}/"
|
echo "https://live.blockcypher.com/ltc/tx/${fundingTX}/"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
echo ""
|
echo
|
||||||
echo "Press ENTER to return to main menu."
|
echo "Press ENTER to return to main menu."
|
||||||
read key
|
read key
|
|
@ -1,5 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
clear
|
clear
|
||||||
|
trap 'rm -f "$_temp"' EXIT
|
||||||
|
trap 'rm -f "$_error"' EXIT
|
||||||
_temp=$(mktemp -p /dev/shm/)
|
_temp=$(mktemp -p /dev/shm/)
|
||||||
_error=$(mktemp -p /dev/shm/)
|
_error=$(mktemp -p /dev/shm/)
|
||||||
sudo chmod 7777 ${_error} 2>/dev/null
|
sudo chmod 7777 ${_error} 2>/dev/null
|
||||||
|
@ -7,17 +9,59 @@ sudo chmod 7777 ${_error} 2>/dev/null
|
||||||
# load raspiblitz config data (with backup from old config)
|
# load raspiblitz config data (with backup from old config)
|
||||||
source /home/admin/raspiblitz.info
|
source /home/admin/raspiblitz.info
|
||||||
source /mnt/hdd/raspiblitz.conf
|
source /mnt/hdd/raspiblitz.conf
|
||||||
if [ ${#network} -eq 0 ]; then network=`cat .network`; fi
|
if [ ${#network} -eq 0 ]; then network=$(cat .network); fi
|
||||||
if [ ${#network} -eq 0 ]; then network="bitcoin"; fi
|
if [ ${#network} -eq 0 ]; then network="bitcoin"; fi
|
||||||
if [ ${#chain} -eq 0 ]; then
|
if [ ${#chain} -eq 0 ]; then
|
||||||
echo "gathering chain info ... please wait"
|
echo "gathering chain info ... please wait"
|
||||||
chain=$(${network}-cli getblockchaininfo | jq -r '.chain')
|
chain=$(${network}-cli getblockchaininfo | jq -r '.chain')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if ready (chain in sync and channels open)
|
source <(/home/admin/config.scripts/network.aliases.sh getvars $1 $2)
|
||||||
./XXchainInSync.sh $network $chain
|
|
||||||
if [ $? != 0 ]; then
|
source <(/home/admin/config.scripts/network.aliases.sh getvars $LNTYPE ${chain}net)
|
||||||
exit 1
|
|
||||||
|
# check if chain is in sync
|
||||||
|
if [ $LNTYPE = cl ];then
|
||||||
|
lncommand="${netprefix}lightning-cli"
|
||||||
|
BLOCKHEIGHT=$($bitcoincli_alias getblockchaininfo|grep blocks|awk '{print $2}'|cut -d, -f1)
|
||||||
|
CLHEIGHT=$($lightningcli_alias getinfo | jq .blockheight)
|
||||||
|
if [ $BLOCKHEIGHT -eq $CLHEIGHT ];then
|
||||||
|
cmdChainInSync=1
|
||||||
|
else
|
||||||
|
cmdChainInSync=0
|
||||||
|
fi
|
||||||
|
elif [ $LNTYPE = lnd ];then
|
||||||
|
lncommand="${netprefix}lncli"
|
||||||
|
cmdChainInSync="$lncli_alias getinfo | grep '"synced_to_chain": true' -c"
|
||||||
|
fi
|
||||||
|
chainInSync=${cmdChainInSync}
|
||||||
|
while [ "${chainInSync}" == "0" ]; do
|
||||||
|
dialog --title "Fail: not in sync" \
|
||||||
|
--ok-label "Try now" \
|
||||||
|
--cancel-label "Give up" \
|
||||||
|
--pause "\n\n'$lncommand getinfo' shows 'synced_to_chain': false\n\nTry again in a few seconds." 15 60 5
|
||||||
|
|
||||||
|
if [ $? -gt 0 ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
chainInSync=${cmdChainInSync}
|
||||||
|
done
|
||||||
|
|
||||||
|
# check number of connected peers
|
||||||
|
echo "check for open channels"
|
||||||
|
if [ $LNTYPE = cl ];then
|
||||||
|
openChannels=$($lightningcli_alias listpeers | grep -c "CHANNELD_NORMAL")
|
||||||
|
elif [ $LNTYPE = lnd ];then
|
||||||
|
openChannels=$($lncli_alias listchannels 2>/dev/null | grep chan_id -c)
|
||||||
|
fi
|
||||||
|
if [ ${openChannels} -eq 0 ]; then
|
||||||
|
echo
|
||||||
|
echo "!!!!!!!!!!!!!!!!!!!"
|
||||||
|
echo "FAIL - You have NO ESTABLISHED CHANNELS .. open a channel first."
|
||||||
|
echo "!!!!!!!!!!!!!!!!!!!"
|
||||||
|
sleep 3
|
||||||
|
echo
|
||||||
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
paymentRequestStart="???"
|
paymentRequestStart="???"
|
||||||
|
@ -36,7 +80,7 @@ if [ "${network}" = "bitcoin" ]; then
|
||||||
if [ "${chain}" = "main" ]; then
|
if [ "${chain}" = "main" ]; then
|
||||||
testSite="https://satoshis.place"
|
testSite="https://satoshis.place"
|
||||||
else
|
else
|
||||||
testSite="https://testnet.satoshis.place"
|
testSite="https://starblocks.acinq.co/"
|
||||||
fi
|
fi
|
||||||
elif [ "${network}" = "litecoin" ]; then
|
elif [ "${network}" = "litecoin" ]; then
|
||||||
testSite="https://millionlitecoinhomepage.net"
|
testSite="https://millionlitecoinhomepage.net"
|
||||||
|
@ -46,7 +90,7 @@ fi
|
||||||
l1="Copy the LightningInvoice/PaymentRequest into here:"
|
l1="Copy the LightningInvoice/PaymentRequest into here:"
|
||||||
l2="Its a long string starting with '${paymentRequestStart}'"
|
l2="Its a long string starting with '${paymentRequestStart}'"
|
||||||
l3="To try it out go to: ${testSite}"
|
l3="To try it out go to: ${testSite}"
|
||||||
dialog --title "Pay thru Lightning Network" \
|
dialog --title "Pay through the Lightning Network" \
|
||||||
--inputbox "$l1\n$l2\n$l3" 10 70 2>$_temp
|
--inputbox "$l1\n$l2\n$l3" 10 70 2>$_temp
|
||||||
invoice=$(cat $_temp | xargs)
|
invoice=$(cat $_temp | xargs)
|
||||||
shred -u $_temp
|
shred -u $_temp
|
||||||
|
@ -54,36 +98,45 @@ if [ ${#invoice} -eq 0 ]; then
|
||||||
clear
|
clear
|
||||||
echo
|
echo
|
||||||
echo "no invoice entered - returning to menu ..."
|
echo "no invoice entered - returning to menu ..."
|
||||||
sleep 2
|
sleep 3
|
||||||
exit 1
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# TODO: maybe try/show the decoded info first by using https://api.lightning.community/#decodepayreq
|
# TODO: maybe try/show the decoded info first by using https://api.lightning.community/#decodepayreq
|
||||||
|
|
||||||
# build command
|
# build command
|
||||||
command="lncli --chain=${network} --network=${chain}net sendpayment --force --pay_req=${invoice}"
|
if [ $LNTYPE = cl ];then
|
||||||
|
# pay bolt11 [msatoshi] [label] [riskfactor] [maxfeepercent] [retry_for] [maxdelay] [exemptfee]
|
||||||
|
command="$lightningcli_alias pay ${invoice}"
|
||||||
|
elif [ $LNTYPE = lnd ];then
|
||||||
|
command="$lncli_alias sendpayment --force --pay_req=${invoice}"
|
||||||
|
fi
|
||||||
|
|
||||||
# info output
|
# info output
|
||||||
clear
|
clear
|
||||||
echo "************************************************************"
|
echo "************************************************************"
|
||||||
echo "Pay Invoice / Payment Request"
|
echo "Pay Invoice / Payment Request"
|
||||||
echo "This script is as an example how to use the lncli interface."
|
echo "This script is an example using lightning in the command line."
|
||||||
echo "Its not optimized for performance or error handling."
|
echo "It is not optimized for performance or error handling."
|
||||||
echo "************************************************************"
|
echo "************************************************************"
|
||||||
echo ""
|
echo
|
||||||
echo "COMMAND LINE: "
|
echo "COMMAND LINE: "
|
||||||
echo $command
|
echo $command
|
||||||
echo ""
|
echo
|
||||||
echo "RESULT (may wait in case of timeout):"
|
echo "RESULT (may wait in case of timeout):"
|
||||||
|
|
||||||
# execute command
|
# execute command
|
||||||
result=$($command 2>$_error)
|
result=$($command 2>$_error)
|
||||||
error=`cat ${_error}`
|
error=$(cat ${_error})
|
||||||
|
|
||||||
#echo "result(${result})"
|
#echo "result(${result})"
|
||||||
#echo "error(${error})"
|
#echo "error(${error})"
|
||||||
|
|
||||||
resultIsError=$(echo "${result}" | grep -c "payment_error")
|
if [ $LNTYPE = cl ];then
|
||||||
|
resultIsError=$(echo "${result}" | grep -c '"code":')
|
||||||
|
elif [ $LNTYPE = lnd ];then
|
||||||
|
resultIsError=$(echo "${result}" | grep -c "payment_error")
|
||||||
|
fi
|
||||||
if [ ${resultIsError} -gt 0 ]; then
|
if [ ${resultIsError} -gt 0 ]; then
|
||||||
error="${result}"
|
error="${result}"
|
||||||
fi
|
fi
|
||||||
|
@ -99,8 +152,8 @@ else
|
||||||
echo "******************************"
|
echo "******************************"
|
||||||
echo "WIN"
|
echo "WIN"
|
||||||
echo "******************************"
|
echo "******************************"
|
||||||
echo "It worked :) - check out the service you were paying."
|
echo "It worked :) - check the service you were paying."
|
||||||
fi
|
fi
|
||||||
echo ""
|
echo
|
||||||
echo "Press ENTER to return to main menu."
|
echo "Press ENTER to return to main menu."
|
||||||
read key
|
read key
|
||||||
|
|
|
@ -522,7 +522,7 @@ class AppWindow(QMainWindow):
|
||||||
|
|
||||||
process = QProcess(self)
|
process = QProcess(self)
|
||||||
process.start('uxterm', ['-fa', 'Terminus', '-fs', '9', '-fn', 'fixed', '-into', str(int(self.ui.widget.winId())),
|
process.start('uxterm', ['-fa', 'Terminus', '-fs', '9', '-fn', 'fixed', '-into', str(int(self.ui.widget.winId())),
|
||||||
'+sb', '-hold', '-e', 'bash -c \"sudo /home/admin/XXshutdown.sh\"'])
|
'+sb', '-hold', '-e', 'bash -c \"sudo /home/admin/config.scripts/blitz.shutdown.sh\"'])
|
||||||
|
|
||||||
def b4_restart(self):
|
def b4_restart(self):
|
||||||
log.info("restart")
|
log.info("restart")
|
||||||
|
@ -532,7 +532,7 @@ class AppWindow(QMainWindow):
|
||||||
|
|
||||||
process = QProcess(self)
|
process = QProcess(self)
|
||||||
process.start('uxterm', ['-fa', 'Terminus', '-fs', '9', '-fn', 'fixed', '-into', str(int(self.ui.widget.winId())),
|
process.start('uxterm', ['-fa', 'Terminus', '-fs', '9', '-fn', 'fixed', '-into', str(int(self.ui.widget.winId())),
|
||||||
'+sb', '-hold', '-e', 'bash -c \"sudo /home/admin/XXshutdown.sh reboot\"'])
|
'+sb', '-hold', '-e', 'bash -c \"sudo /home/admin/config.scripts/blitz.shutdown.sh reboot\"'])
|
||||||
|
|
||||||
def create_new_invoice(self, memo="Pay to RaspiBlitz", amt=0):
|
def create_new_invoice(self, memo="Pay to RaspiBlitz", amt=0):
|
||||||
if IS_DEV_ENV:
|
if IS_DEV_ENV:
|
||||||
|
|
|
@ -1,37 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Check if lnd is synced to chain and channels are open
|
|
||||||
# If it isn't, wait until it is
|
|
||||||
# exits with 1 if it isn't.
|
|
||||||
|
|
||||||
network=$1
|
|
||||||
chain=$2
|
|
||||||
|
|
||||||
# check if chain is in sync
|
|
||||||
cmdChainInSync="lncli --chain=${network} --network=${chain}net getinfo | grep '"synced_to_chain": true' -c"
|
|
||||||
chainInSync=${cmdChainInSync}
|
|
||||||
while [ "${chainInSync}" == "0" ]; do
|
|
||||||
dialog --title "Fail: not in sync" \
|
|
||||||
--ok-label "Try now" \
|
|
||||||
--cancel-label "Give up" \
|
|
||||||
--pause "\n\n'lncli getinfo' shows 'synced_to_chain': false\n\nTry again in a few seconds." 15 60 5
|
|
||||||
|
|
||||||
if [ $? -gt 0 ]; then
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
chainInSync=${cmdChainInSync}
|
|
||||||
done
|
|
||||||
|
|
||||||
# check number of connected peers
|
|
||||||
echo "check for open channels"
|
|
||||||
openChannels=$(sudo -u bitcoin /usr/local/bin/lncli --chain=${network} --network=${chain}net listchannels 2>/dev/null | grep chan_id -c)
|
|
||||||
if [ ${openChannels} -eq 0 ]; then
|
|
||||||
echo ""
|
|
||||||
echo "!!!!!!!!!!!!!!!!!!!"
|
|
||||||
echo "FAIL - You have NO ESTABLISHED CHANNELS .. open a channel first."
|
|
||||||
echo "!!!!!!!!!!!!!!!!!!!"
|
|
||||||
echo ""
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
exit 0
|
|
|
@ -1,220 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# USE THIS SCRIPT FOR BASIC SYSTEM STATUS DEBUG INFO
|
|
||||||
|
|
||||||
# load code software version
|
|
||||||
source /home/admin/_version.info
|
|
||||||
|
|
||||||
## get basic info (its OK if not set yet)
|
|
||||||
source /home/admin/raspiblitz.info 2>/dev/null
|
|
||||||
source /mnt/hdd/raspiblitz.conf 2>/dev/null
|
|
||||||
|
|
||||||
# for old nodes
|
|
||||||
if [ ${#network} -eq 0 ]; then
|
|
||||||
echo "backup info: network"
|
|
||||||
network="bitcoin"
|
|
||||||
litecoinActive=$(sudo ls /mnt/hdd/litecoin/litecoin.conf | grep -c 'litecoin.conf')
|
|
||||||
if [ ${litecoinActive} -eq 1 ]; then
|
|
||||||
network="litecoin"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# for non final config nodes
|
|
||||||
if [ ${#chain} -eq 0 ]; then
|
|
||||||
echo "backup info: chain"
|
|
||||||
chain="test"
|
|
||||||
isMainChain=$(sudo cat /mnt/hdd/${network}/${network}.conf 2>/dev/null | grep "testnet=0" -c)
|
|
||||||
if [ ${isMainChain} -gt 0 ];then
|
|
||||||
chain="main"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
clear
|
|
||||||
echo ""
|
|
||||||
echo "***************************************************************"
|
|
||||||
echo "* RASPIBLITZ DEBUG LOGS "
|
|
||||||
echo "***************************************************************"
|
|
||||||
echo "blitzversion: ${codeVersion}"
|
|
||||||
echo "chainnetwork: ${network} / ${chain}"
|
|
||||||
uptime
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
echo "*** BLOCKCHAIN SYSTEMD STATUS ***"
|
|
||||||
sudo systemctl status ${network}d -n2 --no-pager
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
echo "*** LAST BLOCKCHAIN ERROR LOGS ***"
|
|
||||||
echo "sudo journalctl -u ${network}d -b --no-pager -n8"
|
|
||||||
sudo journalctl -u ${network}d -b --no-pager -n8
|
|
||||||
cat /home/admin/systemd.blockchain.log | grep "ERROR" | tail -n -2
|
|
||||||
echo ""
|
|
||||||
echo "*** LAST BLOCKCHAIN 20 INFO LOGS ***"
|
|
||||||
pathAdd=""
|
|
||||||
if [ "${chain}" = "test" ]; then
|
|
||||||
pathAdd="/testnet3"
|
|
||||||
fi
|
|
||||||
echo "sudo tail -n 20 /mnt/hdd/${network}${pathAdd}/debug.log"
|
|
||||||
sudo tail -n 20 /mnt/hdd/${network}${pathAdd}/debug.log
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
echo "*** LND SYSTEMD STATUS ***"
|
|
||||||
sudo systemctl status lnd -n2 --no-pager
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
echo "*** LAST LND ERROR LOGS ***"
|
|
||||||
echo "sudo journalctl -u lnd -b --no-pager -n12"
|
|
||||||
sudo journalctl -u lnd -b --no-pager -n12
|
|
||||||
cat /home/admin/systemd.lightning.log | grep "ERROR" | tail -n -1
|
|
||||||
echo ""
|
|
||||||
echo "*** LAST 30 LND INFO LOGS ***"
|
|
||||||
echo "sudo tail -n 30 /mnt/hdd/lnd/logs/${network}/${chain}net/lnd.log"
|
|
||||||
sudo tail -n 30 /mnt/hdd/lnd/logs/${network}/${chain}net/lnd.log
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
echo "*** NGINX SYSTEMD STATUS ***"
|
|
||||||
sudo systemctl status nginx -n2 --no-pager
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
echo "*** LAST NGINX LOGS ***"
|
|
||||||
echo "sudo journalctl -u nginx -b --no-pager -n20"
|
|
||||||
sudo journalctl -u nginx -b --no-pager -n20
|
|
||||||
echo "--> CHECK CONFIG: sudo nginx -t"
|
|
||||||
sudo nginx -t
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
if [ "${touchscreen}" = "0" ]; then
|
|
||||||
echo "- TOUCHSCREEN is OFF by config"
|
|
||||||
else
|
|
||||||
echo ""
|
|
||||||
echo "*** LAST 20 TOUCHSCREEN LOGS ***"
|
|
||||||
echo "sudo tail -n 20 /home/pi/.cache/lxsession/LXDE-pi/run.log"
|
|
||||||
sudo tail -n 20 /home/pi/.cache/lxsession/LXDE-pi/run.log
|
|
||||||
echo ""
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "${loop}" = "off" ]; then
|
|
||||||
echo "- Loop is OFF by config"
|
|
||||||
else
|
|
||||||
echo ""
|
|
||||||
echo "*** LAST 20 LOOP LOGS ***"
|
|
||||||
echo "sudo journalctl -u loopd -b --no-pager -n20"
|
|
||||||
sudo journalctl -u loopd -b --no-pager -n20
|
|
||||||
echo ""
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "${rtlWebinterface}" = "off" ]; then
|
|
||||||
echo "- RTL is OFF by config"
|
|
||||||
else
|
|
||||||
echo ""
|
|
||||||
echo "*** LAST 20 RTL LOGS ***"
|
|
||||||
echo "sudo journalctl -u RTL -b --no-pager -n20"
|
|
||||||
sudo journalctl -u RTL -b --no-pager -n20
|
|
||||||
echo ""
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "${ElectRS}" = "off" ]; then
|
|
||||||
echo "- Electrum Rust Server is OFF by config"
|
|
||||||
else
|
|
||||||
echo ""
|
|
||||||
echo "*** LAST 20 ElectRS LOGS ***"
|
|
||||||
echo "sudo journalctl -u electrs -b --no-pager -n20"
|
|
||||||
sudo journalctl -u electrs -b --no-pager -n20
|
|
||||||
echo ""
|
|
||||||
echo "*** ElectRS Status ***"
|
|
||||||
sudo /home/admin/config.scripts/bonus.electrs.sh status
|
|
||||||
echo ""
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "${lit}" = "off" ]; then
|
|
||||||
echo "- LIT is OFF by config"
|
|
||||||
else
|
|
||||||
echo ""
|
|
||||||
echo "*** LAST 20 LIT LOGS ***"
|
|
||||||
echo "sudo journalctl -u litd -b --no-pager -n20"
|
|
||||||
sudo journalctl -u litd -b --no-pager -n20
|
|
||||||
echo ""
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "${BTCPayServer}" = "off" ]; then
|
|
||||||
echo "- BTCPayServer is OFF by config"
|
|
||||||
else
|
|
||||||
echo ""
|
|
||||||
echo "*** LAST 20 BTCPayServer LOGS ***"
|
|
||||||
echo "sudo journalctl -u btcpayserver -b --no-pager -n20"
|
|
||||||
sudo journalctl -u btcpayserver -b --no-pager -n20
|
|
||||||
echo ""
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "${LNBits}" = "off" ]; then
|
|
||||||
echo "- LNbits is OFF by config"
|
|
||||||
else
|
|
||||||
echo ""
|
|
||||||
echo "*** LAST 20 LNbits LOGS ***"
|
|
||||||
echo "sudo journalctl -u lnbits -b --no-pager -n20"
|
|
||||||
sudo journalctl -u lnbits -b --no-pager -n20
|
|
||||||
echo ""
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "${thunderhub}" = "off" ]; then
|
|
||||||
echo "- Thunderhub is OFF by config"
|
|
||||||
else
|
|
||||||
echo ""
|
|
||||||
echo "*** LAST 20 Thunderhub LOGS ***"
|
|
||||||
echo "sudo journalctl -u thunderhub -b --no-pager -n20"
|
|
||||||
sudo journalctl -u thunderhub -b --no-pager -n20
|
|
||||||
echo ""
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "${specter}" = "off" ]; then
|
|
||||||
echo "- SPECTER is OFF by config"
|
|
||||||
else
|
|
||||||
echo ""
|
|
||||||
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 ""
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "${sphinxrelay}" = "off" ]; then
|
|
||||||
echo "- SPHINX is OFF by config"
|
|
||||||
else
|
|
||||||
echo ""
|
|
||||||
echo "*** LAST 20 SPHINX LOGS ***"
|
|
||||||
echo "sudo journalctl -u sphinxrelay -b --no-pager -n20"
|
|
||||||
sudo journalctl -u sphinxrelay -b --no-pager -n20
|
|
||||||
echo ""
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "*** MOUNTED DRIVES ***"
|
|
||||||
df -T -h
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "*** DATADRIVE ***"
|
|
||||||
sudo /home/admin/config.scripts/blitz.datadrive.sh status
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
echo "*** NETWORK ***"
|
|
||||||
sudo /home/admin/config.scripts/internet.sh status | grep 'network_device\|localip\|dhcp'
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
echo "*** HARDWARE TEST RESULTS ***"
|
|
||||||
showImproveInfo=0
|
|
||||||
if [ ${#undervoltageReports} -gt 0 ]; then
|
|
||||||
echo "UndervoltageReports in Logs: ${undervoltageReports}"
|
|
||||||
if [ ${undervoltageReports} -gt 0 ]; then
|
|
||||||
showImproveInfo=1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
echo "*** SYSTEM STATUS (can take some seconds to gather) ***"
|
|
||||||
sudo /home/admin/config.scripts/blitz.statusscan.sh
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
echo "*** OPTION: SHARE THIS DEBUG OUTPUT ***"
|
|
||||||
echo "An easy way to share this debug output on GitHub or on a support chat"
|
|
||||||
echo "use the following command and share the resulting link:"
|
|
||||||
echo "/home/admin/XXdebugLogs.sh | nc termbin.com 9999"
|
|
||||||
echo ""
|
|
|
@ -37,20 +37,52 @@ do
|
||||||
# count up
|
# count up
|
||||||
counter=$(($counter+1))
|
counter=$(($counter+1))
|
||||||
|
|
||||||
|
# limit counter to max seconds per week:
|
||||||
|
# 604800 = 60sec * 60min * 24hours * 7days
|
||||||
|
if [ ${counter} -gt 604800 ]; then
|
||||||
|
counter=0
|
||||||
|
echo "counter zero reset"
|
||||||
|
fi
|
||||||
|
|
||||||
# gather the uptime seconds
|
# gather the uptime seconds
|
||||||
upSeconds=$(cat /proc/uptime | grep -o '^[0-9]\+')
|
upSeconds=$(cat /proc/uptime | grep -o '^[0-9]\+')
|
||||||
|
|
||||||
# prevent restart if COPY OVER LAN is running
|
# source info file fresh on every loop
|
||||||
# see: https://github.com/rootzoll/raspiblitz/issues/1179#issuecomment-646079467
|
source ${infoFile} 2>/dev/null
|
||||||
source ${infoFile}
|
|
||||||
if [ "${state}" == "copysource" ]; then
|
####################################################
|
||||||
echo "copysource mode: skipping background loop"
|
# SKIP BACKGROUND TASK LOOP ON CERTAIN SYSTEM STATES
|
||||||
sleep 10
|
# https://github.com/rootzoll/raspiblitz/issues/160
|
||||||
|
####################################################
|
||||||
|
|
||||||
|
if [ "${state}" == "" ] || [ "${state}" == "copysource" ] || [ "${state}" == "copytarget" ]; then
|
||||||
|
echo "skipping background loop (${counter}) - state(${state})"
|
||||||
|
sleep 1
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
####################################################
|
####################################################
|
||||||
# RECHECK DHCP-SERVER
|
# CHECK IF LOCAL IP CHANGED
|
||||||
|
####################################################
|
||||||
|
oldLocalIP="${localip}";
|
||||||
|
source <(/home/admin/config.scripts/internet.sh status)
|
||||||
|
if [ "${oldLocalIP}" != "${localip}" ]; then
|
||||||
|
echo "local IP changed old(${oldLocalIP}) new(${localip}) - updating in raspiblitz.info"
|
||||||
|
sed -i "s/^localip=.*/localip='${localip}'/g" ${infoFile}
|
||||||
|
fi
|
||||||
|
|
||||||
|
####################################################
|
||||||
|
# SKIP REST OF THE TASKS IF STILL IN SETUP PHASE
|
||||||
|
####################################################
|
||||||
|
|
||||||
|
if [ "${setupPhase}" != "done" ]; then
|
||||||
|
echo "skipping rest of tasks because still in setupPhase(${setupPhase})"
|
||||||
|
sleep 1
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
####################################################
|
||||||
|
# RECHECK DHCP-SERVER
|
||||||
# https://github.com/rootzoll/raspiblitz/issues/160
|
# https://github.com/rootzoll/raspiblitz/issues/160
|
||||||
####################################################
|
####################################################
|
||||||
|
|
||||||
|
@ -60,13 +92,13 @@ do
|
||||||
echo "*** RECHECK DHCP-SERVER ***"
|
echo "*** RECHECK DHCP-SERVER ***"
|
||||||
|
|
||||||
# get the local network IP
|
# get the local network IP
|
||||||
localip=$(ip addr | grep 'state UP' -A2 | egrep -v 'docker0|veth' | grep 'eth0\|wlan0\|enp0' | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
|
localip=$(hostname -I | awk '{print $1}')
|
||||||
echo "localip(${localip})"
|
echo "localip(${localip})"
|
||||||
|
|
||||||
# detect a missing DHCP config
|
# detect a missing DHCP config
|
||||||
if [ "${localip:0:4}" = "169." ]; then
|
if [ "${localip:0:4}" = "169." ]; then
|
||||||
echo "Missing DHCP detected ... trying emergency reboot"
|
echo "Missing DHCP detected ... trying emergency reboot"
|
||||||
sudo /home/admin/XXshutdown.sh reboot
|
sudo /home/admin/config.scripts/blitz.shutdown.sh reboot
|
||||||
else
|
else
|
||||||
echo "DHCP OK"
|
echo "DHCP OK"
|
||||||
fi
|
fi
|
||||||
|
@ -127,42 +159,57 @@ do
|
||||||
if [ ${publicIPChanged} -gt 0 ]; then
|
if [ ${publicIPChanged} -gt 0 ]; then
|
||||||
|
|
||||||
echo "*** change of public IP detected ***"
|
echo "*** change of public IP detected ***"
|
||||||
echo " old: ${publicIP}"
|
|
||||||
|
# store the old IP address
|
||||||
|
publicIP_Old="${publicIP}"
|
||||||
# refresh data
|
# refresh data
|
||||||
source /mnt/hdd/raspiblitz.conf
|
source /mnt/hdd/raspiblitz.conf
|
||||||
echo " new: ${publicIP}"
|
# store the new IP address
|
||||||
|
publicIP_New="${publicIP}"
|
||||||
|
# some log output
|
||||||
|
echo " old: ${publicIP_Old}"
|
||||||
|
echo " new: ${publicIP_New}"
|
||||||
|
|
||||||
# if we run on IPv6 only, the global IPv6 address at the current network device (e.g: eth0) is the public IP
|
# if we run on IPv6 only, the global IPv6 address at the current network device (e.g: eth0) is the public IP
|
||||||
if [ "${ipv6}" = "on" ]; then
|
if [ "${ipv6}" = "on" ]; then
|
||||||
# restart bitcoind as the global IP is stored in the node configuration
|
# if the old or the new IPv6 address is "::1" something has gone wrong in "internet.sh update-publicip" => no need to restart services
|
||||||
# and we will get more connections if this matches our real IP address
|
if [ "${publicIP_Old}" != "::1" ] && [ "${publicIP_New}" != "::1" ]; then
|
||||||
# otherwise the bitcoin-node connections will slowly decline
|
# restart bitcoind as the global IP is stored in the node configuration
|
||||||
echo "IPv6 only is enabled => restart bitcoind to pickup up new publicIP as local IP"
|
# and we will get more connections if this matches our real IP address
|
||||||
sudo systemctl stop bitcoind
|
# otherwise the bitcoin-node connections will slowly decline
|
||||||
sleep 3
|
echo "IPv6 only is enabled => restart bitcoind to pickup up new publicIP as local IP"
|
||||||
sudo systemctl start bitcoind
|
sudo systemctl stop bitcoind
|
||||||
|
sleep 3
|
||||||
# if BTCRPCexplorer is currently running
|
sudo systemctl start bitcoind
|
||||||
# it needs to be restarted to pickup the new IP for its "Node Status Page"
|
|
||||||
# but this is only needed in IPv6 only mode
|
|
||||||
breIsRunning=$(sudo systemctl status btc-rpc-explorer 2>/dev/null | grep -c 'active (running)')
|
|
||||||
if [ ${breIsRunning} -eq 1 ]; then
|
|
||||||
echo "BTCRPCexplorer is running => restart BTCRPCexplorer to pickup up new publicIP for the bitcoin node"
|
|
||||||
sudo systemctl stop btc-rpc-explorer
|
|
||||||
sudo systemctl start btc-rpc-explorer
|
|
||||||
else
|
|
||||||
echo "new publicIP but no BTCRPCexplorer restart because not running"
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
# if BTCRPCexplorer is currently running
|
||||||
|
# it needs to be restarted to pickup the new IP for its "Node Status Page"
|
||||||
|
# but this is only needed in IPv6 only mode
|
||||||
|
breIsRunning=$(sudo systemctl status btc-rpc-explorer 2>/dev/null | grep -c 'active (running)')
|
||||||
|
if [ ${breIsRunning} -eq 1 ]; then
|
||||||
|
echo "BTCRPCexplorer is running => restart BTCRPCexplorer to pickup up new publicIP for the bitcoin node"
|
||||||
|
sudo systemctl stop btc-rpc-explorer
|
||||||
|
sudo systemctl start btc-rpc-explorer
|
||||||
|
else
|
||||||
|
echo "new publicIP but no BTCRPCexplorer restart because not running"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "IPv6 only is ON, but publicIP_Old OR publicIP_New is equal ::1 => no need to restart bitcoind nor BTCRPCexplorer"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "IPv6 only is OFF => no need to restart bitcoind nor BTCRPCexplorer"
|
echo "IPv6 only is OFF => no need to restart bitcoind nor BTCRPCexplorer"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# only restart LND if auto-unlock is activated
|
# only restart LND if auto-unlock is activated
|
||||||
|
# AND neither the old nor the new IPv6 address is "::1"
|
||||||
if [ "${autoUnlock}" = "on" ]; then
|
if [ "${autoUnlock}" = "on" ]; then
|
||||||
echo "restart LND to pickup up new publicIP"
|
if [ "${publicIP_Old}" != "::1" ] && [ "${publicIP_New}" != "::1" ]; then
|
||||||
sudo systemctl stop lnd
|
echo "restart LND to pickup up new publicIP"
|
||||||
sudo systemctl start lnd
|
sudo systemctl stop lnd
|
||||||
|
sudo systemctl start lnd
|
||||||
|
else
|
||||||
|
echo "publicIP_Old OR publicIP_New is equal ::1 => no need to restart LND"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "new publicIP but no LND restart because no auto-unlock"
|
echo "new publicIP but no LND restart because no auto-unlock"
|
||||||
fi
|
fi
|
||||||
|
@ -183,9 +230,9 @@ do
|
||||||
# check every 1min
|
# check every 1min
|
||||||
recheckSync=$(($counter % 60))
|
recheckSync=$(($counter % 60))
|
||||||
if [ ${recheckSync} -eq 1 ]; then
|
if [ ${recheckSync} -eq 1 ]; then
|
||||||
source <(sudo -u admin /home/admin/config.scripts/network.monitor.sh peer-status)
|
source <(sudo /home/admin/config.scripts/network.monitor.sh peer-status)
|
||||||
echo "Blockchain Sync Monitoring: peers=${peers}"
|
echo "Blockchain Sync Monitoring: peers=${peers}"
|
||||||
if [ "${peers}" == "0" ]; then
|
if [ "${peers}" == "0" ] && [ "${running}" == "1" ]; then
|
||||||
echo "Blockchain Sync Monitoring: ZERO PEERS DETECTED .. doing out-of-band kickstart"
|
echo "Blockchain Sync Monitoring: ZERO PEERS DETECTED .. doing out-of-band kickstart"
|
||||||
sudo /home/admin/config.scripts/network.monitor.sh peer-kickstart
|
sudo /home/admin/config.scripts/network.monitor.sh peer-kickstart
|
||||||
fi
|
fi
|
||||||
|
@ -221,7 +268,7 @@ do
|
||||||
fi
|
fi
|
||||||
blitzTUIHeartBeatLine="${latestHeartBeatLine}"
|
blitzTUIHeartBeatLine="${latestHeartBeatLine}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
###############################
|
###############################
|
||||||
# SCB Monitoring
|
# SCB Monitoring
|
||||||
###############################
|
###############################
|
||||||
|
@ -282,14 +329,19 @@ do
|
||||||
# check if a SCP backup target is set
|
# check if a SCP backup target is set
|
||||||
# parameter in raspiblitz.conf:
|
# parameter in raspiblitz.conf:
|
||||||
# scpBackupTarget='[USER]@[SERVER]:[DIRPATH-WITHOUT-ENDING-/]'
|
# scpBackupTarget='[USER]@[SERVER]:[DIRPATH-WITHOUT-ENDING-/]'
|
||||||
|
# optionally a custom option string for the scp command can be set with
|
||||||
|
# scpBackupOptions='[YOUR-CUSTOM-OPTIONS]'
|
||||||
# On target server add the public key of your RaspiBlitz to the authorized_keys for the user
|
# On target server add the public key of your RaspiBlitz to the authorized_keys for the user
|
||||||
# https://www.linode.com/docs/security/authentication/use-public-key-authentication-with-ssh/
|
# https://www.linode.com/docs/security/authentication/use-public-key-authentication-with-ssh/
|
||||||
if [ ${#scpBackupTarget} -gt 0 ]; then
|
if [ ${#scpBackupTarget} -gt 0 ]; then
|
||||||
echo "--> Offsite-Backup SCP Server"
|
echo "--> Offsite-Backup SCP Server"
|
||||||
|
if [ "${scpBackupOptions}" == "" ]; then
|
||||||
|
scpBackupOptions="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
|
||||||
|
fi
|
||||||
# its ok to ignore known host, because data is encrypted (worst case of MiM would be: no offsite channel backup)
|
# its ok to ignore known host, because data is encrypted (worst case of MiM would be: no offsite channel backup)
|
||||||
# but its more likely that without ignoring known host, script might not run thru and that way: no offsite channel backup
|
# but its more likely that without ignoring known host, script might not run thru and that way: no offsite channel backup
|
||||||
sudo scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ${localBackupPath} ${scpBackupTarget}/
|
sudo scp ${scpBackupOptions} ${localBackupPath} ${scpBackupTarget}/
|
||||||
sudo scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ${localTimestampedPath} ${scpBackupTarget}/
|
sudo scp ${scpBackupOptions} ${localTimestampedPath} ${scpBackupTarget}/
|
||||||
result=$?
|
result=$?
|
||||||
if [ ${result} -eq 0 ]; then
|
if [ ${result} -eq 0 ]; then
|
||||||
echo "OK - SCP Backup exited with 0"
|
echo "OK - SCP Backup exited with 0"
|
||||||
|
@ -314,6 +366,18 @@ do
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# check if Nextcloud backups are enabled
|
||||||
|
if [ $nextcloudBackupServer ] && [ $nextcloudBackupUser ] && [ $nextcloudBackupPassword ]; then
|
||||||
|
echo "--> Offsite-Backup Nextcloud"
|
||||||
|
source <(sudo /home/admin/config.scripts/nextcloud.upload.sh upload ${localBackupPath})
|
||||||
|
source <(sudo /home/admin/config.scripts/nextcloud.upload.sh upload ${localTimestampedPath})
|
||||||
|
if [ ${#err} -gt 0 ]; then
|
||||||
|
echo "FAIL - ${err}"
|
||||||
|
else
|
||||||
|
echo "OK - ${upload}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
#else
|
#else
|
||||||
# echo "Channel Backup File not changed."
|
# echo "Channel Backup File not changed."
|
||||||
fi
|
fi
|
||||||
|
@ -341,7 +405,7 @@ do
|
||||||
# check every hour
|
# check every hour
|
||||||
recheckRAID=$((($counter % 3600)+1))
|
recheckRAID=$((($counter % 3600)+1))
|
||||||
if [ ${recheckRAID} -eq 1 ]; then
|
if [ ${recheckRAID} -eq 1 ]; then
|
||||||
|
|
||||||
# check if raid is active
|
# check if raid is active
|
||||||
source <(sudo /home/admin/config.scripts/blitz.datadrive.sh status)
|
source <(sudo /home/admin/config.scripts/blitz.datadrive.sh status)
|
||||||
if [ ${isRaid} -eq 1 ]; then
|
if [ ${isRaid} -eq 1 ]; then
|
||||||
|
@ -354,7 +418,6 @@ do
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
###############################
|
###############################
|
||||||
# LND AUTO-UNLOCK
|
# LND AUTO-UNLOCK
|
||||||
###############################
|
###############################
|
||||||
|
@ -367,12 +430,12 @@ do
|
||||||
if [ "${autoUnlock}" = "on" ]; then
|
if [ "${autoUnlock}" = "on" ]; then
|
||||||
|
|
||||||
# check if lnd is locked
|
# check if lnd is locked
|
||||||
locked=$(sudo -u bitcoin /usr/local/bin/lncli --chain=${network} --network=${chain}net getinfo 2>&1 | grep -c unlock)
|
source <(/home/admin/config.scripts/lnd.unlock.sh status)
|
||||||
if [ ${locked} -gt 0 ]; then
|
if [ "${locked}" != "0" ]; then
|
||||||
|
|
||||||
echo "STARTING AUTO-UNLOCK ..."
|
echo "STARTING AUTO-UNLOCK ..."
|
||||||
sudo /home/admin/config.scripts/lnd.unlock.sh
|
sudo /home/admin/config.scripts/lnd.unlock.sh
|
||||||
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -406,9 +469,10 @@ do
|
||||||
recheckIBD=$((($counter % 60)+1))
|
recheckIBD=$((($counter % 60)+1))
|
||||||
if [ ${recheckIBD} -eq 1 ]; then
|
if [ ${recheckIBD} -eq 1 ]; then
|
||||||
# check if flag exists (got created on 50syncHDD.sh)
|
# check if flag exists (got created on 50syncHDD.sh)
|
||||||
flagExists=$(ls /home/admin/selfsync.flag 2>/dev/null | grep -c "selfsync.flag")
|
flagExists=$(ls /mnt/hdd/${network}/blocks/selfsync.flag 2>/dev/null | grep -c "selfsync.flag")
|
||||||
if [ ${flagExists} -eq 1 ]; then
|
if [ ${flagExists} -eq 1 ]; then
|
||||||
finishedIBD=$(sudo -u bitcoin ${network}-cli getblockchaininfo | grep "initialblockdownload" | grep -c "false")
|
source <(/home/admin/config.scripts/network.aliases.sh getvars)
|
||||||
|
finishedIBD=$($bitcoincli_alias getblockchaininfo | grep "initialblockdownload" | grep -c "false")
|
||||||
if [ ${finishedIBD} -eq 1 ]; then
|
if [ ${finishedIBD} -eq 1 ]; then
|
||||||
|
|
||||||
echo "CHECK FOR END OF IBD --> reduce RAM, check TOR and restart ${network}d"
|
echo "CHECK FOR END OF IBD --> reduce RAM, check TOR and restart ${network}d"
|
||||||
|
@ -444,18 +508,6 @@ do
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
###############################
|
|
||||||
# Set the address API use for BTC-RPC-Explorer depending on Electrs status
|
|
||||||
###############################
|
|
||||||
|
|
||||||
# check every 10 minutes
|
|
||||||
electrsExplorer=$((($counter % 600)+1))
|
|
||||||
if [ ${electrsExplorer} -eq 1 ]; then
|
|
||||||
if [ "${BTCRPCexplorer}" = "on" ]; then
|
|
||||||
/home/admin/config.scripts/bonus.electrsexplorer.sh
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
###############################
|
###############################
|
||||||
# Prepare next loop
|
# Prepare next loop
|
||||||
###############################
|
###############################
|
||||||
|
@ -463,12 +515,5 @@ do
|
||||||
# sleep 1 sec
|
# sleep 1 sec
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
# limit counter to max seconds per week:
|
|
||||||
# 604800 = 60sec * 60min * 24hours * 7days
|
|
||||||
if [ ${counter} -gt 604800 ]; then
|
|
||||||
counter=0
|
|
||||||
echo "counter zero reset"
|
|
||||||
fi
|
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
@ -1,252 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# LOGFILE - store debug logs of bootstrap
|
|
||||||
logFile="/home/admin/raspiblitz.log"
|
|
||||||
|
|
||||||
# INFOFILE - state data from bootstrap
|
|
||||||
infoFile="/home/admin/raspiblitz.info"
|
|
||||||
|
|
||||||
# CONFIGFILE - configuration of RaspiBlitz
|
|
||||||
configFile="/mnt/hdd/raspiblitz.conf"
|
|
||||||
|
|
||||||
# debug info
|
|
||||||
echo "STARTED Migration/Init --> see logs in ${logFile}"
|
|
||||||
echo "STARTED Migration/Init" >> ${logFile}
|
|
||||||
sudo sed -i "s/^message=.*/message='Running Data Migration'/g" ${infoFile}
|
|
||||||
|
|
||||||
# HDD BTRFS RAID REPAIR IF NEEDED
|
|
||||||
source <(sudo /home/admin/config.scripts/blitz.datadrive.sh status)
|
|
||||||
if [ ${isBTRFS} -eq 1 ] && [ ${isMounted} -eq 1 ]; then
|
|
||||||
echo "CHECK BTRFS RAID" >> ${logFile}
|
|
||||||
if [ ${isRaid} -eq 1 ] && [ ${#raidUsbDev} -eq 0 ]; then
|
|
||||||
echo "HDD was set to work in RAID, but RAID drive is not connected" >> ${logFile}
|
|
||||||
echo "Trying to set HDD back to single mode." >> ${logFile}
|
|
||||||
sudo /home/admin/config.scripts/blitz.datadrive.sh raid off >> ${logFile}
|
|
||||||
else
|
|
||||||
echo "OK" >> ${logFile}
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# LOAD DATA & PRECHECK
|
|
||||||
|
|
||||||
# check if there is a config file
|
|
||||||
configExists=$(ls ${configFile} 2>/dev/null | grep -c '.conf')
|
|
||||||
if [ ${configExists} -eq 0 ]; then
|
|
||||||
echo "FAIL see ${logFile}"
|
|
||||||
echo "FAIL: no config file (${configFile}) found to init or upgrade!" >> ${logFile}
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# load old or init raspiblitz config
|
|
||||||
source ${configFile}
|
|
||||||
|
|
||||||
# check if config files contains basic: hostname
|
|
||||||
if [ ${#hostname} -eq 0 ]; then
|
|
||||||
echo "FAIL see ${logFile}"
|
|
||||||
echo "FAIL: missing hostname in (${configFile})!" >> ${logFile}
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# load codeVersion
|
|
||||||
source /home/admin/_version.info
|
|
||||||
|
|
||||||
# check if code version was loaded
|
|
||||||
if [ ${#codeVersion} -eq 0 ]; then
|
|
||||||
echo "FAIL see ${logFile}"
|
|
||||||
echo "FAIL: no code version (/home/admin/_version.info) found!" >> ${logFile}
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "prechecks OK" >> ${logFile}
|
|
||||||
|
|
||||||
# DEFAULT VALUES - MISSING data fields on init or update
|
|
||||||
|
|
||||||
# AUTOPILOT
|
|
||||||
# autoPilot=off|on
|
|
||||||
if [ ${#autoPilot} -eq 0 ]; then
|
|
||||||
echo "autoPilot=off" >> $configFile
|
|
||||||
fi
|
|
||||||
|
|
||||||
# AUTO NAT DISCOVERY
|
|
||||||
# autoNatDiscovery=off|on
|
|
||||||
if [ ${#autoNatDiscovery} -eq 0 ]; then
|
|
||||||
echo "autoNatDiscovery=off" >> $configFile
|
|
||||||
fi
|
|
||||||
|
|
||||||
# TOR
|
|
||||||
# runBehindTor=off|on
|
|
||||||
if [ ${#runBehindTor} -eq 0 ]; then
|
|
||||||
echo "runBehindTor=off" >> $configFile
|
|
||||||
fi
|
|
||||||
|
|
||||||
# RideTheLightning RTL
|
|
||||||
# rtlWebinterface=off|on
|
|
||||||
if [ ${#rtlWebinterface} -eq 0 ]; then
|
|
||||||
echo "rtlWebinterface=off" >> $configFile
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "default values OK" >> ${logFile}
|
|
||||||
|
|
||||||
# MIGRATION - DATA CONVERSION when updating config
|
|
||||||
# this is the place if on a future version change
|
|
||||||
# a conversion of config data or app data is needed
|
|
||||||
|
|
||||||
# if old bitcoin.conf exists ...
|
|
||||||
configExists=$(sudo ls /mnt/hdd/bitcoin/bitcoin.conf | grep -c '.conf')
|
|
||||||
if [ ${configExists} -eq 1 ]; then
|
|
||||||
echo "Checking old bitcoin.conf ..." >> ${logFile}
|
|
||||||
|
|
||||||
# make sure to fix bitcoind RPC port if not done in old version
|
|
||||||
# https://github.com/rootzoll/raspiblitz/issues/217
|
|
||||||
# https://github.com/rootzoll/raspiblitz/issues/950
|
|
||||||
|
|
||||||
if ! grep -Eq "^rpcallowip=.*" /mnt/hdd/${network}/${network}.conf; then
|
|
||||||
echo "fix issue #217 -> adding rpcallowip=127.0.0.1" >> ${logFile}
|
|
||||||
echo "rpcallowip=127.0.0.1" >> /mnt/hdd/${network}/${network}.conf
|
|
||||||
else
|
|
||||||
echo "check issue #217 -> ok rpcallow exists" >> ${logFile}
|
|
||||||
fi
|
|
||||||
|
|
||||||
# check whether "main." needs to be added to rpcport and rpcbind
|
|
||||||
if grep -Eq "^rpcport=.*" /mnt/hdd/${network}/${network}.conf; then
|
|
||||||
echo "fix issue #950 -> change rpcport to main.rpcport" >> ${logFile}
|
|
||||||
sudo sed -i -E 's/^(rpcport=.*)/main.\1/g' /mnt/hdd/${network}/${network}.conf
|
|
||||||
else
|
|
||||||
echo "check issue #950 -> ok ^rpcport does not exist" >> ${logFile}
|
|
||||||
fi
|
|
||||||
|
|
||||||
if grep -Eq "^rpcbind=.*" /mnt/hdd/${network}/${network}.conf; then
|
|
||||||
echo "fix issue #950 -> change rpcbind to main.rpcbind" >> ${logFile}
|
|
||||||
sudo sed -i -E 's/^(rpcbind=.*)/main.\1/g' /mnt/hdd/${network}/${network}.conf
|
|
||||||
else
|
|
||||||
echo "check issue #950 -> ok ^rpcbind does not exist" >> ${logFile}
|
|
||||||
fi
|
|
||||||
|
|
||||||
# check whether right settings are there ("main.")
|
|
||||||
if ! grep -Eq "^main.rpcport=.*" /mnt/hdd/${network}/${network}.conf; then
|
|
||||||
echo "fix issue #217 -> adding main.rpcport=8332" >> ${logFile}
|
|
||||||
echo "main.rpcport=8332" >> /mnt/hdd/${network}/${network}.conf
|
|
||||||
else
|
|
||||||
echo "check issue #217 -> ok main.rpcport exists" >> ${logFile}
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! grep -Eq "^main.rpcbind=.*" /mnt/hdd/${network}/${network}.conf; then
|
|
||||||
echo "fix issue #217 -> adding main.rpcbind=127.0.0.1:8332" >> ${logFile}
|
|
||||||
echo "main.rpcbind=127.0.0.1:8332" >> /mnt/hdd/${network}/${network}.conf
|
|
||||||
else
|
|
||||||
echo "check issue #217 -> ok main.rpcbind exists" >> ${logFile}
|
|
||||||
fi
|
|
||||||
|
|
||||||
# same for testnet
|
|
||||||
if ! grep -Eq "^test.rpcport=.*" /mnt/hdd/${network}/${network}.conf; then
|
|
||||||
echo "fix issue #950 -> adding test.rpcport=18332" >> ${logFile}
|
|
||||||
echo "test.rpcport=18332" >> /mnt/hdd/${network}/${network}.conf
|
|
||||||
else
|
|
||||||
echo "check issue #950 -> ok test.rpcport exists" >> ${logFile}
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! grep -Eq "^test.rpcbind=.*" /mnt/hdd/${network}/${network}.conf; then
|
|
||||||
echo "fix issue #950 -> adding test.rpcbind=127.0.0.1:18332" >> ${logFile}
|
|
||||||
echo "test.rpcbind=127.0.0.1:18332" >> /mnt/hdd/${network}/${network}.conf
|
|
||||||
else
|
|
||||||
echo "check issue #950 -> ok test.rpcbind exists" >> ${logFile}
|
|
||||||
fi
|
|
||||||
|
|
||||||
else
|
|
||||||
echo "WARN: /mnt/hdd/bitcoin/bitcoin.conf not found" >> ${logFile}
|
|
||||||
fi
|
|
||||||
|
|
||||||
# if old lnd.conf exists ...
|
|
||||||
configExists=$(sudo ls /mnt/hdd/lnd/lnd.conf | grep -c '.conf')
|
|
||||||
if [ ${configExists} -eq 1 ]; then
|
|
||||||
|
|
||||||
# remove RPC user & pass from lnd.conf ... since v1.7
|
|
||||||
# https://github.com/rootzoll/raspiblitz/issues/2160
|
|
||||||
echo "- #2160 lnd.conf --> make sure contains no RPC user/pass for bitcoind" >> ${logFile}
|
|
||||||
sudo sed -i '/^\[Bitcoind\]/d' /mnt/hdd/lnd/lnd.conf
|
|
||||||
sudo sed -i '/^bitcoind.rpchost=/d' /mnt/hdd/lnd/lnd.conf
|
|
||||||
sudo sed -i '/^bitcoind.rpcpass=/d' /mnt/hdd/lnd/lnd.conf
|
|
||||||
sudo sed -i '/^bitcoind.rpcuser=/d' /mnt/hdd/lnd/lnd.conf
|
|
||||||
sudo sed -i '/^bitcoind.zmqpubrawblock=/d' /mnt/hdd/lnd/lnd.conf
|
|
||||||
sudo sed -i '/^bitcoind.zmqpubrawtx=/d' /mnt/hdd/lnd/lnd.conf
|
|
||||||
|
|
||||||
# make sure additional values are added to [Application Options] since v1.7
|
|
||||||
echo "- lnd.conf --> checking additional [Application Options] since v1.7" >> ${logFile}
|
|
||||||
applicationOptionsLineNumber=$(sudo grep -n "\[Application Options\]" /mnt/hdd/lnd/lnd.conf | cut -d ":" -f1)
|
|
||||||
if [ "${applicationOptionsLineNumber}" != "" ]; then
|
|
||||||
applicationOptionsLineNumber="$(($applicationOptionsLineNumber+1))"
|
|
||||||
|
|
||||||
# Avoid historical graph data sync
|
|
||||||
# ignore-historical-gossip-filters=1
|
|
||||||
configParamExists=$(sudo grep -c "^ignore-historical-gossip-filters=" /mnt/hdd/lnd/lnd.conf)
|
|
||||||
if [ "${configParamExists}" == "0" ]; then
|
|
||||||
echo " - ADDING 'ignore-historical-gossip-filters'" >> ${logFile}
|
|
||||||
sudo sed -i "${applicationOptionsLineNumber}iignore-historical-gossip-filters=1" /mnt/hdd/lnd/lnd.conf
|
|
||||||
else
|
|
||||||
echo " - OK 'ignore-historical-gossip-filters' exists (${configParamExists})" >> ${logFile}
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Avoid slow startup time
|
|
||||||
# sync-freelist=1
|
|
||||||
configParamExists=$(sudo grep -c "^sync-freelist=" /mnt/hdd/lnd/lnd.conf)
|
|
||||||
if [ "${configParamExists}" == "0" ]; then
|
|
||||||
echo " - ADDING 'sync-freelist'" >> ${logFile}
|
|
||||||
sudo sed -i "${applicationOptionsLineNumber}isync-freelist=1" /mnt/hdd/lnd/lnd.conf
|
|
||||||
else
|
|
||||||
echo " - OK 'sync-freelist' exists (${configParamExists})" >> ${logFile}
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Avoid high startup overhead
|
|
||||||
# stagger-initial-reconnect=1
|
|
||||||
configParamExists=$(sudo grep -c "^stagger-initial-reconnect=" /mnt/hdd/lnd/lnd.conf)
|
|
||||||
if [ "${configParamExists}" == "0" ]; then
|
|
||||||
echo " - ADDING 'stagger-initial-reconnect'" >> ${logFile}
|
|
||||||
sudo sed -i "${applicationOptionsLineNumber}istagger-initial-reconnect=1" /mnt/hdd/lnd/lnd.conf
|
|
||||||
else
|
|
||||||
echo " - OK 'stagger-initial-reconnect' exists (${configParamExists})" >> ${logFile}
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Delete and recreate RPC TLS certificate when details change or cert expires
|
|
||||||
# tlsautorefresh=1
|
|
||||||
configParamExists=$(sudo grep -c "^tlsautorefresh=" /mnt/hdd/lnd/lnd.conf)
|
|
||||||
if [ "${configParamExists}" == "0" ]; then
|
|
||||||
echo " - ADDING 'tlsautorefresh'" >> ${logFile}
|
|
||||||
sudo sed -i "${applicationOptionsLineNumber}itlsautorefresh=1" /mnt/hdd/lnd/lnd.conf
|
|
||||||
else
|
|
||||||
echo " - OK 'tlsautorefresh' exists (${configParamExists})" >> ${logFile}
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Do not include IPs in the RPC TLS certificate
|
|
||||||
# tlsdisableautofill=1
|
|
||||||
configParamExists=$(sudo grep -c "^tlsdisableautofill=" /mnt/hdd/lnd/lnd.conf)
|
|
||||||
if [ "${configParamExists}" == "0" ]; then
|
|
||||||
echo " - ADDING 'tlsdisableautofill'" >> ${logFile}
|
|
||||||
sudo sed -i "${applicationOptionsLineNumber}itlsdisableautofill=1" /mnt/hdd/lnd/lnd.conf
|
|
||||||
else
|
|
||||||
echo " - OK 'tlsdisableautofill' exists (${configParamExists})" >> ${logFile}
|
|
||||||
fi
|
|
||||||
|
|
||||||
else
|
|
||||||
echo " - WARN: section '[Application Options]' not found in lnd.conf" >> ${logFile}
|
|
||||||
fi
|
|
||||||
|
|
||||||
else
|
|
||||||
echo "WARN: /mnt/hdd/lnd/lnd.conf not found" >> ${logFile}
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Version Code: ${codeVersion}" >> ${logFile}
|
|
||||||
echo "Version Data: ${raspiBlitzVersion}" >> ${logFile}
|
|
||||||
|
|
||||||
if [ "${raspiBlitzVersion}" != "${codeVersion}" ]; then
|
|
||||||
echo "detected version change ... starting migration script" >> ${logFile}
|
|
||||||
# nothing specific here yet
|
|
||||||
echo "OK Done - Updating version in config"
|
|
||||||
sudo sed -i "s/^raspiBlitzVersion=.*/raspiBlitzVersion='${codeVersion}'/g" ${configFile}
|
|
||||||
else
|
|
||||||
echo "OK - version of config data is up to date" >> ${logFile}
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "END Migration/Init" >> ${logFile}
|
|
||||||
|
|
||||||
exit 0
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,13 +1,11 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# SHORTCUT COMMANDS you can call as user 'admin' from terminal
|
# source aliases from /home/admin/_aliases
|
||||||
|
if [ -f /home/admin/_aliases ];then
|
||||||
|
source /home/admin/_aliases
|
||||||
|
fi
|
||||||
|
|
||||||
# command: raspiblitz
|
# SHORTCUT COMMANDS you can call as user 'admin' from terminal
|
||||||
# calls the the raspiblitz mainmenu (legacy)
|
|
||||||
function raspiblitz() {
|
|
||||||
cd /home/admin
|
|
||||||
./00raspiblitz.sh
|
|
||||||
}
|
|
||||||
|
|
||||||
# command: blitz
|
# command: blitz
|
||||||
# calls the the raspiblitz mainmenu (shortcut)
|
# calls the the raspiblitz mainmenu (shortcut)
|
||||||
|
@ -16,6 +14,65 @@ function blitz() {
|
||||||
./00raspiblitz.sh
|
./00raspiblitz.sh
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# command: blitzhelp
|
||||||
|
# gives overview of commands
|
||||||
|
function blitzhelp() {
|
||||||
|
echo
|
||||||
|
echo "Blitz commands are consolidated here."
|
||||||
|
echo
|
||||||
|
echo "Menu access:"
|
||||||
|
echo " raspiblitz menu"
|
||||||
|
echo " menu menu"
|
||||||
|
echo " bash menu"
|
||||||
|
echo " repair menu > repair"
|
||||||
|
echo
|
||||||
|
echo "Checks:"
|
||||||
|
echo " status informational Blitz status screen"
|
||||||
|
echo " sourcemode copy blockchain source modus"
|
||||||
|
echo " check check if Blitz configuration files are correct"
|
||||||
|
echo " debug print debug logs"
|
||||||
|
echo " debug -l print debug logs with bin link"
|
||||||
|
echo " patch sync scripts with latest set github and branch"
|
||||||
|
echo " github jumping directly into the options to change branch/repo/pr"
|
||||||
|
echo
|
||||||
|
echo "Power:"
|
||||||
|
echo " restart restart the node"
|
||||||
|
echo " off shutdown the node"
|
||||||
|
echo
|
||||||
|
echo "Display:"
|
||||||
|
echo " hdmi switch video output to HDMI"
|
||||||
|
echo " lcd switch video output to LCD"
|
||||||
|
echo " headless switch video output to HEADLESS"
|
||||||
|
echo
|
||||||
|
echo "BTC tx:"
|
||||||
|
echo " torthistx broadcast transaction through Tor to Blockstreams API and into the network"
|
||||||
|
echo " gettx retrieve transaction from mempool or blockchain and print as JSON"
|
||||||
|
echo " watchtx retrieve transaction from mempool or blockchain until certain confirmation target"
|
||||||
|
echo
|
||||||
|
echo "LND:"
|
||||||
|
echo " balance your satoshi balance"
|
||||||
|
echo " channels your lightning channels"
|
||||||
|
echo " fwdreport show forwarding report"
|
||||||
|
echo
|
||||||
|
echo "Users:"
|
||||||
|
echo " bos Balance of Satoshis"
|
||||||
|
echo " chantools ChanTools"
|
||||||
|
echo " lit Lightning Terminal"
|
||||||
|
echo " jm JoinMarket"
|
||||||
|
echo " pyblock PyBlock"
|
||||||
|
echo
|
||||||
|
echo "Extras:"
|
||||||
|
echo " whitepaper download the whitepaper from the blockchain to /home/admin/bitcoin.pdf"
|
||||||
|
echo " notifyme wrapper for blitz.notify.sh that will send a notification using the configured method and settings"
|
||||||
|
}
|
||||||
|
|
||||||
|
# command: raspiblitz
|
||||||
|
# calls the the raspiblitz mainmenu (legacy)
|
||||||
|
function raspiblitz() {
|
||||||
|
cd /home/admin
|
||||||
|
./00raspiblitz.sh
|
||||||
|
}
|
||||||
|
|
||||||
# command: menu
|
# command: menu
|
||||||
# calls directly the main menu
|
# calls directly the main menu
|
||||||
function menu() {
|
function menu() {
|
||||||
|
@ -32,14 +89,12 @@ function repair() {
|
||||||
|
|
||||||
# command: restart
|
# command: restart
|
||||||
function restart() {
|
function restart() {
|
||||||
cd /home/admin
|
/home/admin/config.scripts/blitz.shutdown.sh reboot
|
||||||
./XXshutdown.sh reboot
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# command: sourcemode
|
# command: sourcemode
|
||||||
function sourcemode() {
|
function sourcemode() {
|
||||||
cd /home/admin
|
/home/admin/config.scripts/blitz.copychain.sh source
|
||||||
./98repairMenu.sh sourcemode
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# command: check
|
# command: check
|
||||||
|
@ -47,23 +102,31 @@ function check() {
|
||||||
/home/admin/config.scripts/blitz.configcheck.py
|
/home/admin/config.scripts/blitz.configcheck.py
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# command: release
|
||||||
|
function release() {
|
||||||
|
/home/admin/config.scripts/blitz.preparerelease.sh
|
||||||
|
}
|
||||||
|
|
||||||
# command: debug
|
# command: debug
|
||||||
function debug() {
|
function debug() {
|
||||||
cd /home/admin
|
echo "Printing debug logs. Be patient, this should take maximum 2 minutes ..."
|
||||||
./XXdebugLogs.sh
|
if [[ $1 = "-l" ]]; then
|
||||||
|
/home/admin/config.scripts/blitz.debug.sh > /var/cache/raspiblitz/debug.log && cat /var/cache/raspiblitz/debug.log | torsocks nc termbin.com 9999
|
||||||
|
else
|
||||||
|
/home/admin/config.scripts/blitz.debug.sh > /var/cache/raspiblitz/debug.log && cat /var/cache/raspiblitz/debug.log
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# command: patch
|
# command: patch
|
||||||
# syncs script with latest set github and branch
|
# syncs script with latest set github and branch
|
||||||
function patch() {
|
function patch() {
|
||||||
cd /home/admin
|
cd /home/admin
|
||||||
./XXsyncScripts.sh -run
|
/home/admin/config.scripts/blitz.github.sh -run
|
||||||
}
|
}
|
||||||
|
|
||||||
# command: off
|
# command: off
|
||||||
function off() {
|
function off() {
|
||||||
cd /home/admin
|
/home/admin/config.scripts/blitz.shutdown.sh
|
||||||
./XXshutdown.sh
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# command: github
|
# command: github
|
||||||
|
@ -94,20 +157,6 @@ function headless() {
|
||||||
restart
|
restart
|
||||||
}
|
}
|
||||||
|
|
||||||
# command: manage
|
|
||||||
function manage() {
|
|
||||||
if [ $(cat /mnt/hdd/raspiblitz.conf 2>/dev/null | grep -c "lndmanage=on") -eq 1 ]; then
|
|
||||||
cd /home/admin/lndmanage
|
|
||||||
source venv/bin/activate
|
|
||||||
echo "NOTICE: Needs at least one active channel to run without error."
|
|
||||||
echo "to exit (venv) enter ---> deactivate"
|
|
||||||
lndmanage
|
|
||||||
else
|
|
||||||
echo "lndmanage not installed - to install run:"
|
|
||||||
echo "sudo /home/admin/config.scripts/bonus.lndmanage.sh on"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# command: torthistx
|
# command: torthistx
|
||||||
function torthistx() {
|
function torthistx() {
|
||||||
if [ $(cat /mnt/hdd/raspiblitz.conf 2>/dev/null | grep -c "runBehindTor=on") -eq 1 ]; then
|
if [ $(cat /mnt/hdd/raspiblitz.conf 2>/dev/null | grep -c "runBehindTor=on") -eq 1 ]; then
|
||||||
|
@ -123,7 +172,24 @@ function torthistx() {
|
||||||
# start the status screen in the terminal
|
# start the status screen in the terminal
|
||||||
function status() {
|
function status() {
|
||||||
echo "Gathering data - please wait a moment..."
|
echo "Gathering data - please wait a moment..."
|
||||||
sudo -u pi /home/admin/00infoLCD.sh --pause 0
|
while :
|
||||||
|
do
|
||||||
|
# show the same info as on LCD screen
|
||||||
|
# 00infoBlitz.sh <cl|lnd> <testnet|mainnet|signet>
|
||||||
|
/home/admin/00infoBlitz.sh $1 $2
|
||||||
|
# wait 6 seconds for user exiting loop
|
||||||
|
#echo
|
||||||
|
#echo -en "Screen is updating in a loop .... press 'x' now to get back to menu."
|
||||||
|
read -n 1 -t 6 keyPressed
|
||||||
|
#echo -en "\rGathering information to update info ... please wait. \n"
|
||||||
|
# check if user wants to abort session
|
||||||
|
if [ "${keyPressed}" = "x" ]; then
|
||||||
|
echo
|
||||||
|
echo "Returning to menu ....."
|
||||||
|
sleep 4
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# command: lnbalance
|
# command: lnbalance
|
||||||
|
@ -204,21 +270,6 @@ function jm() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# command: faraday
|
|
||||||
# switch to the faraday user for the Faraday Service
|
|
||||||
function faraday() {
|
|
||||||
if [ $(grep -c "faraday=on" < /mnt/hdd/raspiblitz.conf) -eq 1 ]; then
|
|
||||||
echo "# switching to the faraday user with the command: 'sudo su - faraday'"
|
|
||||||
echo "# use command 'exit' and then 'raspiblitz' to return to menu"
|
|
||||||
echo "# use command 'frcli --help' now to get more info"
|
|
||||||
sudo su - faraday
|
|
||||||
echo "# use command 'raspiblitz' to return to menu"
|
|
||||||
else
|
|
||||||
echo "Faraday is not installed - to install run:"
|
|
||||||
echo "/home/admin/config.scripts/bonus.faraday.sh on"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# command: lit
|
# command: lit
|
||||||
# switch to the lit user for the loop, pool & faraday services
|
# switch to the lit user for the loop, pool & faraday services
|
||||||
function lit() {
|
function lit() {
|
||||||
|
@ -250,36 +301,6 @@ if [ -f "/mnt/hdd/raspiblitz.conf" ] && [ $(grep -c "lit=on" < /mnt/hdd/raspibl
|
||||||
--macaroonpath=/home/lit/.pool/${chain}net/pool.macaroon"
|
--macaroonpath=/home/lit/.pool/${chain}net/pool.macaroon"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# command: loop
|
|
||||||
# switch to the loop user for the Lightning Loop Service
|
|
||||||
function loop() {
|
|
||||||
if [ $(grep -c "loop=on" < /mnt/hdd/raspiblitz.conf) -eq 1 ]; then
|
|
||||||
echo "# switching to the loop user with the command: 'sudo su - loop'"
|
|
||||||
echo "# use command 'exit' and then 'raspiblitz' to return to menu"
|
|
||||||
echo "# use command 'loop --help' now to get more info"
|
|
||||||
sudo su - loop
|
|
||||||
echo "# use command 'raspiblitz' to return to menu"
|
|
||||||
else
|
|
||||||
echo "Lightning Loop is not installed - to install run:"
|
|
||||||
echo "/home/admin/config.scripts/bonus.loop.sh on"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# command: pool
|
|
||||||
# switch to the pool user for the Pool Service
|
|
||||||
function pool() {
|
|
||||||
if [ $(grep -c "pool=on" < /mnt/hdd/raspiblitz.conf) -gt 0 ]; then
|
|
||||||
echo "# switching to the pool user with the command: 'sudo su - pool'"
|
|
||||||
echo "# use command 'exit' and then 'raspiblitz' to return to menu"
|
|
||||||
echo "# use command 'pool --help' now to get more info"
|
|
||||||
sudo su - pool
|
|
||||||
echo "# use command 'raspiblitz' to return to menu"
|
|
||||||
else
|
|
||||||
echo "Pool is not installed - to install run:"
|
|
||||||
echo "/home/admin/config.scripts/bonus.pool.sh on"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# command: gettx
|
# command: gettx
|
||||||
# retrieve transaction from mempool or blockchain and print as JSON
|
# retrieve transaction from mempool or blockchain and print as JSON
|
||||||
# $ gettx "f4184fc596403b9d638783cf57adfe4c75c605f6356fbc91338530e9831e9e16"
|
# $ gettx "f4184fc596403b9d638783cf57adfe4c75c605f6356fbc91338530e9831e9e16"
|
||||||
|
@ -341,6 +362,21 @@ function notifyme() {
|
||||||
# command: whitepaper
|
# command: whitepaper
|
||||||
# downloads the whitepaper from the blockchain to /home/admin/bitcoin.pdf
|
# downloads the whitepaper from the blockchain to /home/admin/bitcoin.pdf
|
||||||
function whitepaper() {
|
function whitepaper() {
|
||||||
cd /home/admin/config.scripts
|
cd /home/admin
|
||||||
./bonus.whitepaper.sh on
|
./config.scripts/bonus.whitepaper.sh on
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# command: qr ["string"]
|
||||||
|
# shows a QR code from the string
|
||||||
|
function qr() {
|
||||||
|
if [ ${#1} -eq 0 ]; then
|
||||||
|
echo "# Error='missing string'"
|
||||||
|
fi
|
||||||
|
echo
|
||||||
|
echo "Displaying the text:"
|
||||||
|
echo "$1"
|
||||||
|
echo
|
||||||
|
qrencode -t ANSIUTF8 "${1}"
|
||||||
|
echo "(To shrink QR code: MacOS press CMD- / Linux press CTRL-)"
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
|
76
home.admin/_provision.migration.sh
Executable file
76
home.admin/_provision.migration.sh
Executable file
|
@ -0,0 +1,76 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# LOGFILE - store debug logs of bootstrap
|
||||||
|
logFile="/home/admin/raspiblitz.provision-migration.log"
|
||||||
|
|
||||||
|
# INFOFILE - state data from bootstrap
|
||||||
|
infoFile="/home/admin/raspiblitz.info"
|
||||||
|
source ${infoFile}
|
||||||
|
|
||||||
|
# SETUPFILE - data from setup process
|
||||||
|
source /var/cache/raspiblitz/temp/raspiblitz.setup
|
||||||
|
|
||||||
|
# CONFIGFILE - configuration of RaspiBlitz
|
||||||
|
configFile="/mnt/hdd/raspiblitz.conf"
|
||||||
|
|
||||||
|
# log header
|
||||||
|
echo "" > ${logFile}
|
||||||
|
echo "###################################" >> ${logFile}
|
||||||
|
echo "# _provision.migration.sh" >> ${logFile}
|
||||||
|
echo "###################################" >> ${logFile}
|
||||||
|
sudo sed -i "s/^message=.*/message='Provision Migration'/g" ${infoFile}
|
||||||
|
|
||||||
|
if [ "${hddGotMigrationData}" == "" ]; then
|
||||||
|
sed -i "s/^state=.*/state=error/g" ${infoFile}
|
||||||
|
sed -i "s/^message=.*/message='config: missing hddGotMigrationData'/g" ${infoFile}
|
||||||
|
echo "FAIL see ${logFile}"
|
||||||
|
echo "FAIL: missing hddGotMigrationData in (${infoFile})!" >> ${logFile}
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
source <(sudo /home/admin/config.scripts/blitz.datadrive.sh status)
|
||||||
|
|
||||||
|
err=""
|
||||||
|
nodenameUpperCase=$(echo "${hddGotMigrationData}" | tr "[a-z]" "[A-Z]")
|
||||||
|
echo "**************************************************" >> ${logFile}
|
||||||
|
echo "MIGRATION FROM ${nodenameUpperCase} TO RASPIBLITZ" >> ${logFile}
|
||||||
|
echo "**************************************************" >> ${logFile}
|
||||||
|
echo "- started ..." >> ${logFile}
|
||||||
|
source <(sudo /home/admin/config.scripts/blitz.migration.sh migration-${hddGotMigrationData})
|
||||||
|
if [ "${err}" != "" ]; then
|
||||||
|
echo "MIGRATION FAILED: ${err}" >> ${logFile}
|
||||||
|
echo "Format data disk on laptop & recover funds with fresh sd card using seed words + static channel backup." >> ${logFile}
|
||||||
|
sed -i "s/^state=.*/state=error/g" ${infoFile}
|
||||||
|
sed -i "s/^message=.*/message='migration failed'/g" ${infoFile}
|
||||||
|
exit 3
|
||||||
|
fi
|
||||||
|
|
||||||
|
# make sure for the rest of the seup info is set correctly
|
||||||
|
sudo sed -i "s/^network=.*/network=bitcoin/g" ${infoFile}
|
||||||
|
sudo sed -i "s/^chain=.*/chain=main/g" ${infoFile}
|
||||||
|
|
||||||
|
# set Password B
|
||||||
|
echo "## SETTING PASSWORD B" >> ${logFile}
|
||||||
|
if [ "${setPasswordB}" == "1" ]; then
|
||||||
|
if [ "${passwordB}" != "" ]; then
|
||||||
|
# set password B as RPC password
|
||||||
|
echo "# setting PASSWORD B" >> ${logFile}
|
||||||
|
/home/admin/config.scripts/blitz.setpassword.sh b "${passwordB}" >> ${logFile}
|
||||||
|
else
|
||||||
|
echo "FAIL: Password B should be set but was empty! Running with default." >> ${logFile}
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "WARN: setPasswordB!=1 this not normal on migration! Running with default." >> ${logFile}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# if free space is lower than 100GB (100000000) delete backup files
|
||||||
|
if [ "${hddDataFreeKB}" != "" ] && [ ${hddDataFreeKB} -lt 407051412 ]; then
|
||||||
|
echo "- free space of data disk is low ... deleting 'backup_migration'" >> ${logFile}
|
||||||
|
sudo rm -R /mnt/hdd/backup_migration
|
||||||
|
else
|
||||||
|
echo "- old data of ${nodenameUpperCase} can be found in '/mnt/hdd/backup_migration'" >> ${logFile}
|
||||||
|
fi
|
||||||
|
echo "OK MIGRATION" >> ${logFile}
|
||||||
|
echo "END Migration" >> ${logFile}
|
||||||
|
exit 0
|
||||||
|
|
417
home.admin/_provision.setup.sh
Executable file
417
home.admin/_provision.setup.sh
Executable file
|
@ -0,0 +1,417 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# this provision file is just executed on fresh setups
|
||||||
|
# not on recoveries or updates
|
||||||
|
|
||||||
|
# LOGFILE - store debug logs of bootstrap
|
||||||
|
logFile="/home/admin/raspiblitz.provision-setup.log"
|
||||||
|
|
||||||
|
# INFOFILE - state data from bootstrap
|
||||||
|
infoFile="/home/admin/raspiblitz.info"
|
||||||
|
source ${infoFile}
|
||||||
|
|
||||||
|
# SETUPFILE - setup data of RaspiBlitz
|
||||||
|
setupFile="/var/cache/raspiblitz/temp/raspiblitz.setup"
|
||||||
|
source ${setupFile}
|
||||||
|
|
||||||
|
# CONFIGFILE - configuration of RaspiBlitz
|
||||||
|
configFile="/mnt/hdd/raspiblitz.conf"
|
||||||
|
source ${configFile}
|
||||||
|
|
||||||
|
# log header
|
||||||
|
echo "" > ${logFile}
|
||||||
|
echo "###################################" >> ${logFile}
|
||||||
|
echo "# _provision.setup.sh" >> ${logFile}
|
||||||
|
echo "###################################" >> ${logFile}
|
||||||
|
sudo sed -i "s/^message=.*/message='Provision Setup'/g" ${infoFile}
|
||||||
|
|
||||||
|
###################################
|
||||||
|
# Preserve SSH keys
|
||||||
|
# just copy dont link anymore
|
||||||
|
# see: https://github.com/rootzoll/raspiblitz/issues/1798
|
||||||
|
sed -i "s/^message=.*/message='SSH Keys'/g" ${infoFile}
|
||||||
|
|
||||||
|
# link ssh directory from SD card to HDD
|
||||||
|
/home/admin/config.scripts/blitz.ssh.sh backup
|
||||||
|
|
||||||
|
###################################
|
||||||
|
# Prepare Blockchain Service
|
||||||
|
sed -i "s/^message=.*/message='Blockchain Setup'/g" ${infoFile}
|
||||||
|
|
||||||
|
if [ "${network}" == "" ]; then
|
||||||
|
sed -i "s/^state=.*/state=error/g" ${infoFile}
|
||||||
|
sed -i "s/^message=.*/message='config: missing network'/g" ${infoFile}
|
||||||
|
echo "FAIL see ${logFile}"
|
||||||
|
echo "FAIL: missing network in (${setupFile})!" >> ${logFile}
|
||||||
|
exit 20
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${chain}" == "" ]; then
|
||||||
|
sed -i "s/^state=.*/state=error/g" ${infoFile}
|
||||||
|
sed -i "s/^message=.*/message='config: missing chain'/g" ${infoFile}
|
||||||
|
echo "FAIL see ${logFile}"
|
||||||
|
echo "FAIL: missing chain in (${setupFile})!" >> ${logFile}
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
# copy configs files and directories
|
||||||
|
echo ""
|
||||||
|
echo "*** Prepare ${network} ***" >> ${logFile}
|
||||||
|
mkdir /mnt/hdd/${network} >>${logFile} 2>&1
|
||||||
|
chown -R bitcoin:bitcoin /mnt/hdd/${network} >>${logFile} 2>&1
|
||||||
|
sudo -u bitcoin mkdir /mnt/hdd/${network}/blocks >>${logFile} 2>&1
|
||||||
|
sudo -u bitcoin mkdir /mnt/hdd/${network}/chainstate >>${logFile} 2>&1
|
||||||
|
cp /home/admin/assets/${network}.conf /mnt/hdd/${network}/${network}.conf
|
||||||
|
chown bitcoin:bitcoin /mnt/hdd/${network}/${network}.conf >>${logFile} 2>&1
|
||||||
|
mkdir /home/admin/.${network} >>${logFile} 2>&1
|
||||||
|
cp /home/admin/assets/${network}.conf /home/admin/.${network}/${network}.conf
|
||||||
|
chown -R admin:admin /home/admin/.${network} >>${logFile} 2>&1
|
||||||
|
|
||||||
|
# make sure all directories are linked
|
||||||
|
/home/admin/config.scripts/blitz.datadrive.sh link >> ${logFile}
|
||||||
|
|
||||||
|
# test bitcoin config
|
||||||
|
confExists=$(sudo ls /mnt/hdd/${network}/${network}.conf | grep -c "${network}.conf")
|
||||||
|
echo "File Exists: /mnt/hdd/${network}/${network}.conf --> ${confExists}" >> ${logFile}
|
||||||
|
|
||||||
|
# set password B as RPC password
|
||||||
|
echo "# setting PASSWORD B" >> ${logFile}
|
||||||
|
/home/admin/config.scripts/blitz.setpassword.sh b "${passwordB}" >> ${logFile}
|
||||||
|
|
||||||
|
# optimize RAM for blockchain validation (bitcoin only)
|
||||||
|
if [ "${network}" == "bitcoin" ] && [ "${hddBlocksBitcoin}" == "0" ]; then
|
||||||
|
echo "*** Optimizing RAM for Sync ***" >> ${logFile}
|
||||||
|
kbSizeRAM=$(cat /proc/meminfo | grep "MemTotal" | sed 's/[^0-9]*//g')
|
||||||
|
echo "kbSizeRAM(${kbSizeRAM})" >> ${logFile}
|
||||||
|
echo "dont forget to reduce dbcache once IBD is done" > "/mnt/hdd/${network}/blocks/selfsync.flag"
|
||||||
|
# RP4 4GB
|
||||||
|
if [ ${kbSizeRAM} -gt 3500000 ]; then
|
||||||
|
echo "Detected RAM >=4GB --> optimizing ${network}.conf" >> ${logFile}
|
||||||
|
sed -i "s/^dbcache=.*/dbcache=2560/g" /mnt/hdd/${network}/${network}.conf
|
||||||
|
# RP4 2GB
|
||||||
|
elif [ ${kbSizeRAM} -gt 1500000 ]; then
|
||||||
|
echo "Detected RAM >=2GB --> optimizing ${network}.conf" >> ${logFile}
|
||||||
|
sed -i "s/^dbcache=.*/dbcache=1536/g" /mnt/hdd/${network}/${network}.conf
|
||||||
|
#RP3/4 1GB
|
||||||
|
else
|
||||||
|
echo "Detected RAM <=1GB --> optimizing ${network}.conf" >> ${logFile}
|
||||||
|
sed -i "s/^dbcache=.*/dbcache=512/g" /mnt/hdd/${network}/${network}.conf
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# start network service
|
||||||
|
echo ""
|
||||||
|
echo "*** Start ${network} (SETUP) ***" >> ${logFile}
|
||||||
|
sed -i "s/^message=.*/message='Blockchain Testrun'/g" ${infoFile}
|
||||||
|
echo "- This can take a while .." >> ${logFile}
|
||||||
|
cp /home/admin/assets/${network}d.service /etc/systemd/system/${network}d.service
|
||||||
|
systemctl enable ${network}d.service
|
||||||
|
systemctl start ${network}d.service
|
||||||
|
|
||||||
|
# check if bitcoin has started
|
||||||
|
bitcoinRunning=0
|
||||||
|
loopcount=0
|
||||||
|
while [ ${bitcoinRunning} -eq 0 ]
|
||||||
|
do
|
||||||
|
>&2 echo "# (${loopcount}/50) checking if ${network}d is running ... " >> ${logFile}
|
||||||
|
bitcoinRunning=$(sudo -u bitcoin ${network}-cli getblockchaininfo 2>/dev/null | grep "initialblockdownload" -c)
|
||||||
|
sleep 8
|
||||||
|
sync
|
||||||
|
loopcount=$(($loopcount +1))
|
||||||
|
if [ ${loopcount} -gt 50 ]; then
|
||||||
|
sed -i "s/^state=.*/state=error/g" ${infoFile}
|
||||||
|
sed -i "s/^message=.*/message='setup: failed ${network}'/g" ${infoFile}
|
||||||
|
echo "FAIL: setup: failed ${network}" >> ${logFile}
|
||||||
|
exit 4
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo "OK ${network} startup successful " >> ${logFile}
|
||||||
|
|
||||||
|
|
||||||
|
###################################
|
||||||
|
# Prepare Lightning
|
||||||
|
echo "Prepare Lightning (${lightning})" >> ${logFile}
|
||||||
|
|
||||||
|
if [ "${lightning}" != "lnd" ]; then
|
||||||
|
|
||||||
|
###################################
|
||||||
|
# Remove LND from systemd
|
||||||
|
echo "Remove LND" >> ${logFile}
|
||||||
|
sudo sed -i "s/^message=.*/message='Deactivate Lightning'/g" ${infoFile}
|
||||||
|
sudo systemctl disable lnd
|
||||||
|
sudo rm /etc/systemd/system/lnd.service 2>/dev/null
|
||||||
|
sudo systemctl daemon-reload
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${lightning}" == "lnd" ]; then
|
||||||
|
|
||||||
|
###################################
|
||||||
|
# LND
|
||||||
|
echo "############## Setup LND" >> ${logFile}
|
||||||
|
sudo sed -i "s/^message=.*/message='LND Setup'/g" ${infoFile}
|
||||||
|
|
||||||
|
if [ "${passwordC}" == "" ]; then
|
||||||
|
sed -i "s/^state=.*/state=error/g" ${infoFile}
|
||||||
|
sed -i "s/^message=.*/message='config: missing passwordC'/g" ${infoFile}
|
||||||
|
echo "FAIL see ${logFile}"
|
||||||
|
echo "FAIL: missing passwordC in (${setupFile})!" >> ${logFile}
|
||||||
|
exit 5
|
||||||
|
fi
|
||||||
|
|
||||||
|
# if user uploaded an LND rescue file
|
||||||
|
if [ "${lndrescue}" != "" ]; then
|
||||||
|
echo "Restore LND data from uploaded rescue file ${lndrescue} ..." >> ${logFile}
|
||||||
|
source <(sudo /home/admin/config.scripts/lnd.backup.sh lnd-import ${lndrescue})
|
||||||
|
if [ "${error}" != "" ]; then
|
||||||
|
sed -i "s/^state=.*/state=error/g" ${infoFile}
|
||||||
|
sed -i "s/^message=.*/message='setup: lnd import backup failed'/g" ${infoFile}
|
||||||
|
echo "FAIL see ${logFile}"
|
||||||
|
echo "FAIL: setup: lnd import backup failed" >> ${logFile}
|
||||||
|
echo "${error}" >> ${logFile}
|
||||||
|
exit 6
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# preparing new LND config
|
||||||
|
echo "Creating new LND config ..." >> ${logFile}
|
||||||
|
sudo -u bitcoin mkdir /mnt/hdd/lnd 2> /dev/null
|
||||||
|
sudo cp /home/admin/assets/lnd.${network}.conf /mnt/hdd/lnd/lnd.conf
|
||||||
|
sudo chown bitcoin:bitcoin /mnt/hdd/lnd/lnd.conf
|
||||||
|
sudo /home/admin/config.scripts/lnd.install.sh on mainnet
|
||||||
|
sudo /home/admin/config.scripts/lnd.setname.sh mainnet ${hostname}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# make sure all directories are linked
|
||||||
|
sudo /home/admin/config.scripts/blitz.datadrive.sh link
|
||||||
|
|
||||||
|
# check if now a config exists
|
||||||
|
configLinkedCorrectly=$(sudo ls sudo ls /home/bitcoin/.lnd/lnd.conf | grep -c "lnd.conf")
|
||||||
|
if [ "${configLinkedCorrectly}" != "1" ]; then
|
||||||
|
sed -i "s/^state=.*/state=error/g" ${infoFile}
|
||||||
|
sed -i "s/^message=.*/message='setup: lnd conf link broken'/g" ${infoFile}
|
||||||
|
echo "FAIL see ${logFile}"
|
||||||
|
echo "FAIL: setup: lnd conf link broken" >> ${logFile}
|
||||||
|
exit 7
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Init LND service & start
|
||||||
|
echo "*** Init LND Service & Start ***" >> ${logFile}
|
||||||
|
sudo sed -i "s/^message=.*/message='LND Testrun'/g" ${infoFile}
|
||||||
|
|
||||||
|
# just in case
|
||||||
|
sudo systemctl stop lnd 2>/dev/null
|
||||||
|
sudo systemctl disable lnd 2>/dev/null
|
||||||
|
|
||||||
|
# make sure lnd gets started after blockchain service
|
||||||
|
sed -i "5s/.*/Wants=${network}d.service/" /home/admin/assets/lnd.service >> ${logFile}
|
||||||
|
sed -i "6s/.*/After=${network}d.service/" /home/admin/assets/lnd.service >> ${logFile}
|
||||||
|
sudo cp /home/admin/assets/lnd.service /etc/systemd/system/lnd.service >> ${logFile}
|
||||||
|
|
||||||
|
# start lnd up
|
||||||
|
echo "Starting LND Service ..." >> ${logFile}
|
||||||
|
sudo systemctl enable lnd >> ${logFile}
|
||||||
|
sudo systemctl start lnd >> ${logFile}
|
||||||
|
|
||||||
|
# check that lnd started
|
||||||
|
lndRunning=0
|
||||||
|
loopcount=0
|
||||||
|
while [ ${lndRunning} -eq 0 ]
|
||||||
|
do
|
||||||
|
lndRunning=$(sudo systemctl status lnd.service | grep -c running)
|
||||||
|
if [ ${lndRunning} -eq 0 ]; then
|
||||||
|
date +%s >> ${logFile}
|
||||||
|
echo "LND not ready yet ... waiting another 60 seconds." >> ${logFile}
|
||||||
|
sleep 10
|
||||||
|
fi
|
||||||
|
loopcount=$(($loopcount +1))
|
||||||
|
if [ ${loopcount} -gt 100 ]; then
|
||||||
|
sed -i "s/^state=.*/state=error/g" ${infoFile}
|
||||||
|
sed -i "s/^message=.*/message='setup: failed lnd start'/g" ${infoFile}
|
||||||
|
echo "FAIL see ${logFile}"
|
||||||
|
echo "FAIL: setup: failed lnd start" >> ${logFile}
|
||||||
|
exit 8
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo "OK - LND is running" ${logFile}
|
||||||
|
sleep 10
|
||||||
|
|
||||||
|
# Check LND health/fails (to be extended)
|
||||||
|
tlsExists=$(sudo ls /mnt/hdd/lnd/tls.cert 2>/dev/null | grep -c "tls.cert")
|
||||||
|
if [ ${tlsExists} -eq 0 ]; then
|
||||||
|
sed -i "s/^state=.*/state=error/g" ${infoFile}
|
||||||
|
sed -i "s/^message=.*/message='setup: missing lnd tls'/g" ${infoFile}
|
||||||
|
echo "FAIL see ${logFile}"
|
||||||
|
echo "FAIL: setup: missing lnd tls" >> ${logFile}
|
||||||
|
exit 9
|
||||||
|
fi
|
||||||
|
|
||||||
|
# import static channel backup if was uploaded
|
||||||
|
if [ "${staticchannelbackup}" != "" ]; then
|
||||||
|
echo "Preparing static channel backup file ${staticchannelbackup} ..." >> ${logFile}
|
||||||
|
source <(sudo /home/admin/config.scripts/lnd.backup.sh scb-import ${staticchannelbackup})
|
||||||
|
if [ "${error}" != "" ]; then
|
||||||
|
sed -i "s/^state=.*/state=error/g" ${infoFile}
|
||||||
|
sed -i "s/^message=.*/message='setup: lnd import SCB failed'/g" ${infoFile}
|
||||||
|
echo "FAIL see ${logFile}"
|
||||||
|
echo "FAIL: setup: lnd import SCB failed" >> ${logFile}
|
||||||
|
echo "${error}" >> ${logFile}
|
||||||
|
exit 10
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# WALLET --> SEED + SCB
|
||||||
|
if [ "${seedWords}" != "" ] && [ "${staticchannelbackup}" != "" ]; then
|
||||||
|
|
||||||
|
echo "WALLET --> SEED + SCB " >> ${logFile}
|
||||||
|
sudo sed -i "s/^message=.*/message='LND Wallet (SEED & SCB)'/g" ${infoFile}
|
||||||
|
sudo /home/admin/config.scripts/lnd.initwallet.py scb mainnet ${passwordC} "${seedWords}" "${staticchannelbackup}" ${seedPassword}
|
||||||
|
if [ "${err}" != "" ]; then
|
||||||
|
sed -i "s/^state=.*/state=error/g" ${infoFile}
|
||||||
|
sed -i "s/^message=.*/message='setup: lnd wallet SCB failed'/g" ${infoFile}
|
||||||
|
echo "FAIL see ${logFile}"
|
||||||
|
echo "FAIL: setup: lnd wallet SCB failed" >> ${logFile}
|
||||||
|
echo "${err}" >> ${logFile}
|
||||||
|
echo "${errMore}" >> ${logFile}
|
||||||
|
exit 11
|
||||||
|
fi
|
||||||
|
|
||||||
|
# WALLET --> SEED
|
||||||
|
elif [ "${seedWords}" != "" ]; then
|
||||||
|
|
||||||
|
echo "WALLET --> SEED" >> ${logFile}
|
||||||
|
sudo sed -i "s/^message=.*/message='LND Wallet (SEED)'/g" ${infoFile}
|
||||||
|
sudo /home/admin/config.scripts/lnd.initwallet.py seed mainnet ${passwordC} "${seedWords}" ${seedPassword}
|
||||||
|
if [ "${err}" != "" ]; then
|
||||||
|
sed -i "s/^state=.*/state=error/g" ${infoFile}
|
||||||
|
sed -i "s/^message=.*/message='setup: lnd wallet SEED failed'/g" ${infoFile}
|
||||||
|
echo "FAIL see ${logFile}"
|
||||||
|
echo "FAIL: setup: lnd wallet SEED failed" >> ${logFile}
|
||||||
|
echo "${err}" >> ${logFile}
|
||||||
|
echo "${errMore}" >> ${logFile}
|
||||||
|
exit 12
|
||||||
|
fi
|
||||||
|
|
||||||
|
# WALLET --> NEW
|
||||||
|
else
|
||||||
|
|
||||||
|
echo "WALLET --> NEW" >> ${logFile}
|
||||||
|
sudo sed -i "s/^message=.*/message='LND Wallet (NEW)'/g" ${infoFile}
|
||||||
|
source <(sudo /home/admin/config.scripts/lnd.initwallet.py new mainnet ${passwordC})
|
||||||
|
if [ "${err}" != "" ]; then
|
||||||
|
sed -i "s/^state=.*/state=error/g" ${infoFile}
|
||||||
|
sed -i "s/^message=.*/message='setup: lnd wallet SEED failed'/g" ${infoFile}
|
||||||
|
echo "FAIL see ${logFile}"
|
||||||
|
echo "FAIL: setup: lnd wallet SEED failed" >> ${logFile}
|
||||||
|
echo "${err}" >> ${logFile}
|
||||||
|
echo "${errMore}" >> ${logFile}
|
||||||
|
exit 13
|
||||||
|
fi
|
||||||
|
|
||||||
|
# write created seedwords into SETUPFILE to be displayed to user on final setup later
|
||||||
|
echo "seedwordsNEW='${seedwords}'" >> ${setupFile}
|
||||||
|
echo "seedwords6x4NEW='${seedwords6x4}'" >> ${setupFile}
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
# sync macaroons & TLS to other users
|
||||||
|
echo "*** Copy LND Macaroons to user admin ***" >> ${logFile}
|
||||||
|
sudo sed -i "s/^message=.*/message='LND Credentials'/g" ${infoFile}
|
||||||
|
|
||||||
|
# check if macaroon exists now - if not fail
|
||||||
|
macaroonExists=$(sudo -u bitcoin ls -la /home/bitcoin/.lnd/data/chain/${network}/${chain}net/admin.macaroon 2>/dev/null | grep -c admin.macaroon)
|
||||||
|
if [ ${macaroonExists} -eq 0 ]; then
|
||||||
|
sed -i "s/^state=.*/state=error/g" ${infoFile}
|
||||||
|
sed -i "s/^message=.*/message='setup: lnd no macaroons'/g" ${infoFile}
|
||||||
|
echo "FAIL: setup: lnd no macaroons" >> ${logFile}
|
||||||
|
exit 14
|
||||||
|
fi
|
||||||
|
|
||||||
|
# now sync macaroons & TLS zo other users
|
||||||
|
sudo /home/admin/config.scripts/lnd.credentials.sh sync >> ${logFile}
|
||||||
|
|
||||||
|
# make a final lnd check
|
||||||
|
source <(/home/admin/config.scripts/lnd.check.sh basic-setup)
|
||||||
|
if [ "${err}" != "" ]; then
|
||||||
|
sed -i "s/^state=.*/state=error/g" ${infoFile}
|
||||||
|
sed -i "s/^message=.*/message='setup: lnd wallet SEED failed'/g" ${infoFile}
|
||||||
|
echo "FAIL: setup: lnd wallet SEED failed" >> ${logFile}
|
||||||
|
echo "${err}" >> ${logFile}
|
||||||
|
exit 15
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${lightning}" == "cl" ]; then
|
||||||
|
|
||||||
|
###################################
|
||||||
|
# c-lightning
|
||||||
|
echo "############## c-lightning" >> ${logFile}
|
||||||
|
|
||||||
|
sudo sed -i "s/^message=.*/message='C-Lightning Install'/g" ${infoFile}
|
||||||
|
sudo /home/admin/config.scripts/cl.install.sh on mainnet >> ${logFile}
|
||||||
|
sudo sed -i "s/^message=.*/message='C-Lightning Setup'/g" ${infoFile}
|
||||||
|
|
||||||
|
# OLD WALLET FROM CLIGHTNING RESCUE
|
||||||
|
if [ "${clrescue}" != "" ]; then
|
||||||
|
|
||||||
|
echo "Restore CL data from uploaded rescue file ${clrescue} ..." >> ${logFile}
|
||||||
|
source <(sudo /home/admin/config.scripts/cl.backup.sh cl-import ${clrescue})
|
||||||
|
if [ "${error}" != "" ]; then
|
||||||
|
sed -i "s/^state=.*/state=error/g" ${infoFile}
|
||||||
|
sed -i "s/^message=.*/message='setup: cl import backup failed'/g" ${infoFile}
|
||||||
|
echo "FAIL see ${logFile}"
|
||||||
|
echo "FAIL: setup: cl import backup failed" >> ${logFile}
|
||||||
|
echo "${error}" >> ${logFile}
|
||||||
|
exit 16
|
||||||
|
fi
|
||||||
|
|
||||||
|
# OLD WALLET FROM SEEDWORDS
|
||||||
|
elif [ "${seedWords}" != "" ]; then
|
||||||
|
|
||||||
|
echo "Restore CL wallet from seedWords ..." >> ${logFile}
|
||||||
|
source <(sudo /home/admin/config.scripts/cl.hsmtool.sh seed-force mainnet "${seedWords}" "${seedPassword}")
|
||||||
|
|
||||||
|
# check if wallet really got created
|
||||||
|
walletExistsNow=$(sudo ls /home/bitcoin/.lightning/bitcoin/hsm_secret 2>/dev/null | grep -c "hsm_secret")
|
||||||
|
if [ $walletExistsNow -eq 0 ]; then
|
||||||
|
sed -i "s/^state=.*/state=error/g" ${infoFile}
|
||||||
|
sed -i "s/^message=.*/message='setup: seed maybe wrong'/g" ${infoFile}
|
||||||
|
echo "FAIL: setup: no cl wallet created - seed maybe wrong" >> ${logFile}
|
||||||
|
exit 17
|
||||||
|
fi
|
||||||
|
|
||||||
|
# NEW WALLET
|
||||||
|
else
|
||||||
|
|
||||||
|
echo "Generate new CL wallet ..." >> ${logFile}
|
||||||
|
|
||||||
|
# generate new wallet
|
||||||
|
source <(sudo /home/admin/config.scripts/cl.hsmtool.sh new-force mainnet)
|
||||||
|
|
||||||
|
# check if got new seedwords
|
||||||
|
if [ "${seedwords}" == "" ] || [ "${seedwords6x4}" == "" ]; then
|
||||||
|
sed -i "s/^state=.*/state=error/g" ${infoFile}
|
||||||
|
sed -i "s/^message=.*/message='setup: no cl seedwords'/g" ${infoFile}
|
||||||
|
echo "FAIL: setup: no cl seedwords" >> ${logFile}
|
||||||
|
exit 18
|
||||||
|
fi
|
||||||
|
|
||||||
|
# check if wallet really got created
|
||||||
|
walletExistsNow=$(sudo ls /home/bitcoin/.lightning/bitcoin/hsm_secret 2>/dev/null | grep -c "hsm_secret")
|
||||||
|
if [ $walletExistsNow -eq 0 ]; then
|
||||||
|
sed -i "s/^state=.*/state=error/g" ${infoFile}
|
||||||
|
sed -i "s/^message=.*/message='setup: no cl wallet created'/g" ${infoFile}
|
||||||
|
echo "FAIL: setup: no cl wallet created" >> ${logFile}
|
||||||
|
exit 19
|
||||||
|
fi
|
||||||
|
|
||||||
|
# write created seedwords into SETUPFILE to be displayed to user on final setup later
|
||||||
|
echo "seedwordsNEW='${seedwords}'" >> ${setupFile}
|
||||||
|
echo "seedwords6x4NEW='${seedwords6x4}'" >> ${setupFile}
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
sudo sed -i "s/^message=.*/message='Provision Setup Finish'/g" ${infoFile}
|
||||||
|
echo "END Setup" >> ${logFile}
|
||||||
|
exit 0
|
278
home.admin/_provision.update.sh
Executable file
278
home.admin/_provision.update.sh
Executable file
|
@ -0,0 +1,278 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# LOGFILE - store debug logs of bootstrap
|
||||||
|
logFile="/home/admin/raspiblitz.provision-update.log"
|
||||||
|
|
||||||
|
# INFOFILE - state data from bootstrap
|
||||||
|
infoFile="/home/admin/raspiblitz.info"
|
||||||
|
|
||||||
|
# CONFIGFILE - configuration of RaspiBlitz
|
||||||
|
configFile="/mnt/hdd/raspiblitz.conf"
|
||||||
|
|
||||||
|
# SETUPFILE - - setup data of RaspiBlitz
|
||||||
|
setupFile="/var/cache/raspiblitz/temp/raspiblitz.setup"
|
||||||
|
source ${setupFile}
|
||||||
|
|
||||||
|
# log header
|
||||||
|
echo "" > ${logFile}
|
||||||
|
echo "###################################" >> ${logFile}
|
||||||
|
echo "# _provision.update.sh" >> ${logFile}
|
||||||
|
echo "###################################" >> ${logFile}
|
||||||
|
sudo sed -i "s/^message=.*/message='Running Data Update'/g" ${infoFile}
|
||||||
|
|
||||||
|
# HDD BTRFS RAID REPAIR IF NEEDED
|
||||||
|
source <(sudo /home/admin/config.scripts/blitz.datadrive.sh status)
|
||||||
|
if [ ${isBTRFS} -eq 1 ] && [ ${isMounted} -eq 1 ]; then
|
||||||
|
echo "CHECK BTRFS RAID" >> ${logFile}
|
||||||
|
if [ ${isRaid} -eq 1 ] && [ ${#raidUsbDev} -eq 0 ]; then
|
||||||
|
echo "HDD was set to work in RAID, but RAID drive is not connected" >> ${logFile}
|
||||||
|
echo "Trying to set HDD back to single mode." >> ${logFile}
|
||||||
|
sudo /home/admin/config.scripts/blitz.datadrive.sh raid off >> ${logFile}
|
||||||
|
else
|
||||||
|
echo "OK" >> ${logFile}
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# LOAD DATA & PRECHECK
|
||||||
|
|
||||||
|
# load old or init raspiblitz config
|
||||||
|
source ${configFile}
|
||||||
|
|
||||||
|
# check if config files contains basic: hostname
|
||||||
|
if [ ${#hostname} -eq 0 ]; then
|
||||||
|
sed -i "s/^state=.*/state=error/g" ${infoFile}
|
||||||
|
sed -i "s/^message=.*/message='config: missing hostname'/g" ${infoFile}
|
||||||
|
echo "FAIL see ${logFile}"
|
||||||
|
echo "FAIL: missing hostname in (${configFile})!" >> ${logFile}
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# check if config files contain lightning (lnd is default)
|
||||||
|
if [ "${lightning}" == "" ]; then
|
||||||
|
lightning="lnd"
|
||||||
|
echo "lightning=${lightning}" >> ${configFile}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# load codeVersion
|
||||||
|
source /home/admin/_version.info
|
||||||
|
|
||||||
|
# check if code version was loaded
|
||||||
|
if [ ${#codeVersion} -eq 0 ]; then
|
||||||
|
sed -i "s/^state=.*/state=error/g" ${infoFile}
|
||||||
|
sed -i "s/^message=.*/message='missing /home/admin/_version.info'/g" ${infoFile}
|
||||||
|
echo "FAIL see ${logFile}"
|
||||||
|
echo "FAIL: no code version (/home/admin/_version.info) found!" >> ${logFile}
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "prechecks OK" >> ${logFile}
|
||||||
|
|
||||||
|
# MIGRATION - DATA CONVERSION when updating config
|
||||||
|
# this is the place if on a future version change
|
||||||
|
# a conversion of config data or app data is needed
|
||||||
|
|
||||||
|
# if old bitcoin.conf exists ...
|
||||||
|
configExists=$(sudo ls /mnt/hdd/bitcoin/bitcoin.conf | grep -c '.conf')
|
||||||
|
if [ ${configExists} -eq 1 ]; then
|
||||||
|
echo "Checking old bitcoin.conf ..." >> ${logFile}
|
||||||
|
|
||||||
|
# make sure to fix bitcoind RPC port if not done in old version
|
||||||
|
# https://github.com/rootzoll/raspiblitz/issues/217
|
||||||
|
# https://github.com/rootzoll/raspiblitz/issues/950
|
||||||
|
|
||||||
|
if ! grep -Eq "^rpcallowip=.*" /mnt/hdd/${network}/${network}.conf; then
|
||||||
|
echo "fix issue #217 -> adding rpcallowip=127.0.0.1" >> ${logFile}
|
||||||
|
echo "rpcallowip=127.0.0.1" >> /mnt/hdd/${network}/${network}.conf
|
||||||
|
else
|
||||||
|
echo "check issue #217 -> ok rpcallow exists" >> ${logFile}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# check whether "main." needs to be added to rpcport and rpcbind
|
||||||
|
if grep -Eq "^rpcport=.*" /mnt/hdd/${network}/${network}.conf; then
|
||||||
|
echo "fix issue #950 -> change rpcport to main.rpcport" >> ${logFile}
|
||||||
|
sudo sed -i -E 's/^(rpcport=.*)/main.\1/g' /mnt/hdd/${network}/${network}.conf
|
||||||
|
else
|
||||||
|
echo "check issue #950 -> ok ^rpcport does not exist" >> ${logFile}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if grep -Eq "^rpcbind=.*" /mnt/hdd/${network}/${network}.conf; then
|
||||||
|
echo "fix issue #950 -> change rpcbind to main.rpcbind" >> ${logFile}
|
||||||
|
sudo sed -i -E 's/^(rpcbind=.*)/main.\1/g' /mnt/hdd/${network}/${network}.conf
|
||||||
|
else
|
||||||
|
echo "check issue #950 -> ok ^rpcbind does not exist" >> ${logFile}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# check whether right settings are there ("main.")
|
||||||
|
if ! grep -Eq "^main.rpcport=.*" /mnt/hdd/${network}/${network}.conf; then
|
||||||
|
echo "fix issue #217 -> adding main.rpcport=8332" >> ${logFile}
|
||||||
|
echo "main.rpcport=8332" >> /mnt/hdd/${network}/${network}.conf
|
||||||
|
else
|
||||||
|
echo "check issue #217 -> ok main.rpcport exists" >> ${logFile}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! grep -Eq "^main.rpcbind=.*" /mnt/hdd/${network}/${network}.conf; then
|
||||||
|
echo "fix issue #217 -> adding main.rpcbind=127.0.0.1:8332" >> ${logFile}
|
||||||
|
echo "main.rpcbind=127.0.0.1:8332" >> /mnt/hdd/${network}/${network}.conf
|
||||||
|
else
|
||||||
|
echo "check issue #217 -> ok main.rpcbind exists" >> ${logFile}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# same for testnet
|
||||||
|
if ! grep -Eq "^test.rpcport=.*" /mnt/hdd/${network}/${network}.conf; then
|
||||||
|
echo "fix issue #950 -> adding test.rpcport=18332" >> ${logFile}
|
||||||
|
echo "test.rpcport=18332" >> /mnt/hdd/${network}/${network}.conf
|
||||||
|
else
|
||||||
|
echo "check issue #950 -> ok test.rpcport exists" >> ${logFile}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! grep -Eq "^test.rpcbind=.*" /mnt/hdd/${network}/${network}.conf; then
|
||||||
|
echo "fix issue #950 -> adding test.rpcbind=127.0.0.1:18332" >> ${logFile}
|
||||||
|
echo "test.rpcbind=127.0.0.1:18332" >> /mnt/hdd/${network}/${network}.conf
|
||||||
|
else
|
||||||
|
echo "check issue #950 -> ok test.rpcbind exists" >> ${logFile}
|
||||||
|
fi
|
||||||
|
|
||||||
|
else
|
||||||
|
echo "WARN: /mnt/hdd/bitcoin/bitcoin.conf not found" >> ${logFile}
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Version Code: ${codeVersion}" >> ${logFile}
|
||||||
|
echo "Version Data: ${raspiBlitzVersion}" >> ${logFile}
|
||||||
|
|
||||||
|
if [ "${raspiBlitzVersion}" != "${codeVersion}" ]; then
|
||||||
|
echo "detected version change ... starting migration script" >> ${logFile}
|
||||||
|
# nothing specific here yet
|
||||||
|
echo "OK Done - Updating version in config"
|
||||||
|
sudo sed -i "s/^raspiBlitzVersion=.*/raspiBlitzVersion='${codeVersion}'/g" ${configFile}
|
||||||
|
else
|
||||||
|
echo "OK - version of config data is up to date" >> ${logFile}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# start network service
|
||||||
|
echo ""
|
||||||
|
echo "*** Start ${network} (UPDATE) ***" >> ${logFile}
|
||||||
|
sudo sed -i "s/^message=.*/message='Blockchain Testrun'/g" ${infoFile}
|
||||||
|
echo "- This can take a while .." >> ${logFile}
|
||||||
|
sudo chown -R bitcoin:bitcoin /mnt/hdd/${network} >>${logFile} 2>&1
|
||||||
|
sudo cp /home/admin/assets/${network}d.service /etc/systemd/system/${network}d.service
|
||||||
|
sudo systemctl daemon-reload >> ${logFile}
|
||||||
|
sudo systemctl enable ${network}d.service >> ${logFile}
|
||||||
|
sudo systemctl start ${network}d.service >> ${logFile}
|
||||||
|
|
||||||
|
# INSTALL LND on Upadte/Recovery
|
||||||
|
if [ "${lightning}" == "lnd" ]; then
|
||||||
|
|
||||||
|
# prepare lnd service
|
||||||
|
sed -i "5s/.*/Wants=${network}d.service/" /home/admin/assets/lnd.service >> ${logFile} 2>&1
|
||||||
|
sed -i "6s/.*/After=${network}d.service/" /home/admin/assets/lnd.service >> ${logFile} 2>&1
|
||||||
|
sudo cp /home/admin/assets/lnd.service /etc/systemd/system/lnd.service >> ${logFile} 2>&1
|
||||||
|
|
||||||
|
# convert old keysend by lndExtraParameter to raspiblitz.conf setting (will be enforced by lnd.check.sh prestart) since 1.7.1
|
||||||
|
if [ "${lndExtraParameter}" == "--accept-keysend" ]; then
|
||||||
|
echo "# MIGRATION KEYSEND from lndExtraParameter --> raspiblitz.conf" >> ${logFile}
|
||||||
|
sudo sed -i '/lndKeysend=.*/d' /mnt/hdd/raspiblitz.conf
|
||||||
|
echo "lndKeysend=on" >> /mnt/hdd/raspiblitz.conf
|
||||||
|
sudo sed -i "/^lndExtraParameter=/d" /mnt/hdd/raspiblitz.conf 2>/dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
# if old lnd.conf exists ...
|
||||||
|
configExists=$(sudo ls /mnt/hdd/lnd/lnd.conf | grep -c '.conf')
|
||||||
|
if [ ${configExists} -eq 1 ]; then
|
||||||
|
|
||||||
|
# make sure correct file permisions are set
|
||||||
|
sudo chown bitcoin:bitcoin /mnt/hdd/lnd/lnd.conf
|
||||||
|
sudo chmod 664 /mnt/hdd/lnd/lnd.conf
|
||||||
|
|
||||||
|
# make sure additional values are added to [Application Options] since v1.7
|
||||||
|
echo "- lnd.conf --> checking additional [Application Options] since v1.7" >> ${logFile}
|
||||||
|
applicationOptionsLineNumber=$(sudo grep -n "\[Application Options\]" /mnt/hdd/lnd/lnd.conf | cut -d ":" -f1)
|
||||||
|
if [ "${applicationOptionsLineNumber}" != "" ]; then
|
||||||
|
applicationOptionsLineNumber="$(($applicationOptionsLineNumber+1))"
|
||||||
|
|
||||||
|
# Avoid historical graph data sync
|
||||||
|
# ignore-historical-gossip-filters=1
|
||||||
|
configParamExists=$(sudo grep -c "^ignore-historical-gossip-filters=" /mnt/hdd/lnd/lnd.conf)
|
||||||
|
if [ "${configParamExists}" == "0" ]; then
|
||||||
|
echo " - ADDING 'ignore-historical-gossip-filters'" >> ${logFile}
|
||||||
|
sudo sed -i "${applicationOptionsLineNumber}iignore-historical-gossip-filters=1" /mnt/hdd/lnd/lnd.conf
|
||||||
|
else
|
||||||
|
echo " - OK 'ignore-historical-gossip-filters' exists (${configParamExists})" >> ${logFile}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Avoid slow startup time
|
||||||
|
# sync-freelist=1
|
||||||
|
configParamExists=$(sudo grep -c "^sync-freelist=" /mnt/hdd/lnd/lnd.conf)
|
||||||
|
if [ "${configParamExists}" == "0" ]; then
|
||||||
|
echo " - ADDING 'sync-freelist'" >> ${logFile}
|
||||||
|
sudo sed -i "${applicationOptionsLineNumber}isync-freelist=1" /mnt/hdd/lnd/lnd.conf
|
||||||
|
else
|
||||||
|
echo " - OK 'sync-freelist' exists (${configParamExists})" >> ${logFile}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Avoid high startup overhead
|
||||||
|
# stagger-initial-reconnect=1
|
||||||
|
configParamExists=$(sudo grep -c "^stagger-initial-reconnect=" /mnt/hdd/lnd/lnd.conf)
|
||||||
|
if [ "${configParamExists}" == "0" ]; then
|
||||||
|
echo " - ADDING 'stagger-initial-reconnect'" >> ${logFile}
|
||||||
|
sudo sed -i "${applicationOptionsLineNumber}istagger-initial-reconnect=1" /mnt/hdd/lnd/lnd.conf
|
||||||
|
else
|
||||||
|
echo " - OK 'stagger-initial-reconnect' exists (${configParamExists})" >> ${logFile}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Delete and recreate RPC TLS certificate when details change or cert expires
|
||||||
|
# tlsautorefresh=1
|
||||||
|
configParamExists=$(sudo grep -c "^tlsautorefresh=" /mnt/hdd/lnd/lnd.conf)
|
||||||
|
if [ "${configParamExists}" == "0" ]; then
|
||||||
|
echo " - ADDING 'tlsautorefresh'" >> ${logFile}
|
||||||
|
sudo sed -i "${applicationOptionsLineNumber}itlsautorefresh=1" /mnt/hdd/lnd/lnd.conf
|
||||||
|
else
|
||||||
|
echo " - OK 'tlsautorefresh' exists (${configParamExists})" >> ${logFile}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Do not include IPs in the RPC TLS certificate
|
||||||
|
# tlsdisableautofill=1
|
||||||
|
configParamExists=$(sudo grep -c "^tlsdisableautofill=" /mnt/hdd/lnd/lnd.conf)
|
||||||
|
if [ "${configParamExists}" == "0" ]; then
|
||||||
|
echo " - ADDING 'tlsdisableautofill'" >> ${logFile}
|
||||||
|
sudo sed -i "${applicationOptionsLineNumber}itlsdisableautofill=1" /mnt/hdd/lnd/lnd.conf
|
||||||
|
else
|
||||||
|
echo " - OK 'tlsdisableautofill' exists (${configParamExists})" >> ${logFile}
|
||||||
|
fi
|
||||||
|
|
||||||
|
else
|
||||||
|
echo " - WARN: section '[Application Options]' not found in lnd.conf" >> ${logFile}
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "WARN: /mnt/hdd/lnd/lnd.conf not found" >> ${logFile}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# start LND service
|
||||||
|
echo "Starting LND Service ..." >> ${logFile}
|
||||||
|
sudo systemctl enable lnd >> ${logFile}
|
||||||
|
sudo systemctl start lnd >> ${logFile}
|
||||||
|
|
||||||
|
elif [ "${lightning}" == "cl" ]; then
|
||||||
|
|
||||||
|
echo "Install C-lightning on update" >> ${logFile}
|
||||||
|
sudo sed -i "s/^message=.*/message='C-Lightning Install'/g" ${infoFile}
|
||||||
|
sudo /home/admin/config.scripts/cl.install.sh on mainnet >> ${logFile}
|
||||||
|
sudo sed -i "s/^message=.*/message='C-Lightning Setup'/g" ${infoFile}
|
||||||
|
|
||||||
|
elif [ "${lightning}" == "none" ]; then
|
||||||
|
|
||||||
|
echo "No Lightning" >> ${logFile}
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
sed -i "s/^state=.*/state=error/g" ${infoFile}
|
||||||
|
sed -i "s/^message=.*/message='unknown lightning (${lightning})'/g" ${infoFile}
|
||||||
|
echo "FAIL see ${logFile}"
|
||||||
|
echo "FAIL: unknown lightning (${lightning}) in (${configFile})!" >> ${logFile}
|
||||||
|
exit 1
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "END Migration/Init" >> ${logFile}
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
|
@ -10,13 +10,21 @@ logFile="/home/admin/raspiblitz.log"
|
||||||
|
|
||||||
# INFOFILE - state data from bootstrap
|
# INFOFILE - state data from bootstrap
|
||||||
infoFile="/home/admin/raspiblitz.info"
|
infoFile="/home/admin/raspiblitz.info"
|
||||||
|
infoFileDisplayClass="${displayClass}"
|
||||||
|
|
||||||
# CONFIGFILE - configuration of RaspiBlitz
|
# CONFIGFILE - configuration of RaspiBlitz
|
||||||
configFile="/mnt/hdd/raspiblitz.conf"
|
configFile="/mnt/hdd/raspiblitz.conf"
|
||||||
|
|
||||||
# debug info
|
# SETUPFILE
|
||||||
echo "STARTED Provisioning --> see logs in ${logFile}"
|
# this key/value file contains the state during the setup process
|
||||||
echo "STARTED Provisioning from preset config file" >> ${logFile}
|
setupFile="/var/cache/raspiblitz/temp/raspiblitz.setup"
|
||||||
|
source ${setupFile}
|
||||||
|
|
||||||
|
# log header
|
||||||
|
echo "" >> ${logFile}
|
||||||
|
echo "###################################" >> ${logFile}
|
||||||
|
echo "# _provision_.sh" >> ${logFile}
|
||||||
|
echo "###################################" >> ${logFile}
|
||||||
sudo sed -i "s/^message=.*/message='Provisioning from Config'/g" ${infoFile}
|
sudo sed -i "s/^message=.*/message='Provisioning from Config'/g" ${infoFile}
|
||||||
|
|
||||||
# check if there is a config file
|
# check if there is a config file
|
||||||
|
@ -26,86 +34,7 @@ if [ ${configExists} -eq 0 ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check that default parameter exist in config
|
|
||||||
parameterExists=$(cat /mnt/hdd/raspiblitz.conf | grep -c "lndExtraParameter=")
|
|
||||||
if [ ${parameterExists} -eq 0 ]; then
|
|
||||||
echo "lndExtraParameter=''" >> ${configFile}
|
|
||||||
fi
|
|
||||||
|
|
||||||
# check if file system was expanded to full capacity and sd card is bigger than 8GB
|
|
||||||
# see: https://github.com/rootzoll/raspiblitz/issues/936
|
|
||||||
echo "CHECK IF SD CARD NEEDS EXPANSION" >> ${logFile}
|
|
||||||
source ${infoFile}
|
|
||||||
|
|
||||||
# remember the DisplayClass from info file - before its gets overwritten by raspiblitz.conf to detect change
|
|
||||||
infoFileDisplayClass="${displayClass}"
|
|
||||||
|
|
||||||
minimumSizeByte=8192000000
|
|
||||||
rootPartition=$(sudo mount | grep " / " | cut -d " " -f 1 | cut -d "/" -f 3)
|
|
||||||
rootPartitionBytes=$(lsblk -b -o NAME,SIZE | grep "${rootPartition}" | tr -s ' ' | cut -d " " -f 2)
|
|
||||||
|
|
||||||
echo "rootPartition(${rootPartition})" >> ${logFile}
|
|
||||||
echo "rootPartitionBytes(${rootPartitionBytes})" >> ${logFile}
|
|
||||||
|
|
||||||
if [ ${#rootPartition} -gt 0 ]; then
|
|
||||||
echo "### CHECKING ROOT PARTITION SIZE ###" >> ${logFile}
|
|
||||||
sudo sed -i "s/^message=.*/message='Checking Disk size'/g" ${infoFile}
|
|
||||||
echo "Size in Bytes is: ${rootPartitionBytes} bytes on ($rootPartition)" >> ${logFile}
|
|
||||||
if [ $rootPartitionBytes -lt $minimumSizeByte ]; then
|
|
||||||
echo "Disk filesystem is smaller than ${minimumSizeByte} byte." >> ${logFile}
|
|
||||||
if [ ${fsexpanded} -eq 1 ]; then
|
|
||||||
echo "There was already an attempt to expand the fs, but still not bigger than 8GB." >> ${logFile}
|
|
||||||
echo "SD card seems to small - at least a 16GB disk is needed. Display on LCD to user." >> ${logFile}
|
|
||||||
sudo sed -i "s/^state=.*/state=sdtoosmall/g" ${infoFile}
|
|
||||||
sudo sed -i "s/^message=.*/message='Min 16GB SD card needed'/g" ${infoFile}
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
echo "Try to expand SD card FS, display info and reboot." >> ${logFile}
|
|
||||||
sudo sed -i "s/^state=.*/state=reboot/g" ${infoFile}
|
|
||||||
sudo sed -i "s/^message=.*/message='Expanding SD Card'/g" ${infoFile}
|
|
||||||
sudo sed -i "s/^fsexpanded=.*/fsexpanded=1/g" ${infoFile}
|
|
||||||
sleep 4
|
|
||||||
if [ "${cpu}" == "x86_64" ]; then
|
|
||||||
echo "Please expand disk size." >> ${logFile}
|
|
||||||
# TODO: Expand disk size on x86_64
|
|
||||||
elif [ "${baseimage}" = "raspbian" ] || [ "${baseimage}" = "raspios_arm64" ]; then
|
|
||||||
resizeRaspbian="/usr/bin/raspi-config"
|
|
||||||
if [ -x ${resizeRaspbian} ]; then
|
|
||||||
echo "RUNNING EXPAND RASPBERRYPI: ${resizeRaspbian}" >> ${logFile}
|
|
||||||
sudo $resizeRaspbian --expand-rootfs
|
|
||||||
echo "going into reboot" >> ${logFile}
|
|
||||||
sudo cp ${logFile} ${logFile}.fsexpand.recover
|
|
||||||
sudo shutdown -r now
|
|
||||||
exit 0
|
|
||||||
else
|
|
||||||
echo "FAIL to execute: ${resizeRaspbian}" >> ${logFile}
|
|
||||||
fi
|
|
||||||
elif [ "${baseimage}" = "armbian" ]; then
|
|
||||||
resizeArmbian="/usr/lib/armbian/armbian-resize-filesystem"
|
|
||||||
if [ -x ${resizeArmbian} ]; then
|
|
||||||
echo "RUNNING EXPAND ARMBIAN: ${resizeArmbian}" >> ${logFile}
|
|
||||||
sudo $resizeArmbian start
|
|
||||||
echo "going into reboot" >> ${logFile}
|
|
||||||
sudo cp ${logFile} ${logFile}.fsexpand.recover
|
|
||||||
sudo shutdown -r now
|
|
||||||
sleep 100
|
|
||||||
exit 0
|
|
||||||
else
|
|
||||||
echo "FAIL to execute: ${resizeArmbian}" >> ${logFile}
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "WARN on provision - Not known system expand-rootfs OS: ${baseimage}" >> ${logFile}
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "Size looks good. Bigger than ${minimumSizeByte} byte disk is used." >> ${logFile}
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "Disk of root partition ('$rootPartition') not detected, skipping the size check." >> ${logFile}
|
|
||||||
fi
|
|
||||||
|
|
||||||
# import config values
|
# import config values
|
||||||
sudo chmod 777 ${configFile}
|
|
||||||
source ${configFile}
|
source ${configFile}
|
||||||
|
|
||||||
##########################
|
##########################
|
||||||
|
@ -175,30 +104,31 @@ if [ "${network}" = "litecoin" ]; then
|
||||||
/home/admin/config.scripts/blitz.litecoin.sh on >> ${logFile}
|
/home/admin/config.scripts/blitz.litecoin.sh on >> ${logFile}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "# Make sure the user bitcoin is in the debian-tor group"
|
||||||
|
sudo usermod -a -G debian-tor bitcoin
|
||||||
|
|
||||||
|
echo "# Optimizing log files: rotate daily, keep 2 weeks & compress old days " >> ${logFile}
|
||||||
|
sudo sed -i "s/^weekly/daily/g" /etc/logrotate.conf >> ${logFile} 2>&1
|
||||||
|
sudo sed -i "s/^rotate 4/rotate 14/g" /etc/logrotate.conf >> ${logFile} 2>&1
|
||||||
|
sudo sed -i "s/^#compress/compress/g" /etc/logrotate.conf >> ${logFile} 2>&1
|
||||||
|
sudo systemctl restart logrotate
|
||||||
|
|
||||||
|
# make sure to have bitcoin core >=22 is backwards comp
|
||||||
|
# see https://github.com/rootzoll/raspiblitz/issues/2546
|
||||||
|
sed -i '/^deprecatedrpc=.*/d' /mnt/hdd/bitcoin/bitcoin.conf 2>/dev/null
|
||||||
|
echo "deprecatedrpc=addresses" >> /mnt/hdd/bitcoin/bitcoin.conf 2>/dev/null
|
||||||
|
|
||||||
# set hostname data
|
# set hostname data
|
||||||
echo "Setting lightning alias: ${hostname}" >> ${logFile}
|
echo "Setting lightning alias: ${hostname}" >> ${logFile}
|
||||||
sudo sed -i "s/^alias=.*/alias=${hostname}/g" /home/admin/assets/lnd.${network}.conf >> ${logFile} 2>&1
|
sudo sed -i "s/^alias=.*/alias=${hostname}/g" /home/admin/assets/lnd.${network}.conf >> ${logFile} 2>&1
|
||||||
|
|
||||||
# link old SSH PubKeys
|
# backup SSH PubKeys
|
||||||
# so that client ssh_known_hosts is not complaining after update
|
sudo /home/admin/config.scripts/blitz.ssh.sh backup
|
||||||
if [ -d "/mnt/hdd/ssh" ]; then
|
|
||||||
echo "Old SSH PubKey exists on HDD > copy them HDD to SD card for next start" >> ${logFile}
|
|
||||||
sudo cp -r /mnt/hdd/ssh/* /etc/ssh/ >> ${logFile} 2>&1
|
|
||||||
else
|
|
||||||
echo "No SSH PubKey exists on HDD > copy from SD card to HDD as backup" >> ${logFile}
|
|
||||||
sudo cp -r /etc/ssh /mnt/hdd/ssh >> ${logFile} 2>&1
|
|
||||||
fi
|
|
||||||
# just copy - dont link anymore so that sshd will also start without HDD connected
|
|
||||||
# see: https://github.com/rootzoll/raspiblitz/issues/1798
|
|
||||||
#sudo rm -rf /etc/ssh >> ${logFile} 2>&1
|
|
||||||
#sudo ln -s /mnt/hdd/ssh /etc/ssh >> ${logFile} 2>&1
|
|
||||||
#sudo /home/admin/config.scripts/blitz.systemd.sh update-sshd >> ${logFile} 2>&1
|
|
||||||
|
|
||||||
# optimize if RAM >1GB
|
# optimze mempool if RAM >1GB
|
||||||
kbSizeRAM=$(cat /proc/meminfo | grep "MemTotal" | sed 's/[^0-9]*//g')
|
kbSizeRAM=$(cat /proc/meminfo | grep "MemTotal" | sed 's/[^0-9]*//g')
|
||||||
if [ ${kbSizeRAM} -gt 1500000 ]; then
|
if [ ${kbSizeRAM} -gt 1500000 ]; then
|
||||||
echo "Detected RAM >1GB --> optimizing ${network}.conf"
|
echo "Detected RAM >1GB --> optimizing ${network}.conf"
|
||||||
sudo sed -i "s/^dbcache=.*/dbcache=1024/g" /mnt/hdd/${network}/${network}.conf
|
|
||||||
sudo sed -i "s/^maxmempool=.*/maxmempool=300/g" /mnt/hdd/${network}/${network}.conf
|
sudo sed -i "s/^maxmempool=.*/maxmempool=300/g" /mnt/hdd/${network}/${network}.conf
|
||||||
fi
|
fi
|
||||||
if [ ${kbSizeRAM} -gt 3500000 ]; then
|
if [ ${kbSizeRAM} -gt 3500000 ]; then
|
||||||
|
@ -218,32 +148,109 @@ sudo cp -r /mnt/hdd/lnd/data/chain /home/admin/.lnd/data/chain >> ${logFile} 2>&
|
||||||
sudo chown -R admin:admin /home/admin/.${network} >> ${logFile} 2>&1
|
sudo chown -R admin:admin /home/admin/.${network} >> ${logFile} 2>&1
|
||||||
sudo chown -R admin:admin /home/admin/.lnd >> ${logFile} 2>&1
|
sudo chown -R admin:admin /home/admin/.lnd >> ${logFile} 2>&1
|
||||||
sudo cp /home/admin/assets/${network}d.service /etc/systemd/system/${network}d.service >> ${logFile} 2>&1
|
sudo cp /home/admin/assets/${network}d.service /etc/systemd/system/${network}d.service >> ${logFile} 2>&1
|
||||||
sed -i "5s/.*/Wants=${network}d.service/" /home/admin/assets/lnd.service >> ${logFile} 2>&1
|
|
||||||
sed -i "6s/.*/After=${network}d.service/" /home/admin/assets/lnd.service >> ${logFile} 2>&1
|
|
||||||
sudo cp /home/admin/assets/lnd.service /etc/systemd/system/lnd.service >> ${logFile} 2>&1
|
|
||||||
|
|
||||||
sudo cp /home/admin/assets/tmux.conf.local /mnt/hdd/.tmux.conf.local >> ${logFile} 2>&1
|
sudo cp /home/admin/assets/tmux.conf.local /mnt/hdd/.tmux.conf.local >> ${logFile} 2>&1
|
||||||
sudo chown admin:admin /mnt/hdd/.tmux.conf.local >> ${logFile} 2>&1
|
sudo chown admin:admin /mnt/hdd/.tmux.conf.local >> ${logFile} 2>&1
|
||||||
sudo ln -s -f /mnt/hdd/.tmux.conf.local /home/admin/.tmux.conf.local >> ${logFile} 2>&1
|
sudo ln -s -f /mnt/hdd/.tmux.conf.local /home/admin/.tmux.conf.local >> ${logFile} 2>&1
|
||||||
|
|
||||||
# backup LND dir (especially for macaroons and tlscerts)
|
|
||||||
# https://github.com/rootzoll/raspiblitz/issues/324
|
# PREPARE LND (if activated)
|
||||||
echo "*** Make backup of LND directory" >> ${logFile}
|
if [ "${lightning}" == "lnd" ] || [ "${lnd}" == "on" ]; then
|
||||||
sudo rm -r /mnt/hdd/backup_lnd
|
|
||||||
sudo cp -r /mnt/hdd/lnd /mnt/hdd/backup_lnd >> ${logFile} 2>&1
|
echo "### PREPARE LND" >> ${logFile}
|
||||||
numOfDiffers=$(sudo diff -arq /mnt/hdd/lnd /mnt/hdd/backup_lnd | grep -c "differ")
|
|
||||||
if [ ${numOfDiffers} -gt 0 ]; then
|
# backup LND dir (especially for macaroons and tlscerts)
|
||||||
echo "FAIL: Backup was not successful" >> ${logFile}
|
# https://github.com/rootzoll/raspiblitz/issues/324
|
||||||
sudo diff -arq /mnt/hdd/lnd /mnt/hdd/backup_lnd >> ${logFile} 2>&1
|
echo "*** Make backup of LND directory" >> ${logFile}
|
||||||
echo "removing backup dir to prevent false override" >> ${logFile}
|
sudo rm -r /mnt/hdd/backup_lnd 2>/dev/null
|
||||||
else
|
sudo cp -r /mnt/hdd/lnd /mnt/hdd/backup_lnd >> ${logFile} 2>&1
|
||||||
echo "OK Backup is valid." >> ${logFile}
|
numOfDiffers=$(sudo diff -arq /mnt/hdd/lnd /mnt/hdd/backup_lnd | grep -c "differ")
|
||||||
|
if [ ${numOfDiffers} -gt 0 ]; then
|
||||||
|
echo "FAIL: Backup was not successful" >> ${logFile}
|
||||||
|
sudo diff -arq /mnt/hdd/lnd /mnt/hdd/backup_lnd >> ${logFile} 2>&1
|
||||||
|
echo "removing backup dir to prevent false override" >> ${logFile}
|
||||||
|
else
|
||||||
|
echo "OK Backup is valid." >> ${logFile}
|
||||||
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
echo "" >> ${logFile}
|
echo "" >> ${logFile}
|
||||||
|
|
||||||
|
##########################
|
||||||
|
# FINISH SETUP
|
||||||
|
##########################
|
||||||
|
|
||||||
# finish setup (SWAP, Benus, Firewall, Update, ..)
|
# finish setup (SWAP, Benus, Firewall, Update, ..)
|
||||||
sudo sed -i "s/^message=.*/message='Setup System ..'/g" ${infoFile}
|
sudo sed -i "s/^message=.*/message='Setup System ..'/g" ${infoFile}
|
||||||
/home/admin/90finishSetup.sh >> ${logFile} 2>&1
|
|
||||||
|
# add bonus scripts (auto install deactivated to reduce third party repos)
|
||||||
|
mkdir /home/admin/tmpScriptDL
|
||||||
|
cd /home/admin/tmpScriptDL
|
||||||
|
echo "installing bash completion for bitcoin-cli and lncli"
|
||||||
|
wget https://raw.githubusercontent.com/bitcoin/bitcoin/master/contrib/bitcoin-cli.bash-completion
|
||||||
|
wget https://raw.githubusercontent.com/lightningnetwork/lnd/master/contrib/lncli.bash-completion
|
||||||
|
sudo cp *.bash-completion /etc/bash_completion.d/
|
||||||
|
echo "OK - bash completion available after next login"
|
||||||
|
echo "type \"bitcoin-cli getblockch\", press [Tab] → bitcoin-cli getblockchaininfo"
|
||||||
|
rm -r /home/admin/tmpScriptDL
|
||||||
|
cd
|
||||||
|
|
||||||
|
###### SWAP File
|
||||||
|
source <(sudo /home/admin/config.scripts/blitz.datadrive.sh status)
|
||||||
|
if [ ${isSwapExternal} -eq 0 ]; then
|
||||||
|
echo "No external SWAP found - creating ... "
|
||||||
|
sudo /home/admin/config.scripts/blitz.datadrive.sh swap on
|
||||||
|
else
|
||||||
|
echo "SWAP already OK"
|
||||||
|
fi
|
||||||
|
|
||||||
|
####### FIREWALL - just install (not configure)
|
||||||
|
echo ""
|
||||||
|
echo "*** Setting and Activating Firewall ***"
|
||||||
|
echo "deny incoming connection on other ports"
|
||||||
|
sudo ufw default deny incoming
|
||||||
|
echo "allow outgoing connections"
|
||||||
|
sudo ufw default allow outgoing
|
||||||
|
echo "allow: ssh"
|
||||||
|
sudo ufw allow ssh
|
||||||
|
echo "allow: bitcoin testnet"
|
||||||
|
sudo ufw allow 18333 comment 'bitcoin testnet'
|
||||||
|
echo "allow: bitcoin mainnet"
|
||||||
|
sudo ufw allow 8333 comment 'bitcoin mainnet'
|
||||||
|
echo "allow: litecoin mainnet"
|
||||||
|
sudo ufw allow 9333 comment 'litecoin mainnet'
|
||||||
|
echo 'allow: lightning testnet'
|
||||||
|
sudo ufw allow 19735 comment 'lightning testnet'
|
||||||
|
echo "allow: lightning mainnet"
|
||||||
|
sudo ufw allow 9735 comment 'lightning mainnet'
|
||||||
|
echo "allow: lightning gRPC"
|
||||||
|
sudo ufw allow 10009 comment 'lightning gRPC'
|
||||||
|
echo "allow: lightning REST API"
|
||||||
|
sudo ufw allow 8080 comment 'lightning REST API'
|
||||||
|
echo "allow: transmission"
|
||||||
|
sudo ufw allow 49200:49250/tcp comment 'rtorrent'
|
||||||
|
echo "allow: public web HTTP"
|
||||||
|
sudo ufw allow from any to any port 80 comment 'allow public web HTTP'
|
||||||
|
echo "allow: local web admin HTTPS"
|
||||||
|
sudo ufw allow from 10.0.0.0/8 to any port 443 comment 'allow local LAN HTTPS'
|
||||||
|
sudo ufw allow from 172.16.0.0/12 to any port 443 comment 'allow local LAN HTTPS'
|
||||||
|
sudo ufw allow from 192.168.0.0/16 to any port 443 comment 'allow local LAN HTTPS'
|
||||||
|
echo "open firewall for auto nat discover (see issue #129)"
|
||||||
|
sudo ufw allow proto udp from 10.0.0.0/8 port 1900 to any comment 'allow local LAN SSDP for UPnP discovery'
|
||||||
|
sudo ufw allow proto udp from 172.16.0.0/12 port 1900 to any comment 'allow local LAN SSDP for UPnP discovery'
|
||||||
|
sudo ufw allow proto udp from 192.168.0.0/16 port 1900 to any comment 'allow local LAN SSDP for UPnP discovery'
|
||||||
|
echo "enable lazy firewall"
|
||||||
|
sudo ufw --force enable
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# update system
|
||||||
|
echo ""
|
||||||
|
echo "*** Update System ***"
|
||||||
|
sudo apt-mark hold raspberrypi-bootloader
|
||||||
|
sudo apt-get update -y
|
||||||
|
echo "OK - System is now up to date"
|
||||||
|
|
||||||
|
# mark setup is done
|
||||||
|
sudo sed -i "s/^setupStep=.*/setupStep=100/g" /home/admin/raspiblitz.info
|
||||||
|
|
||||||
##########################
|
##########################
|
||||||
# PROVISIONING SERVICES
|
# PROVISIONING SERVICES
|
||||||
|
@ -292,17 +299,94 @@ else
|
||||||
echo "Provisioning LND interims update - keep default" >> ${logFile}
|
echo "Provisioning LND interims update - keep default" >> ${logFile}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# TESTNET
|
# CL INTERIMS UPDATE
|
||||||
if [ "${chain}" = "test" ]; then
|
if [ ${#clInterimsUpdate} -gt 0 ]; then
|
||||||
echo "Provisioning TESTNET - run config script" >> ${logFile}
|
sudo sed -i "s/^message=.*/message='Provisioning CL update'/g" ${infoFile}
|
||||||
sudo sed -i "s/^message=.*/message='Provisioning Testnet'/g" ${infoFile}
|
if [ "${clInterimsUpdate}" == "reckless" ]; then
|
||||||
sudo /home/admin/config.scripts/network.chain.sh testnet >> ${logFile} 2>&1
|
# recklessly update CL to latest release on GitHub (just for test & dev nodes)
|
||||||
|
echo "Provisioning CL reckless interims update" >> ${logFile}
|
||||||
|
sudo /home/admin/config.scripts/cl.update.sh reckless >> ${logFile}
|
||||||
|
else
|
||||||
|
# when installing the same sd image - this will re-trigger the secure interims update
|
||||||
|
# if this a update with a newer RaspiBlitz version .. interims update will be ignored
|
||||||
|
# because standard CL version is most more up to date
|
||||||
|
echo "Provisioning CL verified interims update" >> ${logFile}
|
||||||
|
sudo /home/admin/config.scripts/cl.update.sh verified ${clInterimsUpdate} >> ${logFile}
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "Provisioning TESTNET - keep default" >> ${logFile}
|
echo "Provisioning CL interims update - keep default" >> ${logFile}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Bitcoin Testnet
|
||||||
|
if [ "${testnet}" == "on" ]; then
|
||||||
|
echo "Provisioning ${network} Testnet - run config script" >> ${logFile}
|
||||||
|
sudo /home/admin/config.scripts/bitcoin.install.sh on testnet >> ${logFile} 2>&1
|
||||||
|
sudo systemctl start tbitcoind >> ${logFile} 2>&1
|
||||||
|
else
|
||||||
|
echo "Provisioning ${network} Testnet - not active" >> ${logFile}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Bitcoin Signet
|
||||||
|
if [ "${signet}" == "on" ]; then
|
||||||
|
echo "Provisioning ${network} Signet - run config script" >> ${logFile}
|
||||||
|
sudo /home/admin/config.scripts/bitcoin.install.sh on signet >> ${logFile} 2>&1
|
||||||
|
sudo systemctl start sbitcoind >> ${logFile} 2>&1
|
||||||
|
else
|
||||||
|
echo "Provisioning ${network} Signet - not active" >> ${logFile}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# LND Mainnet (when not main instance)
|
||||||
|
if [ "${lnd}" == "on" ] && [ "${lightning}" != "lnd" ]; then
|
||||||
|
echo "Provisioning LND Mainnet - run config script" >> ${logFile}
|
||||||
|
sudo /home/admin/config.scripts/lnd.install.sh on mainnet >> ${logFile} 2>&1
|
||||||
|
else
|
||||||
|
echo "Provisioning LND Mainnet - not active as secondary option" >> ${logFile}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# LND Testnet
|
||||||
|
if [ "${tlnd}" == "on" ]; then
|
||||||
|
echo "Provisioning LND Testnet - run config script" >> ${logFile}
|
||||||
|
sudo /home/admin/config.scripts/lnd.install.sh on testnet >> ${logFile} 2>&1
|
||||||
|
sudo systemctl start tlnd >> ${logFile} 2>&1
|
||||||
|
else
|
||||||
|
echo "Provisioning LND Testnet - not active" >> ${logFile}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# LND Signet
|
||||||
|
if [ "${slnd}" == "on" ]; then
|
||||||
|
echo "Provisioning LND Signet - run config script" >> ${logFile}
|
||||||
|
sudo /home/admin/config.scripts/lnd.install.sh on signet >> ${logFile} 2>&1
|
||||||
|
sudo systemctl start slnd >> ${logFile} 2>&1
|
||||||
|
else
|
||||||
|
echo "Provisioning LND Signet - not active" >> ${logFile}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# CL Mainnet (when not main instance)
|
||||||
|
if [ "${cl}" == "on" ] && [ "${lightning}" != "cl" ]; then
|
||||||
|
echo "Provisioning CL Mainnet - run config script" >> ${logFile}
|
||||||
|
sudo /home/admin/config.scripts/cl.install.sh on mainnet >> ${logFile} 2>&1
|
||||||
|
else
|
||||||
|
echo "Provisioning CL Mainnet - not active as secondary option" >> ${logFile}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# CL Testnet
|
||||||
|
if [ "${tcl}" == "on" ]; then
|
||||||
|
echo "Provisioning CL Testnet - run config script" >> ${logFile}
|
||||||
|
sudo /home/admin/config.scripts/cl.install.sh on testnet >> ${logFile} 2>&1
|
||||||
|
else
|
||||||
|
echo "Provisioning CL Testnet - not active" >> ${logFile}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# CL Signet
|
||||||
|
if [ "${scl}" == "on" ]; then
|
||||||
|
echo "Provisioning CL Signet - run config script" >> ${logFile}
|
||||||
|
sudo /home/admin/config.scripts/cl.install.sh on signet >> ${logFile} 2>&1
|
||||||
|
else
|
||||||
|
echo "Provisioning CL Signet - not active" >> ${logFile}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# TOR
|
# TOR
|
||||||
if [ "${runBehindTor}" = "on" ]; then
|
if [ "${runBehindTor}" == "on" ]; then
|
||||||
echo "Provisioning TOR - run config script" >> ${logFile}
|
echo "Provisioning TOR - run config script" >> ${logFile}
|
||||||
sudo sed -i "s/^message=.*/message='Setup Tor (takes time)'/g" ${infoFile}
|
sudo sed -i "s/^message=.*/message='Setup Tor (takes time)'/g" ${infoFile}
|
||||||
sudo /home/admin/config.scripts/internet.tor.sh on >> ${logFile} 2>&1
|
sudo /home/admin/config.scripts/internet.tor.sh on >> ${logFile} 2>&1
|
||||||
|
@ -346,22 +430,56 @@ else
|
||||||
echo "Provisioning DYNAMIC DOMAIN - keep default" >> ${logFile}
|
echo "Provisioning DYNAMIC DOMAIN - keep default" >> ${logFile}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# RTL
|
# RTL (LND)
|
||||||
if [ "${rtlWebinterface}" = "on" ]; then
|
if [ "${rtlWebinterface}" = "on" ]; then
|
||||||
echo "Provisioning RTL - run config script" >> ${logFile}
|
echo "Provisioning RTL LND - run config script" >> ${logFile}
|
||||||
sudo sed -i "s/^message=.*/message='Setup RTL (takes time)'/g" ${infoFile}
|
sudo sed -i "s/^message=.*/message='Setup RTL (takes time)'/g" ${infoFile}
|
||||||
sudo -u admin /home/admin/config.scripts/bonus.rtl.sh on >> ${logFile} 2>&1
|
sudo -u admin /home/admin/config.scripts/bonus.rtl.sh on lnd mainnet >> ${logFile} 2>&1
|
||||||
sudo systemctl disable RTL # will get enabled after recover dialog
|
|
||||||
else
|
else
|
||||||
echo "Provisioning RTL - keep default" >> ${logFile}
|
echo "Provisioning RTL LND - keep default" >> ${logFile}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#LOOP
|
# RTL (CL)
|
||||||
if [ "${loop}" = "on" ]; then
|
if [ "${crtlWebinterface}" = "on" ]; then
|
||||||
|
echo "Provisioning RTL CL - run config script" >> ${logFile}
|
||||||
|
sudo sed -i "s/^message=.*/message='Setup RTL (takes time)'/g" ${infoFile}
|
||||||
|
sudo -u admin /home/admin/config.scripts/bonus.rtl.sh on cl mainnet >> ${logFile} 2>&1
|
||||||
|
else
|
||||||
|
echo "Provisioning RTL CL - keep default" >> ${logFile}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# SPARKO
|
||||||
|
if [ "${sparko}" = "on" ]; then
|
||||||
|
echo "Provisioning Sparko - run config script" >> ${logFile}
|
||||||
|
sudo sed -i "s/^message=.*/message='Setup SPARKO'/g" ${infoFile}
|
||||||
|
sudo -u admin /home/admin/config.scripts/cl-plugin.sparko.sh on mainnet >> ${logFile} 2>&1
|
||||||
|
else
|
||||||
|
echo "Provisioning Sparko - keep default" >> ${logFile}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# clHTTPplugin
|
||||||
|
if [ "${clHTTPplugin}" = "on" ]; then
|
||||||
|
echo "Provisioning clHTTPplugin - run config script" >> ${logFile}
|
||||||
|
sudo sed -i "s/^message=.*/message='Setup clHTTPplugin'/g" ${infoFile}
|
||||||
|
sudo -u admin /home/admin/config.scripts/cl-plugin.http.sh on >> ${logFile} 2>&1
|
||||||
|
else
|
||||||
|
echo "Provisioning clHTTPplugin - keep default" >> ${logFile}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# SPARK
|
||||||
|
if [ "${spark}" = "on" ]; then
|
||||||
|
echo "Provisioning Spark Wallet - run config script" >> ${logFile}
|
||||||
|
sudo sed -i "s/^message=.*/message='Setup SPARK WALLET'/g" ${infoFile}
|
||||||
|
sudo -u admin /home/admin/config.scripts/cl.spark.sh on mainnet >> ${logFile} 2>&1
|
||||||
|
else
|
||||||
|
echo "Provisioning Spark Wallet - keep default" >> ${logFile}
|
||||||
|
fi
|
||||||
|
|
||||||
|
#LOOP - install only if LiT won't be installed
|
||||||
|
if [ "${loop}" = "on" ] && [ "${lit}" != "on" ]; then
|
||||||
echo "Provisioning Lightning Loop - run config script" >> ${logFile}
|
echo "Provisioning Lightning Loop - run config script" >> ${logFile}
|
||||||
sudo sed -i "s/^message=.*/message='Setup Lightning Loop'/g" ${infoFile}
|
sudo sed -i "s/^message=.*/message='Setup Lightning Loop'/g" ${infoFile}
|
||||||
sudo -u admin /home/admin/config.scripts/bonus.loop.sh on >> ${logFile} 2>&1
|
sudo -u admin /home/admin/config.scripts/bonus.loop.sh on >> ${logFile} 2>&1
|
||||||
sudo systemctl disable loopd # will get enabled after recover dialog
|
|
||||||
else
|
else
|
||||||
echo "Provisioning Lightning Loop - keep default" >> ${logFile}
|
echo "Provisioning Lightning Loop - keep default" >> ${logFile}
|
||||||
fi
|
fi
|
||||||
|
@ -371,7 +489,6 @@ if [ "${BTCRPCexplorer}" = "on" ]; then
|
||||||
echo "Provisioning BTCRPCexplorer - run config script" >> ${logFile}
|
echo "Provisioning BTCRPCexplorer - run config script" >> ${logFile}
|
||||||
sudo sed -i "s/^message=.*/message='Setup BTCRPCexplorer (takes time)'/g" ${infoFile}
|
sudo sed -i "s/^message=.*/message='Setup BTCRPCexplorer (takes time)'/g" ${infoFile}
|
||||||
sudo -u admin /home/admin/config.scripts/bonus.btc-rpc-explorer.sh on >> ${logFile} 2>&1
|
sudo -u admin /home/admin/config.scripts/bonus.btc-rpc-explorer.sh on >> ${logFile} 2>&1
|
||||||
sudo systemctl disable btc-rpc-explorer # will get enabled after recover dialog
|
|
||||||
else
|
else
|
||||||
echo "Provisioning BTCRPCexplorer - keep default" >> ${logFile}
|
echo "Provisioning BTCRPCexplorer - keep default" >> ${logFile}
|
||||||
fi
|
fi
|
||||||
|
@ -381,7 +498,6 @@ if [ "${ElectRS}" = "on" ]; then
|
||||||
echo "Provisioning ElectRS - run config script" >> ${logFile}
|
echo "Provisioning ElectRS - run config script" >> ${logFile}
|
||||||
sudo sed -i "s/^message=.*/message='Setup ElectRS (takes time)'/g" ${infoFile}
|
sudo sed -i "s/^message=.*/message='Setup ElectRS (takes time)'/g" ${infoFile}
|
||||||
sudo -u admin /home/admin/config.scripts/bonus.electrs.sh on >> ${logFile} 2>&1
|
sudo -u admin /home/admin/config.scripts/bonus.electrs.sh on >> ${logFile} 2>&1
|
||||||
sudo systemctl disable electrs # will get enabled after recover dialog
|
|
||||||
else
|
else
|
||||||
echo "Provisioning ElectRS - keep default" >> ${logFile}
|
echo "Provisioning ElectRS - keep default" >> ${logFile}
|
||||||
fi
|
fi
|
||||||
|
@ -392,13 +508,7 @@ if [ "${BTCPayServer}" = "on" ]; then
|
||||||
echo "Provisioning BTCPAYSERVER on TOR - running setup" >> ${logFile}
|
echo "Provisioning BTCPAYSERVER on TOR - running setup" >> ${logFile}
|
||||||
sudo sed -i "s/^message=.*/message='Setup BTCPay (takes time)'/g" ${infoFile}
|
sudo sed -i "s/^message=.*/message='Setup BTCPay (takes time)'/g" ${infoFile}
|
||||||
sudo -u admin /home/admin/config.scripts/bonus.btcpayserver.sh on >> ${logFile} 2>&1
|
sudo -u admin /home/admin/config.scripts/bonus.btcpayserver.sh on >> ${logFile} 2>&1
|
||||||
|
|
||||||
#echo "Provisioning BTCPAYSERVER on TOR - run on after bootup script" >> ${logFile}
|
|
||||||
# because BTCPAY server freezes during recovery .. it will get installed after reboot
|
|
||||||
#echo "sudo -u admin /home/admin/config.scripts/bonus.btcpayserver.sh on" >> /home/admin/setup.sh
|
|
||||||
#sudo chmod +x /home/admin/setup.sh >> ${logFile}
|
|
||||||
#sudo ls -la /home/admin/setup.sh >> ${logFile}
|
|
||||||
|
|
||||||
else
|
else
|
||||||
echo "Provisioning BTCPayServer - keep default" >> ${logFile}
|
echo "Provisioning BTCPayServer - keep default" >> ${logFile}
|
||||||
fi
|
fi
|
||||||
|
@ -445,17 +555,6 @@ else
|
||||||
echo "Provisioning chantools - keep default" >> ${logFile}
|
echo "Provisioning chantools - keep default" >> ${logFile}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ROOT SSH KEYS
|
|
||||||
# check if a backup on HDD exists – if so, restore it
|
|
||||||
backupRootSSH=$(sudo ls /mnt/hdd/ssh/root_backup 2>/dev/null | grep -c "id_rsa")
|
|
||||||
if [ ${backupRootSSH} -gt 0 ]; then
|
|
||||||
echo "Provisioning Root SSH Keys - RESTORING from HDD" >> ${logFile}
|
|
||||||
sudo cp -r /mnt/hdd/ssh/root_backup /root/.ssh
|
|
||||||
sudo chown -R root:root /root/.ssh
|
|
||||||
else
|
|
||||||
echo "Provisioning Root SSH Keys - keep default" >> ${logFile}
|
|
||||||
fi
|
|
||||||
|
|
||||||
# SSH TUNNEL
|
# SSH TUNNEL
|
||||||
if [ "${#sshtunnel}" -gt 0 ]; then
|
if [ "${#sshtunnel}" -gt 0 ]; then
|
||||||
echo "Provisioning SSH Tunnel - run config script" >> ${logFile}
|
echo "Provisioning SSH Tunnel - run config script" >> ${logFile}
|
||||||
|
@ -475,13 +574,17 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# LCD ROTATE
|
# LCD ROTATE
|
||||||
if [ "${#lcdrotate}" -eq 0 ]; then
|
if [ ${#lcdrotate} -eq 0 ]; then
|
||||||
# when upgrading from an old raspiblitz - enforce lcdrotate = 0
|
# when upgrading from an old raspiblitz - enforce lcdrotate = 0
|
||||||
lcdrotate=0
|
lcdrotate=0
|
||||||
fi
|
fi
|
||||||
echo "Provisioning LCD rotate - run config script" >> ${logFile}
|
if [ "${lcdrotate}" == "0" ]; then
|
||||||
sudo sed -i "s/^message=.*/message='LCD Rotate'/g" ${infoFile}
|
echo "Provisioning LCD rotate - run config script" >> ${logFile}
|
||||||
sudo /home/admin/config.scripts/blitz.display.sh rotate ${lcdrotate} >> ${logFile} 2>&1
|
sudo sed -i "s/^message=.*/message='LCD Rotate'/g" ${infoFile}
|
||||||
|
sudo /home/admin/config.scripts/blitz.display.sh rotate ${lcdrotate} >> ${logFile} 2>&1
|
||||||
|
else
|
||||||
|
echo "Provisioning LCD rotate - not needed, keep default rotate on" >> ${logFile}
|
||||||
|
fi
|
||||||
|
|
||||||
# TOUCHSCREEN
|
# TOUCHSCREEN
|
||||||
if [ "${#touchscreen}" -gt 0 ]; then
|
if [ "${#touchscreen}" -gt 0 ]; then
|
||||||
|
@ -523,7 +626,7 @@ fi
|
||||||
if [ "${specter}" = "on" ]; then
|
if [ "${specter}" = "on" ]; then
|
||||||
echo "Provisioning Specter - run config script" >> ${logFile}
|
echo "Provisioning Specter - run config script" >> ${logFile}
|
||||||
sudo sed -i "s/^message=.*/message='Setup Specter'/g" ${infoFile}
|
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
|
sudo -u admin /home/admin/config.scripts/bonus.specter.sh on >> ${logFile} 2>&1
|
||||||
else
|
else
|
||||||
echo "Provisioning Specter - keep default" >> ${logFile}
|
echo "Provisioning Specter - keep default" >> ${logFile}
|
||||||
fi
|
fi
|
||||||
|
@ -600,6 +703,15 @@ else
|
||||||
echo "Provisioning Stacking Sats Kraken - keep default" >> ${logFile}
|
echo "Provisioning Stacking Sats Kraken - keep default" >> ${logFile}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Pool - install only if LiT won't be installed
|
||||||
|
if [ "${pool}" = "on" ] && [ "${lit}" != "on" ]; then
|
||||||
|
echo "Provisioning Pool - run config script" >> ${logFile}
|
||||||
|
sudo sed -i "s/^message=.*/message='Setup Pool'/g" ${infoFile}
|
||||||
|
sudo -u admin /home/admin/config.scripts/bonus.pool.sh on >> ${logFile} 2>&1
|
||||||
|
else
|
||||||
|
echo "Provisioning Pool - keep default" >> ${logFile}
|
||||||
|
fi
|
||||||
|
|
||||||
# lit (make sure to be installed after RTL)
|
# lit (make sure to be installed after RTL)
|
||||||
if [ "${lit}" = "on" ]; then
|
if [ "${lit}" = "on" ]; then
|
||||||
echo "Provisioning LIT - run config script" >> ${logFile}
|
echo "Provisioning LIT - run config script" >> ${logFile}
|
||||||
|
@ -609,15 +721,6 @@ else
|
||||||
echo "Provisioning LIT - keep default" >> ${logFile}
|
echo "Provisioning LIT - keep default" >> ${logFile}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# pool
|
|
||||||
if [ "${pool}" = "on" ]; then
|
|
||||||
echo "Provisioning Pool - run config script" >> ${logFile}
|
|
||||||
sudo sed -i "s/^message=.*/message='Setup Pool'/g" ${infoFile}
|
|
||||||
sudo -u admin /home/admin/config.scripts/bonus.pool.sh on >> ${logFile} 2>&1
|
|
||||||
else
|
|
||||||
echo "Provisioning Pool - keep default" >> ${logFile}
|
|
||||||
fi
|
|
||||||
|
|
||||||
# sphinxrelay
|
# sphinxrelay
|
||||||
if [ "${sphinxrelay}" = "on" ]; then
|
if [ "${sphinxrelay}" = "on" ]; then
|
||||||
echo "Sphinx-Relay - run config script" >> ${logFile}
|
echo "Sphinx-Relay - run config script" >> ${logFile}
|
||||||
|
@ -720,7 +823,27 @@ else
|
||||||
sudo /home/admin/config.scripts/blitz.datadrive.sh fstab ${datadisk} >> ${logFile}
|
sudo /home/admin/config.scripts/blitz.datadrive.sh fstab ${datadisk} >> ${logFile}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# MAKE SURE SERVICES ARE RUNNING
|
||||||
|
echo "Make sure main services are running .." >> ${logFile}
|
||||||
|
sudo systemctl start ${network}d
|
||||||
|
if [ "${lightning}" == "lnd" ];then
|
||||||
|
sudo systemctl start lnd
|
||||||
|
# set password c if given in flag from migration prep
|
||||||
|
passwordFlagExists=$(sudo ls /mnt/hdd/passwordc.flag | grep -c "passwordc.flag")
|
||||||
|
if [ "${passwordFlagExists}" == "1" ]; then
|
||||||
|
echo "Found /mnt/hdd/passwordc.flag .. changing password" >> ${logFile}
|
||||||
|
oldPasswordC=$(sudo cat /mnt/hdd/passwordc.flag)
|
||||||
|
sudo /home/admin/config.scripts/lnd.initwallet.py change-password mainnet "${oldPasswordC}" "${passwordC}" >> ${logFile}
|
||||||
|
sudo shred -u /mnt/hdd/passwordc.flag
|
||||||
|
else
|
||||||
|
echo "No /mnt/hdd/passwordc.flag" >> ${logFile}
|
||||||
|
fi
|
||||||
|
elif [ "${lightning}" == "cl" ];then
|
||||||
|
sudo systemctl start lightningd
|
||||||
|
fi
|
||||||
|
|
||||||
echo "DONE - Give raspi some cool off time after hard building .... 5 secs sleep" >> ${logFile}
|
echo "DONE - Give raspi some cool off time after hard building .... 5 secs sleep" >> ${logFile}
|
||||||
sleep 5
|
sleep 5
|
||||||
|
|
||||||
echo "END Provisioning" >> ${logFile}
|
echo "END Provisioning" >> ${logFile}
|
||||||
|
exit 0
|
|
@ -1,2 +1,2 @@
|
||||||
# RaspiBlitz Version - always [major].[main].[sub] (sub can be a string like '2rc1')
|
# RaspiBlitz Version - always [major].[main].[sub] (sub can be a string like '2rc1')
|
||||||
codeVersion="1.7.0"
|
codeVersion="1.7.1"
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -3,8 +3,8 @@
|
||||||
|
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=RaspiBlitz Background Monitoring Service
|
Description=RaspiBlitz Background Monitoring Service
|
||||||
Wants=bootstrap.service
|
Wants=network.target
|
||||||
After=bootstrap.service
|
After=network.target
|
||||||
|
|
||||||
# for use with sendmail alert (coming soon)
|
# for use with sendmail alert (coming soon)
|
||||||
#OnFailure=systemd-sendmail@%n
|
#OnFailure=systemd-sendmail@%n
|
||||||
|
@ -14,11 +14,10 @@ User=root
|
||||||
Group=root
|
Group=root
|
||||||
Type=simple
|
Type=simple
|
||||||
ExecStart=/home/admin/_background.sh
|
ExecStart=/home/admin/_background.sh
|
||||||
KillMode=process
|
|
||||||
Restart=always
|
Restart=always
|
||||||
TimeoutSec=10
|
TimeoutSec=10
|
||||||
RestartSec=10
|
RestartSec=10
|
||||||
StandardOutput=journal
|
StandardOutput=journal
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
|
@ -1,4 +1,5 @@
|
||||||
# bitcoind configuration
|
# bitcoind configuration
|
||||||
|
# some values might be overruled directly systemd-service exec call parameters
|
||||||
|
|
||||||
# mainnet/testnet
|
# mainnet/testnet
|
||||||
testnet=0
|
testnet=0
|
||||||
|
@ -9,13 +10,16 @@ daemon=1
|
||||||
txindex=0
|
txindex=0
|
||||||
disablewallet=1
|
disablewallet=1
|
||||||
peerbloomfilters=1
|
peerbloomfilters=1
|
||||||
|
datadir=/mnt/hdd/bitcoin
|
||||||
|
|
||||||
# Connection settings
|
# Connection settings
|
||||||
rpcuser=raspibolt
|
rpcuser=raspibolt
|
||||||
rpcpassword=passwordB
|
rpcpassword=passwordB
|
||||||
rpcport=8332
|
main.rpcport=8332
|
||||||
|
test.rpcport=18332
|
||||||
rpcallowip=127.0.0.1
|
rpcallowip=127.0.0.1
|
||||||
rpcbind=127.0.0.1:8332
|
main.rpcbind=127.0.0.1:8332
|
||||||
|
test.rpcbind=127.0.0.1:18332
|
||||||
zmqpubrawblock=tcp://127.0.0.1:28332
|
zmqpubrawblock=tcp://127.0.0.1:28332
|
||||||
zmqpubrawtx=tcp://127.0.0.1:28333
|
zmqpubrawtx=tcp://127.0.0.1:28333
|
||||||
|
|
||||||
|
@ -26,4 +30,10 @@ maxmempool=300
|
||||||
maxconnections=40
|
maxconnections=40
|
||||||
maxuploadtarget=5000
|
maxuploadtarget=5000
|
||||||
|
|
||||||
datadir=/mnt/hdd/bitcoin
|
# tor by default
|
||||||
|
onlynet=onion
|
||||||
|
proxy=127.0.0.1:9050
|
||||||
|
main.bind=127.0.0.1
|
||||||
|
test.bind=127.0.0.1
|
||||||
|
dnsseed=0
|
||||||
|
dns=0
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
# RaspiBlitz: systemd unit for bitcoind
|
# RaspiBlitz: systemd unit for bitcoind
|
||||||
|
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Bitcoin daemon
|
Description=Bitcoin-Daemon
|
||||||
Wants=bootstrap.service
|
Wants=network.target
|
||||||
After=bootstrap.service
|
After=network.target
|
||||||
|
|
||||||
# for use with sendmail alert (coming soon)
|
# for use with sendmail alert
|
||||||
#OnFailure=systemd-sendmail@%n
|
#OnFailure=systemd-sendmail@%n
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
|
@ -14,13 +13,18 @@ Group=bitcoin
|
||||||
Type=forking
|
Type=forking
|
||||||
PIDFile=/mnt/hdd/bitcoin/bitcoind.pid
|
PIDFile=/mnt/hdd/bitcoin/bitcoind.pid
|
||||||
ExecStartPre=-/home/admin/config.scripts/blitz.systemd.sh log blockchain STARTED
|
ExecStartPre=-/home/admin/config.scripts/blitz.systemd.sh log blockchain STARTED
|
||||||
ExecStart=/usr/local/bin/bitcoind -daemon -conf=/home/bitcoin/.bitcoin/bitcoin.conf -pid=/mnt/hdd/bitcoin/bitcoind.pid
|
ExecStart=/usr/local/bin/bitcoind -daemon -conf=/mnt/hdd/bitcoin/bitcoin.conf -pid=/mnt/hdd/bitcoin/bitcoind.pid -debuglogfile=/mnt/hdd/bitcoin/debug.log
|
||||||
KillMode=process
|
|
||||||
Restart=always
|
Restart=always
|
||||||
TimeoutSec=120
|
TimeoutSec=120
|
||||||
RestartSec=30
|
RestartSec=30
|
||||||
StandardOutput=null
|
StandardOutput=null
|
||||||
StandardError=journal
|
StandardError=journal
|
||||||
|
|
||||||
|
# Hardening measures
|
||||||
|
PrivateTmp=true
|
||||||
|
ProtectSystem=full
|
||||||
|
NoNewPrivileges=true
|
||||||
|
PrivateDevices=true
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
|
@ -1,44 +0,0 @@
|
||||||
## RaspiBlitz NGINX config: blitzweb.conf
|
|
||||||
|
|
||||||
server {
|
|
||||||
|
|
||||||
# localhost only
|
|
||||||
listen 127.0.0.1:443 ssl default_server;
|
|
||||||
listen [::1]:443 ssl default_server;
|
|
||||||
# any interface
|
|
||||||
#listen 443 ssl default_server;
|
|
||||||
#listen [::]:443 ssl default_server;
|
|
||||||
|
|
||||||
server_name _;
|
|
||||||
|
|
||||||
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
|
|
||||||
ssl_prefer_server_ciphers on;
|
|
||||||
ssl_ciphers "EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA256:EECDH+aRSA+SHA256:EECDH+ECDSA+SHA384:EECDH+ECDSA+SHA256:EECDH+aRSA+SHA384:EDH+aRSA+AESGCM:EDH+aRSA+SHA256:EDH+aRSA:EECDH:!aNULL:!eNULL:!MEDIUM:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS:!RC4:!SEED";
|
|
||||||
|
|
||||||
add_header Strict-Transport-Security "max-age=31536000";
|
|
||||||
|
|
||||||
# ToDo(frennkie) if /mnt/hdd/app-data is missing (e.g. no disk) this will cause nginx to fail!
|
|
||||||
ssl_certificate /mnt/hdd/app-data/nginx/tls.cert;
|
|
||||||
ssl_certificate_key /mnt/hdd/app-data/nginx/tls.key;
|
|
||||||
|
|
||||||
##
|
|
||||||
# Logging Settings
|
|
||||||
##
|
|
||||||
|
|
||||||
access_log /var/log/nginx/access_raspiblitz.log;
|
|
||||||
error_log /var/log/nginx/error_raspiblitz.log;
|
|
||||||
|
|
||||||
root /var/www/blitzweb;
|
|
||||||
|
|
||||||
location / {
|
|
||||||
# First attempt to serve request as file, then
|
|
||||||
# as directory, then fall back to displaying a 404.
|
|
||||||
try_files $uri $uri/ =404;
|
|
||||||
}
|
|
||||||
|
|
||||||
location /info/ {
|
|
||||||
auth_basic "BlitzWeb (admin:Password B)";
|
|
||||||
auth_basic_user_file /etc/nginx/.htpasswd;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,4 +1,5 @@
|
||||||
# litecoind configuration
|
# litecoind configuration
|
||||||
|
# some values might be overruled directly systemd-service exec call parameters
|
||||||
|
|
||||||
# mainnet/testnet
|
# mainnet/testnet
|
||||||
testnet=0
|
testnet=0
|
||||||
|
@ -8,6 +9,7 @@ server=1
|
||||||
daemon=1
|
daemon=1
|
||||||
txindex=0
|
txindex=0
|
||||||
disablewallet=1
|
disablewallet=1
|
||||||
|
datadir=/mnt/hdd/litecoin
|
||||||
|
|
||||||
# Connection settings
|
# Connection settings
|
||||||
rpcuser=raspibolt
|
rpcuser=raspibolt
|
||||||
|
@ -26,4 +28,11 @@ maxuploadtarget=5000
|
||||||
discardfee=0.00000001
|
discardfee=0.00000001
|
||||||
mintxfee=0.00000001
|
mintxfee=0.00000001
|
||||||
minrelaytxfee=0.00000001
|
minrelaytxfee=0.00000001
|
||||||
datadir=/mnt/hdd/litecoin
|
|
||||||
|
# tor by default
|
||||||
|
onlynet=onion
|
||||||
|
proxy=127.0.0.1:9050
|
||||||
|
main.bind=127.0.0.1
|
||||||
|
test.bind=127.0.0.1
|
||||||
|
dnsseed=0
|
||||||
|
dns=0
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
|
# RaspiBlitz: systemd unit for bitcoind
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Litecoin daemon
|
Description=Litecoin-Daemon
|
||||||
Wants=bootstrap.service
|
Wants=network.target
|
||||||
After=bootstrap.service
|
After=network.target
|
||||||
|
|
||||||
# for use with sendmail alert (coming soon)
|
# for use with sendmail alert (coming soon)
|
||||||
#OnFailure=systemd-sendmail@%n
|
#OnFailure=systemd-sendmail@%n
|
||||||
|
@ -12,13 +13,18 @@ Group=bitcoin
|
||||||
Type=forking
|
Type=forking
|
||||||
PIDFile=/home/bitcoin/.litecoin/litecoind.pid
|
PIDFile=/home/bitcoin/.litecoin/litecoind.pid
|
||||||
ExecStartPre=-/home/admin/config.scripts/blitz.systemd.sh log blockchain STARTED
|
ExecStartPre=-/home/admin/config.scripts/blitz.systemd.sh log blockchain STARTED
|
||||||
ExecStart=/usr/local/bin/litecoind -daemon -conf=/home/bitcoin/.litecoin/litecoin.conf -pid=/home/bitcoin/.litecoin/litecoind.pid
|
ExecStart=/usr/local/bin/litecoind -daemon -conf=/home/bitcoin/.litecoin/litecoin.conf -pid=/home/bitcoin/.litecoin/litecoind.pid -debuglogfile=/mnt/hdd/litecoin/debug.log
|
||||||
KillMode=process
|
|
||||||
Restart=always
|
Restart=always
|
||||||
TimeoutSec=120
|
TimeoutSec=120
|
||||||
RestartSec=30
|
RestartSec=30
|
||||||
StandardOutput=null
|
StandardOutput=null
|
||||||
StandardError=journal
|
StandardError=journal
|
||||||
|
|
||||||
|
# Hardening measures
|
||||||
|
PrivateTmp=true
|
||||||
|
ProtectSystem=full
|
||||||
|
NoNewPrivileges=true
|
||||||
|
PrivateDevices=true
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
|
@ -1,4 +1,4 @@
|
||||||
# lnd configuration
|
# lnd configuration - some values might be overruled directly systemd-service exec call parameters
|
||||||
|
|
||||||
[Application Options]
|
[Application Options]
|
||||||
debuglevel=debug
|
debuglevel=debug
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# lnd configuration
|
# lnd configuration - some values might be overruled directly systemd-service exec call parameters
|
||||||
|
|
||||||
[Application Options]
|
[Application Options]
|
||||||
debuglevel=debug
|
debuglevel=debug
|
||||||
|
|
|
@ -9,20 +9,24 @@ After=bitcoind.service
|
||||||
#OnFailure=systemd-sendmail@%n
|
#OnFailure=systemd-sendmail@%n
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
EnvironmentFile=/mnt/hdd/raspiblitz.conf
|
ExecStartPre=-/home/admin/config.scripts/lnd.check.sh prestart mainnet
|
||||||
ExecStartPre=-/home/admin/config.scripts/blitz.systemd.sh log lightning STARTED
|
ExecStart=/usr/local/bin/lnd --configfile=/home/bitcoin/.lnd/lnd.conf
|
||||||
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
|
||||||
LimitNOFILE=128000
|
LimitNOFILE=128000
|
||||||
Type=simple
|
Type=simple
|
||||||
KillMode=process
|
|
||||||
TimeoutSec=180
|
TimeoutSec=180
|
||||||
Restart=always
|
Restart=always
|
||||||
RestartSec=60
|
RestartSec=60
|
||||||
StandardOutput=null
|
StandardOutput=null
|
||||||
StandardError=journal
|
StandardError=journal
|
||||||
|
|
||||||
|
# Hardening measures
|
||||||
|
PrivateTmp=true
|
||||||
|
ProtectSystem=full
|
||||||
|
NoNewPrivileges=true
|
||||||
|
PrivateDevices=true
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
|
@ -15,7 +15,7 @@ server {
|
||||||
location / {
|
location / {
|
||||||
proxy_pass http://127.0.0.1:5000;
|
proxy_pass http://127.0.0.1:5000;
|
||||||
|
|
||||||
include /etc/nginx/snippets/ssl-proxy-params.conf;
|
include /etc/nginx/snippets/proxy-params.conf;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,17 +4,23 @@ server {
|
||||||
listen 80 default_server;
|
listen 80 default_server;
|
||||||
listen [::]:80 default_server;
|
listen [::]:80 default_server;
|
||||||
|
|
||||||
|
root /var/www/public;
|
||||||
|
index index.html;
|
||||||
|
server_name _;
|
||||||
|
|
||||||
|
# proxy for API
|
||||||
|
location /api/ {
|
||||||
|
proxy_pass http://127.0.0.1:11111/;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-Host $host;
|
||||||
|
}
|
||||||
|
|
||||||
|
# directory for acme challenge
|
||||||
location ^~ /.well-known/acme-challenge/ {
|
location ^~ /.well-known/acme-challenge/ {
|
||||||
default_type "text/plain";
|
default_type "text/plain";
|
||||||
root /var/www/letsencrypt;
|
root /var/www/letsencrypt;
|
||||||
}
|
}
|
||||||
|
|
||||||
root /var/www/public;
|
|
||||||
|
|
||||||
index index.html;
|
|
||||||
|
|
||||||
server_name _;
|
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
# make sure to have https link to exact same host that was called
|
# make sure to have https link to exact same host that was called
|
||||||
sub_filter '<a href="https://HOST_SET_BY_NGINX/' '<a href="https://$host/';
|
sub_filter '<a href="https://HOST_SET_BY_NGINX/' '<a href="https://$host/';
|
||||||
|
|
11
home.admin/assets/nginx/snippets/proxy-params.conf
Normal file
11
home.admin/assets/nginx/snippets/proxy-params.conf
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
# proxy-params.conf
|
||||||
|
|
||||||
|
proxy_redirect off;
|
||||||
|
proxy_set_header Host $http_host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto http;
|
||||||
|
|
||||||
|
# remove if not needed
|
||||||
|
# proxy_set_header X-Forwarded-Host $server_name;
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 2.1 KiB |
Binary file not shown.
Before Width: | Height: | Size: 5.8 KiB |
|
@ -1 +0,0 @@
|
||||||
/var/cache/raspiblitz/info.html
|
|
|
@ -1,48 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
|
||||||
<title>RaspiBlitz Status</title>
|
|
||||||
<link rel="stylesheet" href="status.css">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<div class="grid-container" id="regular">
|
|
||||||
<div class="header">
|
|
||||||
<p>Info Dashboard (Updated: {{ datetime }})</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="logo">
|
|
||||||
<img src="RaspiBlitz_Logo_Icon_Negative_Cut.png" height="310" width="196" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="main">
|
|
||||||
<p>RaspiBlitz v{{ codeVersion }} {{ hostname }}</p>
|
|
||||||
<p>{{ network }} Fullnode + Lightning Network {{ torInfo }}</p>
|
|
||||||
<p> <p>
|
|
||||||
<p>CPU load {{ load }}, temp {{ tempC }}°C {{ tempF }}°F</p>
|
|
||||||
<p>Free Mem {{ ram }} HDDuse {{ hddUsedInfo }}</p>
|
|
||||||
<p>{{ uptime }}</p>
|
|
||||||
<p>ssh admin@{{ local_ip }} ▼{{ network_rx }} ▲{{ network_tx }}</p>
|
|
||||||
{% if runningRTL == '1' %}
|
|
||||||
<p>web admin --> <a href="http://{{ local_ip }}:3000">http://{{ local_ip }}:3000</a></p>
|
|
||||||
{% endif %}
|
|
||||||
<p> <p>
|
|
||||||
<p>{{ network }} {{ networkVersion }} {{ chain }}net Sync OK {{ sync_percentage }}</p> <!-- ToDo(frennkie) this doesn't cover all cases-->
|
|
||||||
<p>{{ public_addr_pre }} {{ public_addr }} {{ networkConnections }} peers</p>
|
|
||||||
<p> <p>
|
|
||||||
<p>LND {{ ln_version }} {{ ln_baseInfo }} <p>
|
|
||||||
{% if ln_version|length %}
|
|
||||||
<p>{{ ln_channelInfo }} {{ ln_peers }} peers <p>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="footer">
|
|
||||||
{% if ln_version|length %}
|
|
||||||
<p>{{ ln_external }}</p>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,48 +0,0 @@
|
||||||
#regular {
|
|
||||||
/* The size of the LCD on shopping list */
|
|
||||||
width: 920px;
|
|
||||||
height: 440px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.header {
|
|
||||||
grid-area: header;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.logo {
|
|
||||||
grid-area: logo;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.main {
|
|
||||||
grid-area: main;
|
|
||||||
}
|
|
||||||
|
|
||||||
.footer {
|
|
||||||
grid-area: footer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.grid-container {
|
|
||||||
display: grid;
|
|
||||||
grid-template-areas: 'header header header header' 'logo main main main' 'footer footer footer footer';
|
|
||||||
grid-gap: 1px;
|
|
||||||
background-color: #02192b;
|
|
||||||
padding: 1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.grid-container > div {
|
|
||||||
background-color: rgba(0, 0, 0, 0.8);
|
|
||||||
padding: 4px 8px;
|
|
||||||
font-size: 30px;
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
background-color: black;
|
|
||||||
font-family: monospace, monospace;
|
|
||||||
color: LightSteelBlue;
|
|
||||||
}
|
|
||||||
|
|
||||||
p {
|
|
||||||
font-size: 12px;
|
|
||||||
margin: 4px;
|
|
||||||
}
|
|
|
@ -17,9 +17,23 @@
|
||||||
<img src="img/RaspiBlitz_Logo_Main.png" class="rb_logo" alt="RaspiBlitz Logo"/>
|
<img src="img/RaspiBlitz_Logo_Main.png" class="rb_logo" alt="RaspiBlitz Logo"/>
|
||||||
|
|
||||||
<h2 class="text-center">
|
<h2 class="text-center">
|
||||||
Welcome
|
Welcome Node Operator
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
|
<p id="userinfo">Please Wait ...</p>
|
||||||
|
<script>
|
||||||
|
document.getElementById("userinfo").innerHTML=window.location.hostname;
|
||||||
|
if (window.location.hostname.endsWith(".onion")) {
|
||||||
|
document.getElementById("userinfo").innerHTML="onion domain address TODO: redirect on same address to subfolder of /ui"
|
||||||
|
}
|
||||||
|
else if ((window.location.hostname.endsWith(".local")) || (window.location.hostname.split(".").length>2)) {
|
||||||
|
document.getElementById("userinfo").innerHTML="local domain/IP address TODO: give info on download/use Tor and offer onion address for easy copy & paste"
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
document.getElementById("userinfo").innerHTML="unknown hostname: "+window.location.hostname
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
<h4>Use one the following link to access your RaspiBlitz</h4>
|
<h4>Use one the following link to access your RaspiBlitz</h4>
|
||||||
<p>
|
<p>
|
||||||
Please be aware about HTTPS Certificate Warning! Here is some useful information on that...
|
Please be aware about HTTPS Certificate Warning! Here is some useful information on that...
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||||
|
|
||||||
<title>RaspiBlitz Welcome</title>
|
<title>WebUI</title>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
|
@ -13,7 +13,7 @@ debugLevel=0
|
||||||
writeMemoryfile=1
|
writeMemoryfile=1
|
||||||
|
|
||||||
# if "logFile" points to an existing file => logging enabled
|
# if "logFile" points to an existing file => logging enabled
|
||||||
logFile=/mnt/hdd/temp/raspiblitzipinfo.log
|
logFile=/var/cache/raspiblitz/raspiblitzipinfo.log
|
||||||
|
|
||||||
|
|
||||||
# get the ISO timestamp for log output
|
# get the ISO timestamp for log output
|
||||||
|
@ -77,7 +77,7 @@ if [ ${debugLevel} -gt 10 ]; then for i in $( seq 0 4 ); do printf " %2d: %-10s
|
||||||
|
|
||||||
|
|
||||||
# get the values from a prior run, that file will not be changes as long as all the values stay the same
|
# get the values from a prior run, that file will not be changes as long as all the values stay the same
|
||||||
memoryFile=/mnt/hdd/temp/raspiblitzipinfo.out
|
memoryFile=/var/cache/raspiblitz/raspiblitzipinfo.out
|
||||||
source ${memoryFile} 2>/dev/null
|
source ${memoryFile} 2>/dev/null
|
||||||
|
|
||||||
# prepare to count the changes
|
# prepare to count the changes
|
||||||
|
|
222
home.admin/config.scripts/bitcoin.install.sh
Normal file
222
home.admin/config.scripts/bitcoin.install.sh
Normal file
|
@ -0,0 +1,222 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# command info
|
||||||
|
if [ $# -lt 2 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ];then
|
||||||
|
echo
|
||||||
|
echo "Install or remove parallel chains for Bitcoin Core"
|
||||||
|
echo "network.bitcoinchains.sh [on|off] [signet|testnet|mainnet]"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# CHAIN is signet | testnet | mainnet
|
||||||
|
CHAIN=$2
|
||||||
|
if [ "${CHAIN}" != signet ]&&[ "${CHAIN}" != testnet ]&&[ "${CHAIN}" != mainnet ];then
|
||||||
|
echo "# ${CHAIN} is not supported"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# prefix for parallel services
|
||||||
|
if [ ${CHAIN} = testnet ];then
|
||||||
|
prefix="t"
|
||||||
|
bitcoinprefix="test"
|
||||||
|
zmqprefix=21 # zmqpubrawblock=21332 zmqpubrawtx=21333
|
||||||
|
rpcprefix=1 # rpcport=18332
|
||||||
|
elif [ ${CHAIN} = signet ];then
|
||||||
|
prefix="s"
|
||||||
|
bitcoinprefix="signet"
|
||||||
|
zmqprefix=23
|
||||||
|
rpcprefix=3
|
||||||
|
elif [ ${CHAIN} = mainnet ];then
|
||||||
|
prefix=""
|
||||||
|
bitcoinprefix="main"
|
||||||
|
zmqprefix=28
|
||||||
|
rpcprefix=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
function removeParallelService() {
|
||||||
|
if [ -f "/etc/systemd/system/${prefix}bitcoind.service" ];then
|
||||||
|
if [ ${CHAIN} != mainnet ];then
|
||||||
|
/usr/local/bin/bitcoin-cli -${CHAIN} stop
|
||||||
|
else
|
||||||
|
/usr/local/bin/bitcoin-cli stop
|
||||||
|
fi
|
||||||
|
sudo systemctl stop ${prefix}bitcoind
|
||||||
|
sudo systemctl disable ${prefix}bitcoind
|
||||||
|
sudo rm /etc/systemd/system/${prefix}bitcoind.service 2>/dev/null
|
||||||
|
if [ ${bitcoinprefix} = signet ];then
|
||||||
|
# check for signet service set up by joininbox
|
||||||
|
if [ -f "/etc/systemd/system/signetd.service" ];then
|
||||||
|
sudo systemctl stop signetd
|
||||||
|
sudo systemctl disable signetd
|
||||||
|
echo "# The signetd.service is stopped and disabled"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
echo "# Bitcoin Core on ${CHAIN} service is stopped and disabled"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function installParallelService() {
|
||||||
|
echo "# Installing Bitcoin Core instance on ${CHAIN}"
|
||||||
|
# bitcoin.conf
|
||||||
|
if [ ! -f /home/bitcoin/.bitcoin/bitcoin.conf ];then
|
||||||
|
# add minimal config
|
||||||
|
randomRPCpass=$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c8)
|
||||||
|
echo "
|
||||||
|
# bitcoind configuration for ${CHAIN}
|
||||||
|
|
||||||
|
# Connection settings
|
||||||
|
rpcuser=raspiblitz
|
||||||
|
rpcpassword=$randomRPCpass
|
||||||
|
${bitcoinprefix}.zmqpubrawblock=tcp://127.0.0.1:${zmqprefix}332
|
||||||
|
${bitcoinprefix}.zmqpubrawtx=tcp://127.0.0.1:${zmqprefix}333
|
||||||
|
|
||||||
|
onlynet=onion
|
||||||
|
proxy=127.0.0.1:9050
|
||||||
|
|
||||||
|
datadir=/mnt/hdd/bitcoin
|
||||||
|
" | sudo -u bitcoin tee /home/bitcoin/.bitcoin/bitcoin.conf
|
||||||
|
else
|
||||||
|
echo "# /home/bitcoin/.bitcoin/bitcoin.conf is present"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# make sure rpcbind is correctly configured
|
||||||
|
sudo sed -i s/^rpcbind=/main.rpcbind=/g /mnt/hdd/${network}/${network}.conf
|
||||||
|
if [ $(grep -c "rpcallowip" < /mnt/hdd/${network}/${network}.conf) -gt 0 ];then
|
||||||
|
if [ $(grep -c "${bitcoinprefix}.rpcbind=" < /mnt/hdd/${network}/${network}.conf) -eq 0 ];then
|
||||||
|
echo "\
|
||||||
|
${bitcoinprefix}.rpcbind=127.0.0.1"|\
|
||||||
|
sudo tee -a /mnt/hdd/${network}/${network}.conf
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# correct rpcport entry
|
||||||
|
sudo sed -i s/^rpcport=/main.rpcport=/g /mnt/hdd/${network}/${network}.conf
|
||||||
|
if [ $(grep -c "${bitcoinprefix}.rpcport" < /mnt/hdd/${network}/${network}.conf) -eq 0 ];then
|
||||||
|
echo "\
|
||||||
|
${bitcoinprefix}.rpcport=${rpcprefix}8332"|\
|
||||||
|
sudo tee -a /mnt/hdd/${network}/${network}.conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
# correct zmq entry
|
||||||
|
sudo sed -i s/^zmqpubraw/main.zmqpubraw/g /mnt/hdd/${network}/${network}.conf
|
||||||
|
if [ $(grep -c "${bitcoinprefix}.zmqpubrawblock" < /mnt/hdd/${network}/${network}.conf) -eq 0 ];then
|
||||||
|
echo "\
|
||||||
|
${bitcoinprefix}.zmqpubrawblock=tcp://127.0.0.1:${zmqprefix}332
|
||||||
|
${bitcoinprefix}.zmqpubrawtx=tcp://127.0.0.1:${zmqprefix}333"|\
|
||||||
|
sudo tee -a /mnt/hdd/${network}/${network}.conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
# addnode
|
||||||
|
if [ ${bitcoinprefix} = signet ];then
|
||||||
|
if [ $(grep -c "${bitcoinprefix}.addnode" < /mnt/hdd/${network}/${network}.conf) -eq 0 ];then
|
||||||
|
echo "\
|
||||||
|
signet.addnode=s7fcvn5rblem7tiquhhr7acjdhu7wsawcph7ck44uxyd6sismumemcyd.onion:38333
|
||||||
|
signet.addnode=6megrst422lxzsqvshkqkg6z2zhunywhyrhy3ltezaeyfspfyjdzr3qd.onion:38333
|
||||||
|
signet.addnode=jahtu4veqnvjldtbyxjiibdrltqiiighauai7hmvknwxhptsb4xat4qd.onion:38333
|
||||||
|
signet.addnode=f4kwoin7kk5a5kqpni7yqe25z66ckqu6bv37sqeluon24yne5rodzkqd.onion:38333
|
||||||
|
signet.addnode=nsgyo7begau4yecc46ljfecaykyzszcseapxmtu6adrfagfrrzrlngyd.onion:38333"|\
|
||||||
|
sudo tee -a /mnt/hdd/${network}/${network}.conf
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
removeParallelService
|
||||||
|
if [ ${CHAIN} = mainnet ];then
|
||||||
|
sudo cp /home/admin/assets/${network}d.service /etc/systemd/system/${network}d.service
|
||||||
|
else
|
||||||
|
# /etc/systemd/system/${prefix}bitcoind.service
|
||||||
|
echo "
|
||||||
|
[Unit]
|
||||||
|
Description=Bitcoin daemon on ${CHAIN}
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
User=bitcoin
|
||||||
|
Group=bitcoin
|
||||||
|
Type=forking
|
||||||
|
PIDFile=/mnt/hdd/bitcoin/${prefix}bitcoind.pid
|
||||||
|
ExecStart=/usr/local/bin/bitcoind -${CHAIN} -daemon -pid=/mnt/hdd/bitcoin/${prefix}bitcoind.pid -debuglogfile=/mnt/hdd/bitcoin/${prefix}debug.log
|
||||||
|
Restart=always
|
||||||
|
TimeoutSec=120
|
||||||
|
RestartSec=30
|
||||||
|
StandardOutput=null
|
||||||
|
StandardError=journal
|
||||||
|
|
||||||
|
# Hardening measures
|
||||||
|
PrivateTmp=true
|
||||||
|
ProtectSystem=full
|
||||||
|
NoNewPrivileges=true
|
||||||
|
PrivateDevices=true
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
" | sudo tee /etc/systemd/system/${prefix}bitcoind.service
|
||||||
|
fi
|
||||||
|
sudo systemctl daemon-reload
|
||||||
|
sudo systemctl enable ${prefix}bitcoind
|
||||||
|
echo "# OK - the bitcoin daemon on ${CHAIN} service is now enabled"
|
||||||
|
|
||||||
|
# add aliases
|
||||||
|
if [ ${CHAIN} != mainnet ];then
|
||||||
|
if [ $(alias | grep -c ${prefix}bitcoin) -eq 0 ];then
|
||||||
|
bash -c "echo 'alias ${prefix}bitcoin-cli=\"/usr/local/bin/bitcoin-cli\
|
||||||
|
-rpcport=${rpcprefix}8332\"' \
|
||||||
|
>> /home/admin/_aliases"
|
||||||
|
bash -c "echo 'alias ${prefix}bitcoind=\"/usr/local/bin/bitcoind\
|
||||||
|
-${CHAIN}\"' \
|
||||||
|
>> /home/admin/_aliases"
|
||||||
|
fi
|
||||||
|
sudo chown admin:admin /home/admin/_aliases
|
||||||
|
fi
|
||||||
|
|
||||||
|
source /home/admin/raspiblitz.info
|
||||||
|
if [ "${state}" == "ready" ]; then
|
||||||
|
echo "# OK - the ${prefix}bitcoind.service is enabled, system is ready so starting service"
|
||||||
|
sudo systemctl start ${prefix}bitcoind
|
||||||
|
else
|
||||||
|
echo "# OK - the ${prefix}bitcoindservice is enabled, to start manually use:"
|
||||||
|
echo "sudo systemctl start ${prefix}bitcoind"
|
||||||
|
fi
|
||||||
|
|
||||||
|
isInstalled=$(systemctl status ${prefix}bitcoind | grep -c active)
|
||||||
|
if [ $isInstalled -gt 0 ];then
|
||||||
|
echo "# Installed $(bitcoind --version | grep version)"
|
||||||
|
echo
|
||||||
|
echo "# Monitor the ${prefix}bitcoind with:"
|
||||||
|
echo "# sudo tail -f /mnt/hdd/bitcoin/${prefix}debug.log"
|
||||||
|
echo
|
||||||
|
else
|
||||||
|
echo "# Installation failed"
|
||||||
|
echo "# See:"
|
||||||
|
echo "# sudo journalctl -fu ${prefix}bitcoind"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
source /mnt/hdd/raspiblitz.conf
|
||||||
|
|
||||||
|
# add default value to raspi config if needed
|
||||||
|
if ! grep -Eq "^${CHAIN}=" /mnt/hdd/raspiblitz.conf; then
|
||||||
|
NEWENTRY="${CHAIN}=off"
|
||||||
|
sudo /bin/sh -c "echo '$NEWENTRY' >> /mnt/hdd/raspiblitz.conf"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# switch on
|
||||||
|
if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
||||||
|
installParallelService
|
||||||
|
# setting value in raspi blitz config
|
||||||
|
sudo sed -i "s/^${CHAIN}=.*/${CHAIN}=on/g" /mnt/hdd/raspiblitz.conf
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# switch off
|
||||||
|
if [ "$1" = "0" ] || [ "$1" = "off" ]; then
|
||||||
|
echo "# Uninstall Bitcoin Core instance on ${CHAIN}"
|
||||||
|
removeParallelService
|
||||||
|
# setting value in raspi blitz config
|
||||||
|
sudo sed -i "s/^${CHAIN}=.*/${CHAIN}=off/g" /mnt/hdd/raspiblitz.conf
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "# FAIL - Unknown Parameter $1"
|
||||||
|
echo "# may need reboot to run"
|
||||||
|
exit 1
|
|
@ -19,15 +19,16 @@ source /home/admin/raspiblitz.info
|
||||||
mode="$1"
|
mode="$1"
|
||||||
|
|
||||||
# RECOMMENDED UPDATE BY RASPIBLITZ TEAM
|
# RECOMMENDED UPDATE BY RASPIBLITZ TEAM
|
||||||
# comment will be shown as "BEWARE Info" when option is chosen (can be multiple lines)
|
# comment will be shown as "BEWARE Info" when option is choosen (can be multiple lines)
|
||||||
bitcoinVersion="0.21.0"
|
bitcoinVersion="" # example: 22.0 .. keep empty if no newer version as sd card build is available
|
||||||
|
|
||||||
# needed to check code signing
|
# needed to check code signing
|
||||||
laanwjPGP="01EA5486DE18A882D4C2684590C8019E36C2E964"
|
# https://github.com/laanwj
|
||||||
|
laanwjPGP="71A3 B167 3540 5025 D447 E8F2 7481 0B01 2346 C9A6"
|
||||||
|
|
||||||
# GATHER DATA
|
# GATHER DATA
|
||||||
# setting download directory
|
# setting download directory to the current user
|
||||||
downloadDir="/home/admin/download"
|
downloadDir="/home/$(whoami)/download/bitcoin.update"
|
||||||
|
|
||||||
# detect CPU architecture & fitting download link
|
# detect CPU architecture & fitting download link
|
||||||
if [ $(uname -m | grep -c 'arm') -eq 1 ] ; then
|
if [ $(uname -m | grep -c 'arm') -eq 1 ] ; then
|
||||||
|
@ -105,14 +106,15 @@ elif [ "${mode}" = "custom" ]; then
|
||||||
echo "# Update Bitcoin Core to a chosen version."
|
echo "# Update Bitcoin Core to a chosen version."
|
||||||
echo
|
echo
|
||||||
echo "# Input the version you would like to install and press ENTER."
|
echo "# Input the version you would like to install and press ENTER."
|
||||||
echo "# Examples:"
|
echo "# Examples (versions below 22 are not supported):"
|
||||||
echo "0.21.1rc1"
|
echo "22.0rc3"
|
||||||
echo "0.21.0"
|
echo "22.0"
|
||||||
echo
|
echo
|
||||||
read bitcoinVersion
|
read bitcoinVersion
|
||||||
if [ $(echo ${bitcoinVersion} | grep -c "rc") -gt 0 ];then
|
if [ $(echo ${bitcoinVersion} | grep -c "rc") -gt 0 ];then
|
||||||
cutVersion=$(echo ${bitcoinVersion} | awk -F"r" '{print $1}')
|
cutVersion=$(echo ${bitcoinVersion} | awk -F"r" '{print $1}')
|
||||||
rcVersion=$(echo ${bitcoinVersion} | awk -F"r" '{print $2}')
|
rcVersion=$(echo ${bitcoinVersion} | awk -F"r" '{print $2}')
|
||||||
|
# https://bitcoincore.org/bin/bitcoin-core-22.0/test.rc3/
|
||||||
pathVersion=${cutVersion}/test.r${rcVersion}
|
pathVersion=${cutVersion}/test.r${rcVersion}
|
||||||
else
|
else
|
||||||
pathVersion=${bitcoinVersion}
|
pathVersion=${bitcoinVersion}
|
||||||
|
@ -145,34 +147,42 @@ if [ "${mode}" = "tested" ]||[ "${mode}" = "reckless" ]||[ "${mode}" = "custom"
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "# clean & change into download directory"
|
echo "# clean & change into download directory"
|
||||||
sudo rm -r ${downloadDir}/*
|
sudo rm -rf "${downloadDir}"
|
||||||
|
mkdir -p "${downloadDir}"
|
||||||
cd "${downloadDir}" || exit 1
|
cd "${downloadDir}" || exit 1
|
||||||
|
|
||||||
echo
|
# download signed binary sha256 hash sum file
|
||||||
# download, check and import signer key
|
wget https://bitcoincore.org/bin/bitcoin-core-${pathVersion}/SHA256SUMS
|
||||||
sudo -u admin wget https://bitcoin.org/laanwj-releases.asc
|
# download signed binary sha256 hash sum file and check
|
||||||
if [ ! -f "./laanwj-releases.asc" ]
|
wget https://bitcoincore.org/bin/bitcoin-core-${pathVersion}/SHA256SUMS.asc
|
||||||
|
|
||||||
|
echo "# Paste the PGP pubkey fingerprint of a signer."
|
||||||
|
echo "# Example for W. J. van der Laan (https://github.com/laanwj):"
|
||||||
|
echo "71A3 B167 3540 5025 D447 E8F2 7481 0B01 2346 C9A6"
|
||||||
|
echo ""
|
||||||
|
read customKey
|
||||||
|
|
||||||
|
if [ ${#customKey} -eq 0 ];then
|
||||||
|
customKey=$laanwjPGP
|
||||||
|
fi
|
||||||
|
|
||||||
|
# receive signer key
|
||||||
|
if ! gpg --recv-key "$customKey"
|
||||||
then
|
then
|
||||||
echo "# !!! FAIL !!! Download laanwj-releases.asc not success."
|
echo
|
||||||
|
echo "!!! FAIL !!! Could not download the PGP pubkey"
|
||||||
|
echo
|
||||||
|
echo "See the signers of this release:"
|
||||||
|
echo
|
||||||
|
gpg --verify SHA256SUMS.asc
|
||||||
|
echo
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
gpg --import-options show-only --import ./laanwj-releases.asc
|
|
||||||
fingerprint=$(gpg ./laanwj-releases.asc 2>/dev/null | grep -c "${laanwjPGP}")
|
|
||||||
if [ ${fingerprint} -eq 0 ]; then
|
|
||||||
echo
|
|
||||||
echo "# !!! BUILD WARNING --> Bitcoin PGP author not as expected"
|
|
||||||
echo "# Should contain laanwjPGP: ${laanwjPGP}"
|
|
||||||
echo "# PRESS ENTER to TAKE THE RISK if you think all is OK"
|
|
||||||
read key
|
|
||||||
fi
|
|
||||||
gpg --import ./laanwj-releases.asc
|
|
||||||
|
|
||||||
# download signed binary sha256 hash sum file and check
|
|
||||||
sudo -u admin wget https://bitcoincore.org/bin/bitcoin-core-${pathVersion}/SHA256SUMS.asc
|
|
||||||
verifyResult=$(gpg --verify SHA256SUMS.asc 2>&1)
|
verifyResult=$(gpg --verify SHA256SUMS.asc 2>&1)
|
||||||
goodSignature=$(echo ${verifyResult} | grep 'Good signature' -c)
|
goodSignature=$(echo ${verifyResult} | grep 'Good signature' -c)
|
||||||
echo "goodSignature(${goodSignature})"
|
echo "goodSignature(${goodSignature})"
|
||||||
correctKey=$(echo ${verifyResult} | grep "using RSA key ${laanwjPGP: -16}" -c)
|
correctKey=$(echo ${verifyResult} | grep "${customKey}" -c)
|
||||||
echo "correctKey(${correctKey})"
|
echo "correctKey(${correctKey})"
|
||||||
if [ ${correctKey} -lt 1 ] || [ ${goodSignature} -lt 1 ]; then
|
if [ ${correctKey} -lt 1 ] || [ ${goodSignature} -lt 1 ]; then
|
||||||
echo
|
echo
|
||||||
|
@ -186,7 +196,7 @@ if [ "${mode}" = "tested" ]||[ "${mode}" = "reckless" ]||[ "${mode}" = "custom"
|
||||||
|
|
||||||
echo "# Downloading Bitcoin Core v${bitcoinVersion} for ${bitcoinOSversion} ..."
|
echo "# Downloading Bitcoin Core v${bitcoinVersion} for ${bitcoinOSversion} ..."
|
||||||
binaryName="bitcoin-${bitcoinVersion}-${bitcoinOSversion}.tar.gz"
|
binaryName="bitcoin-${bitcoinVersion}-${bitcoinOSversion}.tar.gz"
|
||||||
sudo -u admin wget https://bitcoincore.org/bin/bitcoin-core-${pathVersion}/${binaryName}
|
wget https://bitcoincore.org/bin/bitcoin-core-${pathVersion}/${binaryName}
|
||||||
if [ ! -f "./${binaryName}" ]
|
if [ ! -f "./${binaryName}" ]
|
||||||
then
|
then
|
||||||
echo "# !!! FAIL !!! Downloading BITCOIN BINARY did not succeed."
|
echo "# !!! FAIL !!! Downloading BITCOIN BINARY did not succeed."
|
||||||
|
@ -194,11 +204,11 @@ if [ "${mode}" = "tested" ]||[ "${mode}" = "reckless" ]||[ "${mode}" = "custom"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "# Checking binary checksum ..."
|
echo "# Checking binary checksum ..."
|
||||||
checksumTest=$(sha256sum -c --ignore-missing SHA256SUMS.asc ${binaryName} 2>/dev/null \
|
checksumTest=$(sha256sum -c --ignore-missing SHA256SUMS ${binaryName} 2>/dev/null \
|
||||||
| grep -c "${binaryName}: OK")
|
| grep -c "${binaryName}: OK")
|
||||||
if [ "${checksumTest}" -eq 0 ]; then
|
if [ "${checksumTest}" -eq 0 ]; then
|
||||||
# get the sha256 value for the corresponding platform from signed hash sum file
|
# get the sha256 value for the corresponding platform from signed hash sum file
|
||||||
bitcoinSHA256=$(grep -i "$bitcoinOSversion" SHA256SUMS.asc | cut -d " " -f1)
|
bitcoinSHA256=$(grep -i "${binaryName}}" SHA256SUMS | cut -d " " -f1)
|
||||||
echo "!!! FAIL !!! Downloaded BITCOIN BINARY CHECKSUM:"
|
echo "!!! FAIL !!! Downloaded BITCOIN BINARY CHECKSUM:"
|
||||||
echo "$(sha256sum ${binaryName})"
|
echo "$(sha256sum ${binaryName})"
|
||||||
echo "NOT matching SHA256 checksum:"
|
echo "NOT matching SHA256 checksum:"
|
||||||
|
@ -206,10 +216,9 @@ if [ "${mode}" = "tested" ]||[ "${mode}" = "reckless" ]||[ "${mode}" = "custom"
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
echo
|
echo
|
||||||
echo "# OK --> VERIFIED BITCOIN CHECKSUM IS CORRECT"
|
echo "# OK --> VERIFIED BITCOIN CORE BINARY CHECKSUM IS CORRECT"
|
||||||
echo
|
echo
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${mode}" = "tested" ]||[ "${mode}" = "custom" ]; then
|
if [ "${mode}" = "tested" ]||[ "${mode}" = "custom" ]; then
|
||||||
|
@ -227,10 +236,10 @@ if [ "${mode}" = "tested" ]||[ "${mode}" = "reckless" ]||[ "${mode}" = "custom"
|
||||||
sudo systemctl stop bitcoind
|
sudo systemctl stop bitcoind
|
||||||
echo
|
echo
|
||||||
echo "# Installing Bitcoin Core v${bitcoinVersion}"
|
echo "# Installing Bitcoin Core v${bitcoinVersion}"
|
||||||
sudo -u admin tar -xvf ${binaryName}
|
tar -xvf ${binaryName}
|
||||||
sudo install -m 0755 -o root -g root -t /usr/local/bin/ bitcoin-${bitcoinVersion}/bin/*
|
sudo install -m 0755 -o root -g root -t /usr/local/bin/ bitcoin-${bitcoinVersion}/bin/*
|
||||||
sleep 3
|
sleep 3
|
||||||
installed=$(sudo -u admin bitcoind --version | grep "${bitcoinVersion}" -c)
|
installed=$(bitcoind --version | grep "${bitcoinVersion}" -c)
|
||||||
if [ ${installed} -lt 1 ]; then
|
if [ ${installed} -lt 1 ]; then
|
||||||
echo
|
echo
|
||||||
echo "# !!! BUILD FAILED --> Was not able to install bitcoind version(${bitcoinVersion})"
|
echo "# !!! BUILD FAILED --> Was not able to install bitcoind version(${bitcoinVersion})"
|
||||||
|
|
95
home.admin/config.scripts/blitz.bootdrive.sh
Normal file
95
home.admin/config.scripts/blitz.bootdrive.sh
Normal file
|
@ -0,0 +1,95 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# basic background on this feature
|
||||||
|
# see: https://github.com/rootzoll/raspiblitz/issues/936
|
||||||
|
|
||||||
|
# get basic system information
|
||||||
|
# these are the same set of infos the WebGUI dialog/controler has
|
||||||
|
source /home/admin/raspiblitz.info </dev/null
|
||||||
|
|
||||||
|
# command info
|
||||||
|
if [ "$1" == "" ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
||||||
|
echo "# tools for the boot drive / sd card"
|
||||||
|
echo "# blitz.sdcard.sh status"
|
||||||
|
echo "# blitz.sdcard.sh expand"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# check if sudo
|
||||||
|
if [ "$EUID" -ne 0 ]
|
||||||
|
then echo "Please run as root (with sudo)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 1st PARAMETER: action
|
||||||
|
action=$1
|
||||||
|
|
||||||
|
#########################
|
||||||
|
# STATUS
|
||||||
|
|
||||||
|
# gather data on sd card
|
||||||
|
minimumSizeByte=8192000000
|
||||||
|
rootPartition=$(sudo mount | grep " / " | cut -d " " -f 1 | cut -d "/" -f 3)
|
||||||
|
rootPartitionBytes=$(lsblk -b -o NAME,SIZE | grep "${rootPartition}" | tr -s ' ' | cut -d " " -f 2)
|
||||||
|
|
||||||
|
# make conculsions
|
||||||
|
needsExpansion=0
|
||||||
|
tooSmall=0
|
||||||
|
if [ $rootPartitionBytes -lt $minimumSizeByte ]; then
|
||||||
|
needsExpansion=1
|
||||||
|
if [ "${fsexpanded}" == "1" ]; then
|
||||||
|
tooSmall=1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${action}" == "status" ]; then
|
||||||
|
|
||||||
|
echo "rootPartition='${rootPartition}'"
|
||||||
|
echo "rootPartitionBytes=${rootPartitionBytes}"
|
||||||
|
echo "needsExpansion=${needsExpansion}"
|
||||||
|
echo "fsexpanded=${fsexpanded}" # from raspiblitz.info
|
||||||
|
echo "tooSmall=${tooSmall}"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
###########################
|
||||||
|
# EXPAND FILE SYSTEM OF SD
|
||||||
|
|
||||||
|
if [ "${action}" == "fsexpand" ]; then
|
||||||
|
|
||||||
|
echo "# blitz.bootdrive.sh fsexpand"
|
||||||
|
echo "# starting expand of file system of sd card"
|
||||||
|
sudo sed -i "s/^fsexpanded=.*/fsexpanded=1/g" /home/admin/raspiblitz.info
|
||||||
|
|
||||||
|
if [ "${baseimage}" = "raspbian" ] || [ "${baseimage}" = "raspios_arm64" ]; then
|
||||||
|
resizeRaspbian="/usr/bin/raspi-config"
|
||||||
|
if [ -x ${resizeRaspbian} ]; then
|
||||||
|
echo "# RUNNING EXPAND RASPBERRYPI: ${resizeRaspbian}"
|
||||||
|
sudo $resizeRaspbian --expand-rootfs 1>&2
|
||||||
|
echo "# DONE - please reboot"
|
||||||
|
else
|
||||||
|
echo "# FAIL to execute on ${baseimage}: ${resizeRaspbian}"
|
||||||
|
echo "err='expand failed'"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
elif [ "${baseimage}" = "armbian" ]; then
|
||||||
|
resizeArmbian="/usr/lib/armbian/armbian-resize-filesystem"
|
||||||
|
if [ -x ${resizeArmbian} ]; then
|
||||||
|
echo "# RUNNING EXPAND ARMBIAN: ${resizeArmbian}"
|
||||||
|
sudo $resizeArmbian start 1>&2
|
||||||
|
echo "# DONE - please reboot"
|
||||||
|
else
|
||||||
|
echo "# FAIL to execute on ${baseimage}: ${resizeArmbian}"
|
||||||
|
echo "err='expand failed'"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "#FAIL no implementation for: ${baseimage}"
|
||||||
|
echo "err='missing implementation'"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "err='unknown parameter'"
|
||||||
|
exit 1
|
|
@ -1,57 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
|
||||||
echo "# managing the copy of blockchain data over LAN"
|
|
||||||
echo "# blitz.copyblockchain.sh [status]"
|
|
||||||
echo "error='missing parameters'"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# load basic system settings
|
|
||||||
source /home/admin/raspiblitz.info 2>/dev/null
|
|
||||||
source /mnt/hdd/raspiblitz.conf 2>/dev/null
|
|
||||||
|
|
||||||
# check that blockchain is set & supported
|
|
||||||
if [ "${network}" != "bitcoin" ] && [ "${network}" != "litecoin" ]; then
|
|
||||||
echo "blockchain='{$network}'"
|
|
||||||
echo "error='blockchain type missing or not supported'"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# check that HDD is available
|
|
||||||
isMounted=$(sudo df | grep -c /mnt/hdd)
|
|
||||||
if [ "${isMounted}" != "1" ]; then
|
|
||||||
echo "error='no datadrive is mounted'"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
###################
|
|
||||||
# STATUS
|
|
||||||
###################
|
|
||||||
|
|
||||||
# check if copy is in progress
|
|
||||||
copyBeginTime=$(cat /mnt/hdd/${network}/copy_begin.time 2>/dev/null | tr -cd '[[:digit:]]')
|
|
||||||
if [ ${#copyBeginTime} -eq 0 ]; then
|
|
||||||
copyBeginTime=0
|
|
||||||
fi
|
|
||||||
copyEndTime=$(cat /mnt/hdd/${network}/copy_end.time 2>/dev/null | tr -cd '[[:digit:]]')
|
|
||||||
if [ ${#copyEndTime} -eq 0 ]; then
|
|
||||||
copyEndTime=0
|
|
||||||
fi
|
|
||||||
copyInProgress=0
|
|
||||||
if [ ${copyBeginTime} -gt ${copyEndTime} ]; then
|
|
||||||
copyInProgress=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# output status data & exit
|
|
||||||
if [ "$1" = "status" ]; then
|
|
||||||
echo "# blitz.copyblockchain.sh"
|
|
||||||
echo "copyInProgress=${copyInProgress}"
|
|
||||||
echo "copyBeginTime=${copyBeginTime}"
|
|
||||||
echo "copyEndTime=${copyEndTime}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# if no other
|
|
||||||
echo "error='unknown command'"
|
|
||||||
exit 1
|
|
399
home.admin/config.scripts/blitz.copychain.sh
Normal file
399
home.admin/config.scripts/blitz.copychain.sh
Normal file
|
@ -0,0 +1,399 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
||||||
|
echo "# managing the copy of blockchain data over LAN"
|
||||||
|
echo "# blitz.copychain.sh [status|target|source]"
|
||||||
|
echo "error='missing parameters'"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# load basic system settings
|
||||||
|
source /home/admin/raspiblitz.info 2>/dev/null
|
||||||
|
source /mnt/hdd/raspiblitz.conf 2>/dev/null
|
||||||
|
|
||||||
|
# check that blockchain is set & supported
|
||||||
|
if [ "${network}" != "bitcoin" ] && [ "${network}" != "litecoin" ]; then
|
||||||
|
echo "blockchain='{$network}'"
|
||||||
|
echo "error='blockchain type missing or not supported'"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# check that HDD is available
|
||||||
|
isMounted=$(sudo df | grep -c /mnt/hdd)
|
||||||
|
if [ "${isMounted}" != "1" ]; then
|
||||||
|
echo "error='no datadrive is mounted'"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
###################
|
||||||
|
# STATUS
|
||||||
|
###################
|
||||||
|
|
||||||
|
# check if copy is in progress
|
||||||
|
copyBeginTime=$(cat /mnt/hdd/${network}/copy_begin.time 2>/dev/null | tr -cd '[[:digit:]]')
|
||||||
|
if [ ${#copyBeginTime} -eq 0 ]; then
|
||||||
|
copyBeginTime=0
|
||||||
|
fi
|
||||||
|
copyEndTime=$(cat /mnt/hdd/${network}/copy_end.time 2>/dev/null | tr -cd '[[:digit:]]')
|
||||||
|
if [ ${#copyEndTime} -eq 0 ]; then
|
||||||
|
copyEndTime=0
|
||||||
|
fi
|
||||||
|
copyInProgress=0
|
||||||
|
if [ ${copyBeginTime} -gt ${copyEndTime} ]; then
|
||||||
|
copyInProgress=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# output status data & exit
|
||||||
|
if [ "$1" = "status" ]; then
|
||||||
|
echo "# blitz.copychain.sh"
|
||||||
|
echo "copyInProgress=${copyInProgress}"
|
||||||
|
echo "copyBeginTime=${copyBeginTime}"
|
||||||
|
echo "copyEndTime=${copyEndTime}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
###################
|
||||||
|
# COPYTARGET
|
||||||
|
###################
|
||||||
|
|
||||||
|
# output status data & exit
|
||||||
|
if [ "$1" = "target" ]; then
|
||||||
|
|
||||||
|
# Basic Options
|
||||||
|
OPTIONS=(WINDOWS "Windows" \
|
||||||
|
MACOS "Apple MacOSX" \
|
||||||
|
LINUX "Linux" \
|
||||||
|
BLITZ "RaspiBlitz"
|
||||||
|
)
|
||||||
|
CHOICE=$(dialog --clear --title " Copy Blockchain from another laptop/node over LAN " --menu "\nWhich system is running on the other laptop/node you want to copy the blockchain from?\n " 14 60 9 "${OPTIONS[@]}" 2>&1 >/dev/tty)
|
||||||
|
|
||||||
|
clear
|
||||||
|
case $CHOICE in
|
||||||
|
MACOS) echo "Steve";;
|
||||||
|
LINUX) echo "Linus";;
|
||||||
|
WINDOWS) echo "Bill";;
|
||||||
|
BLITZ) echo "Satoshi";;
|
||||||
|
*) exit 1;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# setting copy state
|
||||||
|
sed -i "s/^state=.*/state=copytarget/g" /home/admin/raspiblitz.info
|
||||||
|
sed -i "s/^message=.*/message='Receiving Blockchain over LAN'/g" /home/admin/raspiblitz.info
|
||||||
|
|
||||||
|
echo "stopping services ..."
|
||||||
|
sudo systemctl stop bitcoind 2>/dev/null
|
||||||
|
sudo systemctl disable bitcoind 2>/dev/null
|
||||||
|
|
||||||
|
# check if old blockchain data exists
|
||||||
|
hasOldBlockchainData=0
|
||||||
|
sizeBlocks=$(sudo du -s /mnt/hdd/bitcoin/blocks 2>/dev/null | tr -dc '[0-9]')
|
||||||
|
if [ ${#sizeBlocks} -gt 0 ] && [ ${sizeBlocks} -gt 0 ]; then
|
||||||
|
hasOldBlockchainData=1
|
||||||
|
fi
|
||||||
|
sizeChainstate=$(sudo du -s /mnt/hdd/bitcoin/chainstate 2>/dev/null | tr -dc '[0-9]')
|
||||||
|
if [ ${#sizeChainstate} -gt 0 ] && [ ${sizeChainstate} -gt 0 ]; then
|
||||||
|
hasOldBlockchainData=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
dialog --title " Old Blockchain Data Found " --yesno "\nDo you want to delete the existing blockchain data now?" 7 60
|
||||||
|
response=$?
|
||||||
|
clear
|
||||||
|
echo "response(${response})"
|
||||||
|
if [ "${response}" = "1" ]; then
|
||||||
|
echo "OK - keep old blockchain - just try to repair by copying over it"
|
||||||
|
sleep 3
|
||||||
|
else
|
||||||
|
echo "OK - delete old blockchain"
|
||||||
|
sudo rm -rfv /mnt/hdd/bitcoin/blocks/* 2>/dev/null
|
||||||
|
sudo rm -rfv /mnt/hdd/bitcoin/chainstate/* 2>/dev/null
|
||||||
|
sleep 3
|
||||||
|
fi
|
||||||
|
|
||||||
|
# make sure /mnt/hdd/bitcoin exists
|
||||||
|
sudo mkdir /mnt/hdd/bitcoin 2>/dev/null
|
||||||
|
|
||||||
|
# allow all users write to it
|
||||||
|
sudo chmod 777 /mnt/hdd/bitcoin
|
||||||
|
|
||||||
|
echo
|
||||||
|
clear
|
||||||
|
if [ "${CHOICE}" = "WINDOWS" ]; then
|
||||||
|
echo "****************************************************************************"
|
||||||
|
echo "Instructions to COPY/TRANSFER SYNCED BLOCKCHAIN from a WINDOWS computer"
|
||||||
|
echo "****************************************************************************"
|
||||||
|
echo ""
|
||||||
|
echo "ON YOUR WINDOWS COMPUTER download and validate the blockchain with the Bitcoin"
|
||||||
|
echo "Core wallet software (>=0.17.1) from: bitcoincore.org/en/download"
|
||||||
|
echo "If the Bitcoin Blockchain is synced up - make sure that your Windows computer &"
|
||||||
|
echo "your RaspiBlitz are in the same local network."
|
||||||
|
echo ""
|
||||||
|
echo "Open a fresh terminal on your Windows computer & change into the directory that"
|
||||||
|
echo "contains the blockchain data - should see folders named 'blocks' & 'chainstate'"
|
||||||
|
echo "there. Normally on Windows thats: C:\Users\YourUserName\Appdata\Roaming\Bitcoin"
|
||||||
|
echo "Make sure that the Bitcoin Core Wallet is not running in the background anymore."
|
||||||
|
echo ""
|
||||||
|
echo "COPY, PASTE & EXECUTE the following command on your Windows computer terminal:"
|
||||||
|
echo "scp -r ./chainstate ./blocks bitcoin@${localip}:/mnt/hdd/bitcoin"
|
||||||
|
echo ""
|
||||||
|
echo "If asked for a password use PASSWORD A (or 'raspiblitz')."
|
||||||
|
fi
|
||||||
|
if [ "${CHOICE}" = "MACOS" ]; then
|
||||||
|
echo "****************************************************************************"
|
||||||
|
echo "Instructions to COPY/TRANSFER SYNCED BLOCKCHAIN from a MacOSX computer"
|
||||||
|
echo "****************************************************************************"
|
||||||
|
echo ""
|
||||||
|
echo "ON YOUR MacOSX COMPUTER download and validate the blockchain with the Bitcoin"
|
||||||
|
echo "Core wallet software (>=0.17.1) from: bitcoincore.org/en/download"
|
||||||
|
echo "If the Bitcoin Blockchain is synced up - make sure that your MacOSX computer &"
|
||||||
|
echo "your RaspiBlitz are in the same local network."
|
||||||
|
echo ""
|
||||||
|
echo "Open a fresh terminal on your MacOSX computer and change into the directory that"
|
||||||
|
echo "contains the blockchain data - should see folders named 'blocks' & 'chainstate'"
|
||||||
|
echo "there. Normally on MacOSX thats: cd ~/Library/Application Support/Bitcoin/"
|
||||||
|
echo "Make sure that the Bitcoin Core Wallet is not running in the background anymore."
|
||||||
|
echo ""
|
||||||
|
echo "COPY, PASTE & EXECUTE the following command on your MacOSX terminal:"
|
||||||
|
echo "sudo rsync -avhW --progress ./chainstate ./blocks bitcoin@${localip}:/mnt/hdd/bitcoin"
|
||||||
|
echo ""
|
||||||
|
echo "You will be asked for passwords. First can be the user password of your MacOSX"
|
||||||
|
echo "computer and the last is the PASSWORD A (or 'raspiblitz') of this RaspiBlitz."
|
||||||
|
fi
|
||||||
|
if [ "${CHOICE}" = "LINUX" ]; then
|
||||||
|
echo "****************************************************************************"
|
||||||
|
echo "Instructions to COPY/TRANSFER SYNCED BLOCKCHAIN from a LINUX computer"
|
||||||
|
echo "****************************************************************************"
|
||||||
|
echo ""
|
||||||
|
echo "ON YOUR LINUX COMPUTER download and validate the blockchain with the Bitcoin"
|
||||||
|
echo "Core wallet software (>=0.17.1) from: bitcoincore.org/en/download"
|
||||||
|
echo "If the Bitcoin Blockchain is synced up - make sure that your Linux computer &"
|
||||||
|
echo "your RaspiBlitz are in the same local network."
|
||||||
|
echo ""
|
||||||
|
echo "Open a fresh terminal on your Linux computer and change into the directory that"
|
||||||
|
echo "contains the blockchain data - should see folders named 'blocks' & 'chainstate'"
|
||||||
|
echo "there. Normally on Linux thats: cd ~/.bitcoin/"
|
||||||
|
echo "Make sure that the Bitcoin Core Wallet is not running in the background anymore."
|
||||||
|
echo ""
|
||||||
|
echo "COPY, PASTE & EXECUTE the following command on your Linux terminal:"
|
||||||
|
echo "sudo rsync -avhW --progress ./chainstate ./blocks bitcoin@${localip}:/mnt/hdd/bitcoin"
|
||||||
|
echo ""
|
||||||
|
echo "You will be asked for passwords. First can be the user password of your Linux"
|
||||||
|
echo "computer and the last is the PASSWORD A (or 'raspiblitz') of this RaspiBlitz."
|
||||||
|
fi
|
||||||
|
if [ "${CHOICE}" = "BLITZ" ]; then
|
||||||
|
echo "****************************************************************************"
|
||||||
|
echo "Instructions to COPY/TRANSFER SYNCED BLOCKCHAIN from another RaspiBlitz"
|
||||||
|
echo "****************************************************************************"
|
||||||
|
echo ""
|
||||||
|
echo "The other RaspiBlitz needs a minimum version of 1.6 (if lower, update first)."
|
||||||
|
echo "Make sure that the other RaspiBlitz is on the same local network."
|
||||||
|
echo ""
|
||||||
|
echo "Open a fresh terminal and login per SSH into that other RaspiBlitz."
|
||||||
|
echo "Once in the main menu go: MAINMENU > REPAIR > COPY-SOURCE"
|
||||||
|
echo "Follow the given instructions ..."
|
||||||
|
echo ""
|
||||||
|
echo "The LOCAL IP of this target RaspiBlitz is: ${localip}"
|
||||||
|
fi
|
||||||
|
echo ""
|
||||||
|
echo "It can take multiple hours until transfer is complete - be patient."
|
||||||
|
echo "****************************************************************************"
|
||||||
|
echo "PRESS ENTER if transfers is done OR if you want to choose another option."
|
||||||
|
sleep 2
|
||||||
|
read key
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
echo "*********************************************"
|
||||||
|
echo "QUICK CHECK RESULT"
|
||||||
|
echo "*********************************************"
|
||||||
|
|
||||||
|
# just if any data transferred ..
|
||||||
|
if [ ${anyDataAtAll} -eq 1 ]; then
|
||||||
|
|
||||||
|
# data was invalid - ask user to keep?
|
||||||
|
if [ ${quickCheckOK} -eq 0 ]; then
|
||||||
|
echo "FAIL -> DATA seems incomplete."
|
||||||
|
else
|
||||||
|
echo "OK -> DATA LOOKS GOOD :D"
|
||||||
|
sudo rm /mnt/hdd/bitcoin/debug.log 2>/dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
else
|
||||||
|
echo "CANCEL -> NO DATA was copied."
|
||||||
|
quickCheckOK=0
|
||||||
|
fi
|
||||||
|
echo "*********************************************"
|
||||||
|
|
||||||
|
|
||||||
|
# REACT ON QUICK CHECK DURING INITAL SETUP
|
||||||
|
if [ ${quickCheckOK} -eq 0 ]; then
|
||||||
|
|
||||||
|
echo "*********************************************"
|
||||||
|
echo "There seems to be an invalid transfer."
|
||||||
|
|
||||||
|
echo "Wait 5 secs ..."
|
||||||
|
sleep 5
|
||||||
|
|
||||||
|
dialog --title " INVALID TRANSFER - TRY AGAIN?" --yesno "Quickcheck shows the data you transferred is invalid/incomplete. Maybe transfere was interrupted and not completed.\n\nDo you want retry/proceed the copy process?" 8 70
|
||||||
|
response=$?
|
||||||
|
echo "response(${response})"
|
||||||
|
if [ "${response}" == "0" ]; then
|
||||||
|
/home/admin/config.scripts/blitz.copychain.sh
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
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?" 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
|
||||||
|
sleep 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "restarting services ... (please wait)"
|
||||||
|
sudo systemctl enable bitcoind
|
||||||
|
sudo systemctl start bitcoind
|
||||||
|
sleep 10
|
||||||
|
|
||||||
|
# setting copy state
|
||||||
|
sed -i "s/^state=.*/state=ready/g" /home/admin/raspiblitz.info
|
||||||
|
sed -i "s/^message=.*/message='Node Running'/g" /home/admin/raspiblitz.info
|
||||||
|
fi
|
||||||
|
|
||||||
|
###################
|
||||||
|
# COPYSOURCE
|
||||||
|
###################
|
||||||
|
|
||||||
|
if [ "$1" = "source" ]; then
|
||||||
|
|
||||||
|
clear
|
||||||
|
echo
|
||||||
|
echo "# *** Copy Blockchain Source Modus ***"
|
||||||
|
|
||||||
|
echo "# get IP of RaspiBlitz to copy to ..."
|
||||||
|
targetIP=$(whiptail --inputbox "\nPlease enter the LOCAL IP of the\nRaspiBlitz to copy Blockchain to:" 10 38 "" --title " Target IP " --backtitle "RaspiBlitz - Copy Blockchain" 3>&1 1>&2 2>&3)
|
||||||
|
targetIP=$(echo "${targetIP[0]}")
|
||||||
|
localIP=$(ip addr | grep 'state UP' -A2 | egrep -v 'docker0|veth' | grep 'eth0\|wlan0\|enp0' | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
|
||||||
|
if [ ${#targetIP} -eq 0 ]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ "${localIP}" == "${targetIP}" ]; then
|
||||||
|
whiptail --msgbox "Dont type in the local IP of this RaspiBlitz,\nthe LOCAL IP of the other RaspiBlitz is needed." 8 54 "" --title " Testing Target IP " --backtitle "RaspiBlitz - Copy Blockchain"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
canPingIP=$(ping ${targetIP} -c 1 | grep -c "1 received")
|
||||||
|
if [ ${canPingIP} -eq 0 ]; then
|
||||||
|
whiptail --msgbox "Was not able to contact/ping: ${targetIP}\n\n- check if IP of target RaspiBlitz is correct.\n- check to be on the same local network.\n- try again ..." 11 58 "" --title " Testing Target IP " --backtitle "RaspiBlitz - Copy Blockchain"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "# get Password of RaspiBlitz to copy to ..."
|
||||||
|
targetPassword=$(whiptail --passwordbox "\nPlease enter the PASSWORD A of the\nRaspiBlitz to copy Blockchain to:" 10 38 "" --title "Target Password" --backtitle "RaspiBlitz - Copy Blockchain" 3>&1 1>&2 2>&3)
|
||||||
|
if [ ${#targetPassword} -eq 0 ]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
sudo rm /root/.ssh/known_hosts 2>/dev/null
|
||||||
|
canLogin=$(sudo sshpass -p "${targetPassword}" ssh -t -o StrictHostKeyChecking=no bitcoin@${targetIP} "echo 'working'" 2>/dev/null | grep -c 'working')
|
||||||
|
if [ ${canLogin} -eq 0 ]; then
|
||||||
|
whiptail --msgbox "Password was not working for IP: ${targetIP}\n\n- check thats the correct IP for correct RaspiBlitz\n- check that you used PASSWORD A and had no typo\n- If you tried too often, wait 1h try again" 11 58 "" --title " Testing Target Password " --backtitle "RaspiBlitz - Copy Blockchain"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "# stopping services ..."
|
||||||
|
sudo systemctl stop background
|
||||||
|
sudo systemctl stop lnd
|
||||||
|
sudo systemctl stop ${network}d
|
||||||
|
sudo systemctl disable ${network}d
|
||||||
|
sleep 5
|
||||||
|
sudo systemctl stop bitcoind 2>/dev/null
|
||||||
|
|
||||||
|
clear
|
||||||
|
echo
|
||||||
|
echo "# Starting copy over LAN (around 4-6 hours) ..."
|
||||||
|
sed -i "s/^state=.*/state=copysource/g" /home/admin/raspiblitz.info
|
||||||
|
cd /mnt/hdd/${network}
|
||||||
|
|
||||||
|
# transfere beginning flag
|
||||||
|
date +%s > /home/admin/copy_begin.time
|
||||||
|
sudo sshpass -p "${targetPassword}" rsync -avhW -e 'ssh -o StrictHostKeyChecking=no -p 22' /home/admin/copy_begin.time bitcoin@${targetIP}:/mnt/hdd/bitcoin
|
||||||
|
sudo rm -f /home/admin/copy_begin.time
|
||||||
|
|
||||||
|
# repeat the syncing of directories until
|
||||||
|
# a) there are no files left to transfere (be robust against failing connections, etc)
|
||||||
|
# b) the user hits a key to break loop after report
|
||||||
|
while :
|
||||||
|
do
|
||||||
|
|
||||||
|
# transfere blockchain data
|
||||||
|
sudo rm -f ./transferred.rsync
|
||||||
|
sudo sshpass -p "${targetPassword}" rsync -avhW -e 'ssh -o StrictHostKeyChecking=no -p 22' --info=progress2 --log-file=./transferred.rsync ./chainstate ./blocks bitcoin@${targetIP}:/mnt/hdd/bitcoin
|
||||||
|
|
||||||
|
# check result
|
||||||
|
# the idea is even after successfull transfer the loop will run a second time
|
||||||
|
# but on the second time there will be no files transfered (log lines are below 4)
|
||||||
|
# thats the signal that its done
|
||||||
|
linesInLogFile=$(wc -l ./transferred.rsync | cut -d " " -f 1)
|
||||||
|
if [ ${linesInLogFile} -lt 4 ]; then
|
||||||
|
echo ""
|
||||||
|
echo "OK all files transfered. DONE"
|
||||||
|
sleep 2
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
|
||||||
|
# wait 20 seconds for user exiting loop
|
||||||
|
echo ""
|
||||||
|
echo -en "OK one sync loop done ... will test in next loop if all was transferred."
|
||||||
|
echo -en "PRESS X TO MANUALLY FINISH SYNCING"
|
||||||
|
read -n 1 -t 6 keyPressed
|
||||||
|
if [ "${keyPressed}" = "x" ]; then
|
||||||
|
echo ""
|
||||||
|
echo "Ending Sync ..."
|
||||||
|
sleep 2
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
# transfere end flag
|
||||||
|
sed -i "s/^state=.*/state=ready/g" /home/admin/raspiblitz.info
|
||||||
|
date +%s > /home/admin/copy_end.time
|
||||||
|
sudo sshpass -p "${targetPassword}" rsync -avhW -e 'ssh -o StrictHostKeyChecking=no -p 22' /home/admin/copy_end.time bitcoin@${targetIP}:/mnt/hdd/bitcoin
|
||||||
|
sudo rm -f /home/admin/copy_end.time
|
||||||
|
|
||||||
|
echo "# start services again ..."
|
||||||
|
sudo systemctl enable ${network}d
|
||||||
|
sudo systemctl start ${network}d
|
||||||
|
sudo systemctl start lnd
|
||||||
|
sudo systemctl start background
|
||||||
|
|
||||||
|
echo "# show final message"
|
||||||
|
whiptail --msgbox "OK - Copy Process Finished.\n\nNow check on the target RaspiBlitz if it was sucessful." 10 40 "" --title " DONE " --backtitle "RaspiBlitz - Copy Blockchain"
|
||||||
|
|
||||||
|
fi
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
||||||
>&2 echo "# managing the data drive(s) with old EXT4 or new BTRFS"
|
>&2 echo "# managing the data drive(s) with old EXT4 or new BTRFS"
|
||||||
>&2 echo "# blitz.datadrive.sh [status|tempmount|format|fstab|raid|link|swap|clean|snapshot]"
|
>&2 echo "# blitz.datadrive.sh [status|tempmount|unmount|format|fstab|raid|link|swap|clean|snapshot|uasp-fix]"
|
||||||
echo "error='missing parameters'"
|
echo "error='missing parameters'"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -49,7 +49,7 @@ fi
|
||||||
isMounted=$(sudo df | grep -c /mnt/hdd)
|
isMounted=$(sudo df | grep -c /mnt/hdd)
|
||||||
isBTRFS=$(sudo btrfs filesystem show 2>/dev/null| grep -c 'BLITZSTORAGE')
|
isBTRFS=$(sudo btrfs filesystem show 2>/dev/null| grep -c 'BLITZSTORAGE')
|
||||||
isRaid=$(btrfs filesystem df /mnt/hdd 2>/dev/null | grep -c "Data, RAID1")
|
isRaid=$(btrfs filesystem df /mnt/hdd 2>/dev/null | grep -c "Data, RAID1")
|
||||||
isSSD="Unknown"
|
isSSD="0"
|
||||||
|
|
||||||
# determine if swap is external on or not
|
# determine if swap is external on or not
|
||||||
externalSwapPath="/mnt/hdd/swapfile"
|
externalSwapPath="/mnt/hdd/swapfile"
|
||||||
|
@ -71,19 +71,25 @@ if [ "$1" = "status" ]; then
|
||||||
echo "isMounted=${isMounted}"
|
echo "isMounted=${isMounted}"
|
||||||
echo "isBTRFS=${isBTRFS}"
|
echo "isBTRFS=${isBTRFS}"
|
||||||
|
|
||||||
# if HDD is not mounted system is in the pre-setup phase
|
# if HDD is not mounted system then it is in the pre-setup phase
|
||||||
# deliver all the details needed about the data drive
|
# deliver all the detailes needed about the data drive
|
||||||
# and it content for the setup dialogs
|
# and it content for the setup dialogs
|
||||||
if [ ${isMounted} -eq 0 ]; then
|
if [ ${isMounted} -eq 0 ]; then
|
||||||
echo
|
echo
|
||||||
echo "# SETUP INFO"
|
echo "# SETUP INFO"
|
||||||
|
|
||||||
# find the HDD (biggest single partition)
|
# find the HDD (biggest single partition)
|
||||||
|
# will then be used to offer formatting and permanent mounting
|
||||||
hdd=""
|
hdd=""
|
||||||
sizeDataPartition=0
|
sizeDataPartition=0
|
||||||
OSPartition=$(sudo df /usr | grep dev | cut -d " " -f 1 | sed "s/\/dev\///g")
|
OSPartition=$(sudo df /usr 2>/dev/null | grep dev | cut -d " " -f 1 | sed "s#/dev/##g")
|
||||||
|
# detect boot partition on UEFI systems
|
||||||
lsblk -o NAME,SIZE -b | grep -P "[s|v]d[a-z][0-9]?" > .lsblk.tmp
|
bootPartition=$(sudo df /boot/efi 2>/dev/null | grep dev | cut -d " " -f 1 | sed "s#/dev/##g")
|
||||||
|
if [ ${#bootPartition} -eq 0 ]; then
|
||||||
|
# for non UEFI
|
||||||
|
bootPartition=$(sudo df /boot 2>/dev/null | grep dev | cut -d " " -f 1 | sed "s#/dev/##g")
|
||||||
|
fi
|
||||||
|
lsblk -o NAME,SIZE -b | grep -P "[s|vn][dv][a-z][0-9]?" > .lsblk.tmp
|
||||||
while read line; do
|
while read line; do
|
||||||
|
|
||||||
# cut line info into different informations
|
# cut line info into different informations
|
||||||
|
@ -110,11 +116,12 @@ if [ "$1" = "status" ]; then
|
||||||
#echo "# testpartitioncount($testpartitioncount)"
|
#echo "# testpartitioncount($testpartitioncount)"
|
||||||
#echo "# testpartitioncount(${testpartitioncount})"
|
#echo "# testpartitioncount(${testpartitioncount})"
|
||||||
#echo "# OSPartition(${OSPartition})"
|
#echo "# OSPartition(${OSPartition})"
|
||||||
|
#echo "# bootPartition(${bootPartition})"
|
||||||
#echo "# hdd(${hdd})"
|
#echo "# hdd(${hdd})"
|
||||||
|
|
||||||
if [ $testpartitioncount -gt 0 ]; then
|
if [ $testpartitioncount -gt 0 ]; then
|
||||||
# if a partition was found - make sure to skip OS partition
|
# if a partition was found - make sure to skip the OS and boot partitions
|
||||||
if [ "$testpartition" != "$OSPartition" ]; then
|
if [ "${testpartition}" != "${OSPartition}" ] && [ "${testpartition}" != "${bootPartition}" ]; then
|
||||||
# make sure to use the biggest
|
# make sure to use the biggest
|
||||||
if [ ${testsize} -gt ${sizeDataPartition} ]; then
|
if [ ${testsize} -gt ${sizeDataPartition} ]; then
|
||||||
sizeDataPartition=${testsize}
|
sizeDataPartition=${testsize}
|
||||||
|
@ -141,14 +148,17 @@ if [ "$1" = "status" ]; then
|
||||||
done < .lsblk.tmp
|
done < .lsblk.tmp
|
||||||
rm -f .lsblk.tmp 1>/dev/null 2>/dev/null
|
rm -f .lsblk.tmp 1>/dev/null 2>/dev/null
|
||||||
|
|
||||||
|
# display possible warnings from hdd partition detection
|
||||||
if [ "${hddPartitionCandidate}" != "" ] && [ ${#hddDataPartition} -lt 4 ]; then
|
if [ "${hddPartitionCandidate}" != "" ] && [ ${#hddDataPartition} -lt 4 ]; then
|
||||||
echo "# WARNING: found invalid partition (${hddDataPartition}) - redacting"
|
echo "# WARNING: found invalid partition (${hddDataPartition}) - redacting"
|
||||||
hddDataPartition=""
|
hddDataPartition=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# try to detect if its an SSD
|
||||||
isSSD=$(sudo cat /sys/block/${hdd}/queue/rotational 2>/dev/null | grep -c 0)
|
isSSD=$(sudo cat /sys/block/${hdd}/queue/rotational 2>/dev/null | grep -c 0)
|
||||||
echo "isSSD=${isSSD}"
|
echo "isSSD=${isSSD}"
|
||||||
|
|
||||||
|
# display results from hdd & partition detection
|
||||||
echo "hddCandidate='${hdd}'"
|
echo "hddCandidate='${hdd}'"
|
||||||
hddBytes=0
|
hddBytes=0
|
||||||
hddGigaBytes=0
|
hddGigaBytes=0
|
||||||
|
@ -158,9 +168,9 @@ if [ "$1" = "status" ]; then
|
||||||
fi
|
fi
|
||||||
echo "hddBytes=${hddBytes}"
|
echo "hddBytes=${hddBytes}"
|
||||||
echo "hddGigaBytes=${hddGigaBytes}"
|
echo "hddGigaBytes=${hddGigaBytes}"
|
||||||
|
|
||||||
echo "hddPartitionCandidate='${hddDataPartition}'"
|
echo "hddPartitionCandidate='${hddDataPartition}'"
|
||||||
|
|
||||||
|
# if positive deliver more data
|
||||||
if [ ${#hddDataPartition} -gt 0 ]; then
|
if [ ${#hddDataPartition} -gt 0 ]; then
|
||||||
|
|
||||||
# check partition size in bytes and GBs
|
# check partition size in bytes and GBs
|
||||||
|
@ -168,13 +178,6 @@ if [ "$1" = "status" ]; then
|
||||||
hddDataPartitionGigaBytes=$(echo "scale=0; ${sizeDataPartition}/1024/1024/1024" | bc -l)
|
hddDataPartitionGigaBytes=$(echo "scale=0; ${sizeDataPartition}/1024/1024/1024" | bc -l)
|
||||||
echo "hddPartitionGigaBytes=${hddDataPartitionGigaBytes}"
|
echo "hddPartitionGigaBytes=${hddDataPartitionGigaBytes}"
|
||||||
|
|
||||||
# check if single drive with that size
|
|
||||||
hddCount=0
|
|
||||||
if [ ${#hddDataPartition} -gt 0 ]; then
|
|
||||||
hddCount=1
|
|
||||||
fi
|
|
||||||
echo "hddCount=${hddCount}"
|
|
||||||
|
|
||||||
# check format of devices partition
|
# check format of devices partition
|
||||||
hddFormat=$(lsblk -o FSTYPE,NAME,TYPE | grep part | grep "${hddDataPartition}" | cut -d " " -f 1)
|
hddFormat=$(lsblk -o FSTYPE,NAME,TYPE | grep part | grep "${hddDataPartition}" | cut -d " " -f 1)
|
||||||
echo "hddFormat='${hddFormat}'"
|
echo "hddFormat='${hddFormat}'"
|
||||||
|
@ -206,11 +209,30 @@ if [ "$1" = "status" ]; then
|
||||||
echo "hddError='data mount failed'"
|
echo "hddError='data mount failed'"
|
||||||
else
|
else
|
||||||
|
|
||||||
# check for recoverable RaspiBlitz data (if config file exists) and raid
|
#####################################
|
||||||
hddRaspiData=$(sudo ls -l /mnt/hdd${subVolumeDir} 2>/dev/null | grep -c raspiblitz.conf)
|
# Pre-Setup Investigation of DATA-PART
|
||||||
isRaid=$(btrfs filesystem df /mnt/hdd 2>/dev/null | grep -c "Data, RAID1")
|
|
||||||
echo "hddRaspiData=${hddRaspiData}"
|
# check for recoverable RaspiBlitz data (if config file exists) and raid
|
||||||
sudo umount /mnt/hdd
|
hddRaspiData=$(sudo ls -l /mnt/hdd${subVolumeDir} 2>/dev/null | grep -c raspiblitz.conf)
|
||||||
|
#isRaid=$(btrfs filesystem df /mnt/hdd 2>/dev/null | grep -c "Data, RAID1")
|
||||||
|
echo "hddRaspiData=${hddRaspiData}"
|
||||||
|
hddRaspiVersion=""
|
||||||
|
if [ ${hddRaspiData} -eq 1 ]; then
|
||||||
|
source /mnt/hdd${subVolumeDir}/raspiblitz.conf
|
||||||
|
hddRaspiVersion="${raspiBlitzVersion}"
|
||||||
|
fi
|
||||||
|
echo "hddRaspiVersion='${hddRaspiVersion}'"
|
||||||
|
|
||||||
|
# check if there is a wifi configuration as backup
|
||||||
|
hddGotWifiConf=$(ls /mnt/hdd${subVolumeDir}/app-data/wpa_supplicant.conf 2>/dev/null | grep -c "wpa_supplicant.conf")
|
||||||
|
if [ ${hddGotWifiConf} -eq 1 ]; then
|
||||||
|
# make a copy to the mem cache drive (so that Wifi can be connected before setup & final HDD mount)
|
||||||
|
sudo cp /mnt/hdd${subVolumeDir}/app-data/wpa_supplicant.conf /var/cache/raspiblitz/wpa_supplicant.conf
|
||||||
|
echo "wifiBackupConfigCopy='/var/cache/raspiblitz/wpa_supplicant.conf'"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# comment this line out if case to study the contect of the data section
|
||||||
|
sudo umount /mnt/hdd
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# temp storage data drive
|
# temp storage data drive
|
||||||
|
@ -228,6 +250,9 @@ if [ "$1" = "status" ]; then
|
||||||
echo "hddError='storage mount failed'"
|
echo "hddError='storage mount failed'"
|
||||||
else
|
else
|
||||||
|
|
||||||
|
########################################
|
||||||
|
# Pre-Setup Invetigation of STORAGE-PART
|
||||||
|
|
||||||
# check for blockchain data on storage
|
# check for blockchain data on storage
|
||||||
hddBlocksBitcoin=$(sudo ls /mnt/storage${subVolumeDir}/bitcoin/blocks/blk00000.dat 2>/dev/null | grep -c '.dat')
|
hddBlocksBitcoin=$(sudo ls /mnt/storage${subVolumeDir}/bitcoin/blocks/blk00000.dat 2>/dev/null | grep -c '.dat')
|
||||||
echo "hddBlocksBitcoin=${hddBlocksBitcoin}"
|
echo "hddBlocksBitcoin=${hddBlocksBitcoin}"
|
||||||
|
@ -252,15 +277,14 @@ if [ "$1" = "status" ]; then
|
||||||
echo "hddDataFreeKB=${hdd_data_free1Kblocks}"
|
echo "hddDataFreeKB=${hdd_data_free1Kblocks}"
|
||||||
|
|
||||||
# check if its another fullnode implementation data disk
|
# check if its another fullnode implementation data disk
|
||||||
hddGotMigrationData="none"
|
hddGotMigrationData=""
|
||||||
if [ "${hddFormat}" = "ext4" ]; then
|
if [ "${hddFormat}" = "ext4" ]; then
|
||||||
# check for umbrel
|
# check for other node implementations
|
||||||
isUmbrelHDD=$(sudo ls /mnt/storage/umbrel/info.json 2>/dev/null | grep -c '.json')
|
isUmbrelHDD=$(sudo ls /mnt/storage/umbrel/info.json 2>/dev/null | grep -c '.json')
|
||||||
|
isMyNodeHDD=$(sudo ls /mnt/storage/mynode/bitcoin/bitcoin.conf 2>/dev/null | grep -c '.conf')
|
||||||
if [ ${isUmbrelHDD} -gt 0 ]; then
|
if [ ${isUmbrelHDD} -gt 0 ]; then
|
||||||
hddGotMigrationData="umbrel"
|
hddGotMigrationData="umbrel"
|
||||||
fi
|
elif [ ${isMyNodeHDD} -gt 0 ]; then
|
||||||
isMyNodeHDD=$(sudo ls /mnt/storage/mynode/bitcoin/bitcoin.conf 2>/dev/null | grep -c '.conf')
|
|
||||||
if [ ${isMyNodeHDD} -gt 0 ]; then
|
|
||||||
hddGotMigrationData="mynode"
|
hddGotMigrationData="mynode"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
@ -268,7 +292,7 @@ if [ "$1" = "status" ]; then
|
||||||
fi
|
fi
|
||||||
echo "hddGotMigrationData='${hddGotMigrationData}'"
|
echo "hddGotMigrationData='${hddGotMigrationData}'"
|
||||||
|
|
||||||
# unmount
|
# comment this line out if case to study the contect of the storage section
|
||||||
sudo umount /mnt/storage
|
sudo umount /mnt/storage
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
@ -298,6 +322,12 @@ if [ "$1" = "status" ]; then
|
||||||
fi
|
fi
|
||||||
hddRaspiData=$(sudo ls -l /mnt/hdd | grep -c raspiblitz.conf)
|
hddRaspiData=$(sudo ls -l /mnt/hdd | grep -c raspiblitz.conf)
|
||||||
echo "hddRaspiData=${hddRaspiData}"
|
echo "hddRaspiData=${hddRaspiData}"
|
||||||
|
hddRaspiVersion=""
|
||||||
|
if [ ${hddRaspiData} -eq 1 ]; then
|
||||||
|
source /mnt/hdd/raspiblitz.conf
|
||||||
|
hddRaspiVersion="${raspiBlitzVersion}"
|
||||||
|
fi
|
||||||
|
echo "hddRaspiVersion='${hddRaspiVersion}'"
|
||||||
|
|
||||||
isSSD=$(sudo cat /sys/block/${hdd}/queue/rotational 2>/dev/null | grep -c 0)
|
isSSD=$(sudo cat /sys/block/${hdd}/queue/rotational 2>/dev/null | grep -c 0)
|
||||||
echo "isSSD=${isSSD}"
|
echo "isSSD=${isSSD}"
|
||||||
|
@ -345,7 +375,8 @@ if [ "$1" = "status" ]; then
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# HDD Adapter UASP support --> https://www.pragmaticlinux.com/2021/03/fix-for-getting-your-ssd-working-via-usb-3-on-your-raspberry-pi/
|
# HDD Adpater UASP support --> https://www.pragmaticlinux.com/2021/03/fix-for-getting-your-ssd-working-via-usb-3-on-your-raspberry-pi/
|
||||||
|
# in both cases (if mounted or not - using the hdd selection from both cases)
|
||||||
if [ ${#hdd} -gt 0 ]; then
|
if [ ${#hdd} -gt 0 ]; then
|
||||||
|
|
||||||
# determine USB HDD adapter model ID
|
# determine USB HDD adapter model ID
|
||||||
|
@ -358,8 +389,18 @@ if [ "$1" = "status" ]; then
|
||||||
fi
|
fi
|
||||||
echo "hddAdapterUSB='${hddAdapter}'"
|
echo "hddAdapterUSB='${hddAdapter}'"
|
||||||
|
|
||||||
# check if HDD ADAPTER is on UASP WHITELIST (tested devices)
|
|
||||||
hddAdapterUSAP=0
|
hddAdapterUSAP=0
|
||||||
|
|
||||||
|
# check if user wants to force UASP on
|
||||||
|
if [ -f "/boot/uasp.force" ]; then
|
||||||
|
hddAdapterUSAP=1
|
||||||
|
echo "uaspForced=1"
|
||||||
|
fi
|
||||||
|
if [ $(cat /mnt/hdd/raspiblitz.conf 2>/dev/null | grep -c "forceUasp=on") -eq 1 ]; then
|
||||||
|
hddAdapterUSAP=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# check if HDD ADAPTER is on UASP WHITELIST (tested devices)
|
||||||
if [ "${hddAdapter}" == "174c:55aa" ]; then
|
if [ "${hddAdapter}" == "174c:55aa" ]; then
|
||||||
# UGREEN 2.5" External USB 3.0 Hard Disk Case with UASP support
|
# UGREEN 2.5" External USB 3.0 Hard Disk Case with UASP support
|
||||||
hddAdapterUSAP=1
|
hddAdapterUSAP=1
|
||||||
|
@ -394,10 +435,10 @@ if [ "$1" = "status" ]; then
|
||||||
do
|
do
|
||||||
devMounted=$(lsblk -o MOUNTPOINT,NAME | grep "$disk" | grep -c "^/")
|
devMounted=$(lsblk -o MOUNTPOINT,NAME | grep "$disk" | grep -c "^/")
|
||||||
# is raid candidate when not mounted and not the data drive candidate (hdd/ssd)
|
# is raid candidate when not mounted and not the data drive candidate (hdd/ssd)
|
||||||
if [ ${devMounted} -eq 0 ] && [ "${disk}" != "${hdd}" ] && [ "${hdd}" != "" ]; then
|
if [ ${devMounted} -eq 0 ] && [ "${disk}" != "${hdd}" ] && [ "${hdd}" != "" ] && [ "${disk}" != "" ]; then
|
||||||
sizeBytes=$(lsblk -o NAME,SIZE -b | grep "^${disk}" | awk '$1=$1' | cut -d " " -f 2)
|
sizeBytes=$(lsblk -o NAME,SIZE -b | grep "^${disk}" | awk '$1=$1' | cut -d " " -f 2)
|
||||||
sizeGigaBytes=$(echo "scale=0; ${sizeBytes}/1024/1024/1024" | bc -l)
|
sizeGigaBytes=$(echo "scale=0; ${sizeBytes}/1024/1024/1024" | bc -l)
|
||||||
vedorname=$(lsblk -o NAME,VENDOR | grep "^${disk}" | awk '$1=$1' | cut -d " " -f 2)
|
vedorname=$(lsblk -o NAME,VENDOR | grep "^${disk}" | awk '$1=$1' | cut -d " " -f 2 | sed 's/[^a-zA-Z0-9]//g')
|
||||||
mountoption="${disk} ${sizeGigaBytes} GB ${vedorname}"
|
mountoption="${disk} ${sizeGigaBytes} GB ${vedorname}"
|
||||||
echo "raidCandidate[${drivecounter}]='${mountoption}'"
|
echo "raidCandidate[${drivecounter}]='${mountoption}'"
|
||||||
drivecounter=$(($drivecounter +1))
|
drivecounter=$(($drivecounter +1))
|
||||||
|
@ -642,6 +683,7 @@ if [ "$1" = "format" ]; then
|
||||||
>&2 echo "# waiting until formatted drives gets available"
|
>&2 echo "# waiting until formatted drives gets available"
|
||||||
sleep 2
|
sleep 2
|
||||||
sync
|
sync
|
||||||
|
sudo parted -l
|
||||||
loopdone=$(lsblk -o NAME,LABEL | grep -c BLITZDATA)
|
loopdone=$(lsblk -o NAME,LABEL | grep -c BLITZDATA)
|
||||||
loopcount=$(($loopcount +1))
|
loopcount=$(($loopcount +1))
|
||||||
if [ ${loopcount} -gt 60 ]; then
|
if [ ${loopcount} -gt 60 ]; then
|
||||||
|
@ -682,6 +724,7 @@ if [ "$1" = "format" ]; then
|
||||||
>&2 echo "# waiting until formatted drives gets available"
|
>&2 echo "# waiting until formatted drives gets available"
|
||||||
sleep 2
|
sleep 2
|
||||||
sync
|
sync
|
||||||
|
sudo parted -l
|
||||||
loopdone=$(lsblk -o NAME,LABEL | grep -c BLITZSTORAGE)
|
loopdone=$(lsblk -o NAME,LABEL | grep -c BLITZSTORAGE)
|
||||||
loopcount=$(($loopcount +1))
|
loopcount=$(($loopcount +1))
|
||||||
if [ ${loopcount} -gt 60 ]; then
|
if [ ${loopcount} -gt 60 ]; then
|
||||||
|
@ -721,6 +764,7 @@ if [ "$1" = "format" ]; then
|
||||||
>&2 echo "# waiting until formatted drives gets available"
|
>&2 echo "# waiting until formatted drives gets available"
|
||||||
sleep 2
|
sleep 2
|
||||||
sync
|
sync
|
||||||
|
sudo parted -l
|
||||||
loopdone=$(lsblk -o NAME,LABEL | grep -c BLITZTEMP)
|
loopdone=$(lsblk -o NAME,LABEL | grep -c BLITZTEMP)
|
||||||
loopcount=$(($loopcount +1))
|
loopcount=$(($loopcount +1))
|
||||||
if [ ${loopcount} -gt 60 ]; then
|
if [ ${loopcount} -gt 60 ]; then
|
||||||
|
@ -1174,17 +1218,28 @@ fi
|
||||||
|
|
||||||
if [ "$1" = "tempmount" ]; then
|
if [ "$1" = "tempmount" ]; then
|
||||||
|
|
||||||
|
# get HDD status and candidates
|
||||||
|
source <(/home/admin/config.scripts/blitz.datadrive.sh status)
|
||||||
|
|
||||||
if [ ${isMounted} -eq 1 ]; then
|
if [ ${isMounted} -eq 1 ]; then
|
||||||
echo "error='already mounted'"
|
echo "error='already mounted'"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# get device to temp mount
|
# get device to temp mount from parameter (optional)
|
||||||
hdd=$2
|
hdd=$2
|
||||||
if [ ${#hdd} -eq 0 ]; then
|
# automount if no parameter the hddcandinate
|
||||||
>&2 echo "# FAIL which device should be temp mounted (e.g. sda)"
|
if [ "${hdd}" == "" ]; then
|
||||||
>&2 echo "# run 'status' to see device candidates"
|
if [ "${hddFormat}" != "btrfs" ]; then
|
||||||
echo "error='missing second parameter'"
|
hdd="${hddPartitionCandidate}"
|
||||||
|
else
|
||||||
|
hdd="${hddCandidate}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
# if still no hdd .. throw error
|
||||||
|
if [ "${hdd}" == "" ]; then
|
||||||
|
>&2 echo "# FAIL there is no detected hdd candidate to tempmount"
|
||||||
|
echo "error='hdd not found'"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -1264,6 +1319,14 @@ if [ "$1" = "tempmount" ]; then
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$1" = "unmount" ]; then
|
||||||
|
sudo umount /mnt/hdd 2>/dev/null
|
||||||
|
sudo umount /mnt/storage 2>/dev/null
|
||||||
|
sudo umount /mnt/temp 2>/dev/null
|
||||||
|
echo "# OK done unmount"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
########################################
|
########################################
|
||||||
# LINKING all directories with ln
|
# LINKING all directories with ln
|
||||||
########################################
|
########################################
|
||||||
|
@ -1482,6 +1545,9 @@ if [ "$1" = "clean" ]; then
|
||||||
|
|
||||||
>&2 echo "# RASPIBLITZ DATA DRIVES - CLEANING"
|
>&2 echo "# RASPIBLITZ DATA DRIVES - CLEANING"
|
||||||
|
|
||||||
|
# get HDD status
|
||||||
|
source <(/home/admin/config.scripts/blitz.datadrive.sh status)
|
||||||
|
|
||||||
if [ ${isMounted} -eq 0 ]; then
|
if [ ${isMounted} -eq 0 ]; then
|
||||||
>&2 echo "# FAIL: cannot clean - the drive is not mounted'"
|
>&2 echo "# FAIL: cannot clean - the drive is not mounted'"
|
||||||
echo "error='not mounted'"
|
echo "error='not mounted'"
|
||||||
|
@ -1492,9 +1558,9 @@ if [ "$1" = "clean" ]; then
|
||||||
sudo apt-get install -y secure-delete 1>/dev/null
|
sudo apt-get install -y secure-delete 1>/dev/null
|
||||||
|
|
||||||
>&2 echo
|
>&2 echo
|
||||||
>&2 echo "# IMPORTANT: There is no 100% guarantee that sensitive data is completely deleted!"
|
>&2 echo "# IMPORTANT: No 100% guarantee that sensitive data is completely deleted!"
|
||||||
>&2 echo "# see: https://www.davescomputers.com/securely-deleting-files-solid-state-drive/"
|
# see: https://www.davescomputers.com/securely-deleting-files-solid-state-drive/"
|
||||||
>&2 echo "# see: https://unix.stackexchange.com/questions/62345/securely-delete-files-on-btrfs-filesystem"
|
# see: https://unix.stackexchange.com/questions/62345/securely-delete-files-on-btrfs-filesystem"
|
||||||
>&2 echo "# --> Dont resell or gift data drive. Destroy physically if needed."
|
>&2 echo "# --> Dont resell or gift data drive. Destroy physically if needed."
|
||||||
>&2 echo
|
>&2 echo
|
||||||
|
|
||||||
|
@ -1537,7 +1603,7 @@ if [ "$1" = "clean" ]; then
|
||||||
fi
|
fi
|
||||||
# on SSDs never shred
|
# on SSDs never shred
|
||||||
# https://www.davescomputers.com/securely-deleting-files-solid-state-drive/
|
# https://www.davescomputers.com/securely-deleting-files-solid-state-drive/
|
||||||
if [ ${isSSD} -eq 1 ]; then
|
if [ "${isSSD}" == "1" ]; then
|
||||||
whenDeleteSchredd=0
|
whenDeleteSchredd=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -1547,7 +1613,7 @@ if [ "$1" = "clean" ]; then
|
||||||
if [ -d "/mnt/hdd/$entry" ]; then
|
if [ -d "/mnt/hdd/$entry" ]; then
|
||||||
if [ ${whenDeleteSchredd} -eq 1 ]; then
|
if [ ${whenDeleteSchredd} -eq 1 ]; then
|
||||||
>&2 echo "# shredding DIR : ${entry}"
|
>&2 echo "# shredding DIR : ${entry}"
|
||||||
sudo srm -r /mnt/hdd/$entry
|
sudo srm -lr /mnt/hdd/$entry
|
||||||
else
|
else
|
||||||
>&2 echo "# deleting DIR : ${entry}"
|
>&2 echo "# deleting DIR : ${entry}"
|
||||||
sudo rm -r /mnt/hdd/$entry
|
sudo rm -r /mnt/hdd/$entry
|
||||||
|
@ -1555,7 +1621,7 @@ if [ "$1" = "clean" ]; then
|
||||||
else
|
else
|
||||||
if [ ${whenDeleteSchredd} -eq 1 ]; then
|
if [ ${whenDeleteSchredd} -eq 1 ]; then
|
||||||
>&2 echo "# shredding FILE : ${entry}"
|
>&2 echo "# shredding FILE : ${entry}"
|
||||||
sudo srm /mnt/hdd/$entry
|
sudo srm -l /mnt/hdd/$entry
|
||||||
else
|
else
|
||||||
>&2 echo "# deleting FILE : ${entry}"
|
>&2 echo "# deleting FILE : ${entry}"
|
||||||
sudo rm /mnt/hdd/$entry
|
sudo rm /mnt/hdd/$entry
|
||||||
|
@ -1576,14 +1642,15 @@ if [ "$1" = "clean" ]; then
|
||||||
echo "Cleaning Blockchain: ${chain}"
|
echo "Cleaning Blockchain: ${chain}"
|
||||||
|
|
||||||
# take extra care if wallet.db exists
|
# take extra care if wallet.db exists
|
||||||
sudo srm /mnt/hdd/${chain}/wallet.db 2>/dev/null
|
sudo srm -v /mnt/hdd/${chain}/wallet.db 2>/dev/null
|
||||||
|
|
||||||
# the rest just delete (keep blocks and chainstate)
|
# the rest just delete (keep blocks and chainstate and testnet3)
|
||||||
for entry in $(ls -A1 /mnt/hdd/${chain} 2>/dev/null)
|
for entry in $(ls -A1 /mnt/hdd/${chain} 2>/dev/null)
|
||||||
do
|
do
|
||||||
# sorting file
|
# sorting file
|
||||||
delete=1
|
delete=1
|
||||||
if [ "${entry}" = "blocks" ] || [ "${entry}" = "chainstate" ]; then
|
if [ "${entry}" = "blocks" ] || [ "${entry}" = "chainstate" ]\
|
||||||
|
|| [ "${entry}" = "testnet3" ] ; then
|
||||||
delete=0
|
delete=0
|
||||||
fi
|
fi
|
||||||
# delete or keep
|
# delete or keep
|
||||||
|
@ -1599,6 +1666,30 @@ if [ "$1" = "clean" ]; then
|
||||||
>&2 echo "# keeping: ${entry}"
|
>&2 echo "# keeping: ${entry}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# keep blocks and chainstate in testnet3 if exists
|
||||||
|
if [ -d /mnt/hdd/bitcoin/testnet3 ];then
|
||||||
|
for entry in $(ls -A1 /mnt/hdd/bitcoin/testnet3 2>/dev/null)
|
||||||
|
do
|
||||||
|
# sorting file
|
||||||
|
delete=1
|
||||||
|
if [ "${entry}" = "blocks" ] || [ "${entry}" = "chainstate" ]; then
|
||||||
|
delete=0
|
||||||
|
fi
|
||||||
|
# delete or keep
|
||||||
|
if [ ${delete} -eq 1 ]; then
|
||||||
|
if [ -d "/mnt/hdd/bitcoin/testnet3/$entry" ]; then
|
||||||
|
>&2 echo "# Deleting DIR : /mnt/hdd/bitcoin/testnet3/${entry}"
|
||||||
|
sudo rm -r /mnt/hdd/bitcoin/testnet3/$entry
|
||||||
|
else
|
||||||
|
>&2 echo "# deleting FILE : /mnt/hdd/bitcoin/testnet3/${entry}"
|
||||||
|
sudo rm /mnt/hdd/bitcoin/testnet3/$entry
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
>&2 echo "# keeping: ${entry}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -1672,5 +1763,43 @@ if [ "$1" = "clean" ]; then
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "error='unknown command'"
|
########################################
|
||||||
|
# UASP-fix
|
||||||
|
########################################
|
||||||
|
|
||||||
|
if [ "$1" = "uasp-fix" ]; then
|
||||||
|
|
||||||
|
# get HDD status and if the connected adapter is supports UASP
|
||||||
|
source <(/home/admin/config.scripts/blitz.datadrive.sh status)
|
||||||
|
|
||||||
|
# check if UASP is already deactivated (on RaspiOS)
|
||||||
|
# https://www.pragmaticlinux.com/2021/03/fix-for-getting-your-ssd-working-via-usb-3-on-your-raspberry-pi/
|
||||||
|
cmdlineExists=$(sudo ls /boot/cmdline.txt 2>/dev/null | grep -c "cmdline.txt")
|
||||||
|
if [ ${cmdlineExists} -eq 1 ] && [ ${#hddAdapterUSB} -gt 0 ] && [ ${hddAdapterUSAP} -eq 0 ]; then
|
||||||
|
echo "# Checking for UASP deactivation ..."
|
||||||
|
usbQuirkActive=$(sudo cat /boot/cmdline.txt | grep -c "usb-storage.quirks=")
|
||||||
|
usbQuirkDone=$(sudo cat /boot/cmdline.txt | grep -c "usb-storage.quirks=${hddAdapterUSB}:u")
|
||||||
|
if [ ${usbQuirkActive} -gt 0 ] && [ ${usbQuirkDone} -eq 0 ]; then
|
||||||
|
# remove old usb-storage.quirks
|
||||||
|
sudo sed -i "s/usb-storage.quirks=[^ ]* //g" /boot/cmdline.txt
|
||||||
|
fi
|
||||||
|
if [ ${usbQuirkDone} -eq 0 ]; then
|
||||||
|
# add new usb-storage.quirks
|
||||||
|
sudo sed -i "1s/^/usb-storage.quirks=${hddAdapterUSB}:u /" /boot/cmdline.txt
|
||||||
|
# go into reboot to activate new setting
|
||||||
|
echo "# DONE deactivating UASP for ${hddAdapterUSB} ... reboot needed"
|
||||||
|
echo "neededReboot=1"
|
||||||
|
else
|
||||||
|
echo "# Already UASP deactivated for ${hddAdapterUSB}"
|
||||||
|
echo "neededReboot=0"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "# Skipping UASP deactivation ... cmdlineExists(${cmdlineExists}) hddAdapterUSB(${hddAdapterUSB}) hddAdapterUSAP(${hddAdapterUSAP})"
|
||||||
|
echo "neededReboot=0"
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "error='unkown command'"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
361
home.admin/config.scripts/blitz.debug.sh
Executable file
361
home.admin/config.scripts/blitz.debug.sh
Executable file
|
@ -0,0 +1,361 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# USE THIS SCRIPT FOR BASIC SYSTEM STATUS DEBUG INFO
|
||||||
|
|
||||||
|
# load code software version
|
||||||
|
source /home/admin/_version.info
|
||||||
|
|
||||||
|
## get basic info (its OK if not set yet)
|
||||||
|
source /home/admin/raspiblitz.info 2>/dev/null
|
||||||
|
source /mnt/hdd/raspiblitz.conf 2>/dev/null
|
||||||
|
|
||||||
|
# for old nodes
|
||||||
|
if [ ${#network} -eq 0 ]; then
|
||||||
|
echo "backup info: network"
|
||||||
|
network="bitcoin"
|
||||||
|
litecoinActive=$(sudo ls /mnt/hdd/litecoin/litecoin.conf | grep -c 'litecoin.conf')
|
||||||
|
if [ ${litecoinActive} -eq 1 ]; then
|
||||||
|
network="litecoin"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# for non final config nodes
|
||||||
|
if [ ${#chain} -eq 0 ]; then
|
||||||
|
echo "backup info: chain"
|
||||||
|
chain="test"
|
||||||
|
isMainChain=$(sudo cat /mnt/hdd/${network}/${network}.conf 2>/dev/null | grep "testnet=0" -c)
|
||||||
|
if [ ${isMainChain} -gt 0 ];then
|
||||||
|
chain="main"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
clear
|
||||||
|
echo
|
||||||
|
echo "***************************************************************"
|
||||||
|
echo "* RASPIBLITZ DEBUG LOGS "
|
||||||
|
echo "***************************************************************"
|
||||||
|
echo "blitzversion: ${codeVersion}"
|
||||||
|
echo "chainnetwork: ${network} / ${chain}"
|
||||||
|
uptime
|
||||||
|
echo
|
||||||
|
|
||||||
|
echo "*** SETUPPHASE / BOOTSTRAP ***"
|
||||||
|
echo "see logs: cat /home/admin/raspiblitz.log"
|
||||||
|
echo "setupPhase--> ${setupPhase}"
|
||||||
|
echo "state--> ${state}"
|
||||||
|
if [ "${setupPhase}" != "done" ]; then
|
||||||
|
sudo tail -n 20 /home/admin/raspiblitz.log
|
||||||
|
fi
|
||||||
|
echo
|
||||||
|
|
||||||
|
echo "*** BACKGROUNDSERVICE ***"
|
||||||
|
echo "to monitor Background service call: sudo journalctl -f -u background"
|
||||||
|
echo
|
||||||
|
|
||||||
|
echo "*** BLOCKCHAIN (MAINNET) SYSTEMD STATUS ***"
|
||||||
|
sudo systemctl status ${network}d -n2 --no-pager
|
||||||
|
echo
|
||||||
|
echo "*** LAST BLOCKCHAIN (MAINNET) ERROR LOGS ***"
|
||||||
|
echo "sudo journalctl -u ${network}d -b --no-pager -n8"
|
||||||
|
sudo journalctl -u ${network}d -b --no-pager -n8
|
||||||
|
cat /home/admin/systemd.blockchain.log | grep "ERROR" | tail -n -2
|
||||||
|
echo
|
||||||
|
echo "*** LAST BLOCKCHAIN (MAINNET) 20 INFO LOGS ***"
|
||||||
|
echo "sudo tail -n 20 /mnt/hdd/${network}/debug.log"
|
||||||
|
sudo tail -n 20 /mnt/hdd/${network}${pathAdd}/debug.log
|
||||||
|
echo
|
||||||
|
|
||||||
|
echo "*** LND (MAINNET) SYSTEMD STATUS ***"
|
||||||
|
if [ "${lightning}" == "lnd" ] || [ "${lnd}" == "on" ] || [ "${lnd}" == "1" ]; then
|
||||||
|
sudo systemctl status lnd -n2 --no-pager
|
||||||
|
echo
|
||||||
|
echo "*** LAST LND (MAINNET) ERROR LOGS ***"
|
||||||
|
echo "sudo journalctl -u lnd -b --no-pager -n12"
|
||||||
|
sudo journalctl -u lnd -b --no-pager -n12
|
||||||
|
cat /home/admin/systemd.lightning.log | grep "ERROR" | tail -n -1
|
||||||
|
echo
|
||||||
|
echo "*** LAST 30 LND (MAINNET) INFO LOGS ***"
|
||||||
|
echo "sudo tail -n 30 /mnt/hdd/lnd/logs/${network}/mainnet/lnd.log"
|
||||||
|
sudo tail -n 30 /mnt/hdd/lnd/logs/${network}/mainnet/lnd.log
|
||||||
|
else
|
||||||
|
echo "- OFF by config -"
|
||||||
|
fi
|
||||||
|
echo
|
||||||
|
|
||||||
|
echo "*** C-LIGHTNING (MAINNET) SYSTEMD STATUS ***"
|
||||||
|
if [ "${lightning}" == "cl" ] || [ "${cl}" == "on" ] || [ "${cl}" == "1" ]; then
|
||||||
|
sudo systemctl status lightningd -n2 --no-pager
|
||||||
|
echo
|
||||||
|
echo "*** LAST 30 C-LIGHTNING (MAINNET) INFO LOGS ***"
|
||||||
|
echo "sudo tail -n 30 /mnt/hdd/lnd/logs/${network}/${chain}net/lnd.log"
|
||||||
|
sudo tail -n 30 /home/bitcoin/.lightning/${network}/cl.log
|
||||||
|
else
|
||||||
|
echo "- not activated -"
|
||||||
|
fi
|
||||||
|
echo
|
||||||
|
|
||||||
|
echo "*** BLOCKCHAIN (TESTNET) SYSTEMD STATUS ***"
|
||||||
|
if [ "${testnet}" == "on" ] || [ "${testnet}" == "1" ]; then
|
||||||
|
sudo systemctl status t${network}d -n2 --no-pager
|
||||||
|
echo
|
||||||
|
echo "*** LAST BLOCKCHAIN (TESTNET) ERROR LOGS ***"
|
||||||
|
echo "sudo journalctl -u t${network}d -b --no-pager -n8"
|
||||||
|
sudo journalctl -u t${network}d -b --no-pager -n8
|
||||||
|
echo
|
||||||
|
echo "*** LAST BLOCKCHAIN (TESTNET) 20 INFO LOGS ***"
|
||||||
|
echo "sudo tail -n 20 /mnt/hdd/${network}/tdebug.log"
|
||||||
|
sudo tail -n 20 /mnt/hdd/${network}/tdebug.log
|
||||||
|
echo
|
||||||
|
else
|
||||||
|
echo "- OFF by config -"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "*** LND (TESTNET) SYSTEMD STATUS ***"
|
||||||
|
if [ "${tlnd}" == "on" ] || [ "${tlnd}" == "1" ]; then
|
||||||
|
sudo systemctl status tlnd -n2 --no-pager
|
||||||
|
echo
|
||||||
|
echo "*** LAST LND (TESTNET) ERROR LOGS ***"
|
||||||
|
echo "sudo journalctl -u tlnd -b --no-pager -n12"
|
||||||
|
sudo journalctl -u tlnd -b --no-pager -n12
|
||||||
|
echo
|
||||||
|
echo "*** LAST 30 LND (TESTNET) INFO LOGS ***"
|
||||||
|
echo "sudo tail -n 30 /mnt/hdd/lnd/logs/${network}/testnet/tnd.log"
|
||||||
|
sudo tail -n 30 /mnt/hdd/lnd/logs/${network}/testnet/lnd.log
|
||||||
|
else
|
||||||
|
echo "- OFF by config -"
|
||||||
|
fi
|
||||||
|
echo
|
||||||
|
|
||||||
|
echo "*** C-LIGHTNING (TESTNET) SYSTEMD STATUS ***"
|
||||||
|
if [ "${tcl}" == "on" ] || [ "${tcl}" == "1" ]; then
|
||||||
|
sudo systemctl status tlightningd -n2 --no-pager
|
||||||
|
echo
|
||||||
|
echo "*** LAST 30 C-LIGHTNING (TESTNET) INFO LOGS ***"
|
||||||
|
echo "sudo tail -n 30 /home/bitcoin/.lightning/testnet/cl.log"
|
||||||
|
sudo tail -n 30 /home/bitcoin/.lightning/testnet/cl.log
|
||||||
|
else
|
||||||
|
echo "- not activated -"
|
||||||
|
fi
|
||||||
|
echo
|
||||||
|
|
||||||
|
echo "*** BLOCKCHAIN (SIGNET) SYSTEMD STATUS ***"
|
||||||
|
if [ "${signet}" == "on" ] || [ "${signet}" == "1" ]; then
|
||||||
|
sudo systemctl status s${network}d -n2 --no-pager
|
||||||
|
echo
|
||||||
|
echo "*** LAST BLOCKCHAIN (SIGNET) ERROR LOGS ***"
|
||||||
|
echo "sudo journalctl -u s${network}d -b --no-pager -n8"
|
||||||
|
sudo journalctl -u s${network}d -b --no-pager -n8
|
||||||
|
echo
|
||||||
|
echo "*** LAST BLOCKCHAIN (SIGNET) 20 INFO LOGS ***"
|
||||||
|
echo "sudo tail -n 20 /mnt/hdd/${network}/sdebug.log"
|
||||||
|
sudo tail -n 20 /mnt/hdd/${network}/sdebug.log
|
||||||
|
echo
|
||||||
|
else
|
||||||
|
echo "- OFF by config -"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "*** LND (SIGNET) SYSTEMD STATUS ***"
|
||||||
|
if [ "${slnd}" == "on" ] || [ "${slnd}" == "1" ]; then
|
||||||
|
sudo systemctl status slnd -n2 --no-pager
|
||||||
|
echo
|
||||||
|
echo "*** LAST LND (SIGNET) ERROR LOGS ***"
|
||||||
|
echo "sudo journalctl -u slnd -b --no-pager -n12"
|
||||||
|
sudo journalctl -u slnd -b --no-pager -n12
|
||||||
|
echo
|
||||||
|
echo "*** LAST 30 LND (SIGNET) INFO LOGS ***"
|
||||||
|
echo "sudo tail -n 30 /mnt/hdd/lnd/logs/${network}/signet/tnd.log"
|
||||||
|
sudo tail -n 30 /mnt/hdd/lnd/logs/${network}/signet/lnd.log
|
||||||
|
else
|
||||||
|
echo "- OFF by config -"
|
||||||
|
fi
|
||||||
|
echo
|
||||||
|
|
||||||
|
echo "*** C-LIGHTNING (SIGNET) SYSTEMD STATUS ***"
|
||||||
|
if [ "${scl}" == "on" ] || [ "${scl}" == "1" ]; then
|
||||||
|
sudo systemctl status slightningd -n2 --no-pager
|
||||||
|
echo
|
||||||
|
echo "*** LAST 30 C-LIGHTNING (SIGNET) INFO LOGS ***"
|
||||||
|
echo "sudo tail -n 30 /home/bitcoin/.lightning/signet/cl.log"
|
||||||
|
sudo tail -n 30 /home/bitcoin/.lightning/signet/cl.log
|
||||||
|
else
|
||||||
|
echo "- not activated -"
|
||||||
|
fi
|
||||||
|
echo
|
||||||
|
|
||||||
|
echo "*** NGINX SYSTEMD STATUS ***"
|
||||||
|
sudo systemctl status nginx -n2 --no-pager
|
||||||
|
echo
|
||||||
|
|
||||||
|
echo "*** LAST NGINX LOGS ***"
|
||||||
|
echo "sudo journalctl -u nginx -b --no-pager -n20"
|
||||||
|
sudo journalctl -u nginx -b --no-pager -n20
|
||||||
|
echo "--> CHECK CONFIG: sudo nginx -t"
|
||||||
|
sudo nginx -t
|
||||||
|
echo
|
||||||
|
|
||||||
|
echo "*** BLITZAPI SYSTEMD STATUS ***"
|
||||||
|
sudo systemctl status blitzapi -n2 --no-pager
|
||||||
|
echo
|
||||||
|
|
||||||
|
echo "*** LAST BLITZAPI LOGS ***"
|
||||||
|
echo "sudo journalctl -u blitzapi -b --no-pager -n20"
|
||||||
|
sudo journalctl -u nginx -b --no-pager -n20
|
||||||
|
echo "--> CHECK CONFIG: sudo nginx -t"
|
||||||
|
sudo nginx -t
|
||||||
|
echo
|
||||||
|
|
||||||
|
if [ "${touchscreen}" == "" ] || [ "${touchscreen}" == "0" ] || [ "${touchscreen}" == "off" ]; then
|
||||||
|
echo "- TOUCHSCREEN is OFF by config"
|
||||||
|
else
|
||||||
|
echo
|
||||||
|
echo "*** LAST 20 TOUCHSCREEN LOGS ***"
|
||||||
|
echo "sudo tail -n 20 /home/pi/.cache/lxsession/LXDE-pi/run.log"
|
||||||
|
sudo tail -n 20 /home/pi/.cache/lxsession/LXDE-pi/run.log
|
||||||
|
echo
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${loop}" == "" ] || [ "${loop}" == "off" ]; then
|
||||||
|
echo "- Loop is OFF by config"
|
||||||
|
else
|
||||||
|
echo
|
||||||
|
echo "*** LAST 20 LOOP LOGS ***"
|
||||||
|
echo "sudo journalctl -u loopd -b --no-pager -n20"
|
||||||
|
sudo journalctl -u loopd -b --no-pager -n20
|
||||||
|
echo
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if [ "${rtlWebinterface}" == "on" ]; then
|
||||||
|
echo
|
||||||
|
echo "*** LND-RTL ***"
|
||||||
|
sudo systemctl status RTL -n10 --no-pager
|
||||||
|
echo
|
||||||
|
else
|
||||||
|
echo "- LND-RTL is OFF by config"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${crtlWebinterface}" == "on" ]; then
|
||||||
|
echo
|
||||||
|
echo "*** CL-RTL ***"
|
||||||
|
sudo systemctl status cRTL -n10 --no-pager
|
||||||
|
echo
|
||||||
|
else
|
||||||
|
echo "- CL-RTL is OFF by config"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${ElectRS}" == "on" ]; then
|
||||||
|
echo
|
||||||
|
echo "*** LAST 20 ElectRS LOGS ***"
|
||||||
|
echo "sudo journalctl -u electrs -b --no-pager -n20"
|
||||||
|
sudo journalctl -u electrs -b --no-pager -n20
|
||||||
|
echo
|
||||||
|
echo "*** ElectRS Status ***"
|
||||||
|
sudo /home/admin/config.scripts/bonus.electrs.sh status
|
||||||
|
echo
|
||||||
|
else
|
||||||
|
echo "- Electrum Rust Server is OFF by config"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${lit}" == "on" ]; then
|
||||||
|
echo
|
||||||
|
echo "*** LAST 20 LIT LOGS ***"
|
||||||
|
echo "sudo journalctl -u litd -b --no-pager -n20"
|
||||||
|
sudo journalctl -u litd -b --no-pager -n20
|
||||||
|
echo
|
||||||
|
else
|
||||||
|
echo "- LIT is OFF by config"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${BTCPayServer}" == "on" ]; then
|
||||||
|
echo
|
||||||
|
echo "*** LAST 20 BTCPayServer LOGS ***"
|
||||||
|
echo "sudo journalctl -u btcpayserver -b --no-pager -n20"
|
||||||
|
sudo journalctl -u btcpayserver -b --no-pager -n20
|
||||||
|
echo
|
||||||
|
else
|
||||||
|
echo "- BTCPayServer is OFF by config"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${BTCRPCexplorer}" == "on" ]; then
|
||||||
|
echo
|
||||||
|
echo "*** LAST 20 BTC-RPC-Explorer LOGS ***"
|
||||||
|
echo "sudo journalctl -u btc-rpc-explorer -b --no-pager -n20"
|
||||||
|
sudo journalctl -u btc-rpc-explorer -b --no-pager -n20
|
||||||
|
echo
|
||||||
|
else
|
||||||
|
echo "- BTC-RPC-Explorer is OFF by config"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${LNBits}" == "on" ]; then
|
||||||
|
echo
|
||||||
|
echo "*** LAST 20 LNbits LOGS ***"
|
||||||
|
echo "sudo journalctl -u lnbits -b --no-pager -n20"
|
||||||
|
sudo journalctl -u lnbits -b --no-pager -n20
|
||||||
|
echo
|
||||||
|
else
|
||||||
|
echo "- LNbits is OFF by config"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${thunderhub}" == "on" ]; then
|
||||||
|
echo
|
||||||
|
echo "*** LAST 20 Thunderhub LOGS ***"
|
||||||
|
echo "sudo journalctl -u thunderhub -b --no-pager -n20"
|
||||||
|
sudo journalctl -u thunderhub -b --no-pager -n20
|
||||||
|
echo
|
||||||
|
else
|
||||||
|
echo "- Thunderhub is OFF by config"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${specter}" == "on" ]; then
|
||||||
|
echo
|
||||||
|
echo "*** LAST 20 SPECTER LOGS ***"
|
||||||
|
echo "sudo journalctl -u specter -b --no-pager -n20"
|
||||||
|
sudo journalctl -u specter -b --no-pager -n20
|
||||||
|
echo
|
||||||
|
else
|
||||||
|
echo "- SPECTER is OFF by config"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${sphinxrelay}" == "on" ]; then
|
||||||
|
echo
|
||||||
|
echo "*** LAST 20 SPHINX LOGS ***"
|
||||||
|
echo "sudo journalctl -u sphinxrelay -b --no-pager -n20"
|
||||||
|
sudo journalctl -u sphinxrelay -b --no-pager -n20
|
||||||
|
echo
|
||||||
|
else
|
||||||
|
echo "- SPHINX is OFF by config"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "*** MOUNTED DRIVES ***"
|
||||||
|
df -T -h
|
||||||
|
echo
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "*** DATADRIVE ***"
|
||||||
|
sudo /home/admin/config.scripts/blitz.datadrive.sh status
|
||||||
|
echo
|
||||||
|
|
||||||
|
echo "*** NETWORK ***"
|
||||||
|
sudo /home/admin/config.scripts/internet.sh status | grep 'network_device\|localip\|dhcp'
|
||||||
|
echo
|
||||||
|
|
||||||
|
echo "*** HARDWARE TEST RESULTS ***"
|
||||||
|
showImproveInfo=0
|
||||||
|
if [ ${#undervoltageReports} -gt 0 ]; then
|
||||||
|
echo "UndervoltageReports in Logs: ${undervoltageReports}"
|
||||||
|
if [ ${undervoltageReports} -gt 0 ]; then
|
||||||
|
showImproveInfo=1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
echo
|
||||||
|
|
||||||
|
echo "*** SYSTEM STATUS (can take some seconds to gather) ***"
|
||||||
|
sudo /home/admin/config.scripts/blitz.statusscan.sh
|
||||||
|
echo
|
||||||
|
|
||||||
|
echo "*** OPTION: SHARE THIS DEBUG OUTPUT ***"
|
||||||
|
echo "An easy way to share this debug output on GitHub or on a support chat"
|
||||||
|
echo "use the following command and share the resulting link:"
|
||||||
|
echo "debug | torsocks nc termbin.com 9999"
|
||||||
|
echo
|
|
@ -158,14 +158,18 @@ fi
|
||||||
|
|
||||||
echo "# COPYING from GIT-Directory to /home/admin/"
|
echo "# COPYING from GIT-Directory to /home/admin/"
|
||||||
sudo rm -r /home/admin/config.scripts
|
sudo rm -r /home/admin/config.scripts
|
||||||
sudo -u admin cp -r -f /home/admin/raspiblitz/home.admin/*.* /home/admin
|
sudo -u admin cp -r -f /home/admin/raspiblitz/home.admin/* /home/admin
|
||||||
sudo -u admin cp -r -f /home/admin/raspiblitz/home.admin/assets /home/admin
|
sudo -u admin chmod -R +x /home/admin/config.scripts
|
||||||
|
sudo -u admin chmod -R +x /home/admin/setup.scripts
|
||||||
sudo -u admin chmod +x /home/admin/*.sh
|
sudo -u admin chmod +x /home/admin/*.sh
|
||||||
sudo -u admin chmod +x /home/admin/*.py
|
|
||||||
sudo -u admin chmod +x /home/admin/config.scripts/*.sh
|
|
||||||
sudo -u admin chmod +x /home/admin/config.scripts/*.py
|
|
||||||
echo "# ******************************************"
|
echo "# ******************************************"
|
||||||
|
|
||||||
|
echo "# Syncing Webcontent .."
|
||||||
|
if [ -d /var/www/public ]; then
|
||||||
|
sudo cp -a /home/admin/assets/nginx/www_public/* /var/www/public
|
||||||
|
sudo chown www-data:www-data /var/www/public
|
||||||
|
fi
|
||||||
|
|
||||||
echo "# Checking if the content of BlitzPy changed .."
|
echo "# Checking if the content of BlitzPy changed .."
|
||||||
checkSumBlitzPyAfter=$(find /home/admin/raspiblitz/home.admin/BlitzPy -type f -exec md5sum {} \; | md5sum)
|
checkSumBlitzPyAfter=$(find /home/admin/raspiblitz/home.admin/BlitzPy -type f -exec md5sum {} \; | md5sum)
|
||||||
echo "# checkSumBlitzPyBefore = ${checkSumBlitzPyBefore}"
|
echo "# checkSumBlitzPyBefore = ${checkSumBlitzPyBefore}"
|
35
home.admin/config.scripts/blitz.hardware.sh
Normal file
35
home.admin/config.scripts/blitz.hardware.sh
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# command info
|
||||||
|
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
||||||
|
echo "Hardware Tool Script"
|
||||||
|
echo "blitz.hardware.sh [status]"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
########################
|
||||||
|
# GATHER HARDWARE INFO
|
||||||
|
#######################
|
||||||
|
|
||||||
|
# detect known SBCs
|
||||||
|
board=""
|
||||||
|
isRaspberryPi4=$(cat /proc/device-tree/model | grep -c "Raspberry Pi 4")
|
||||||
|
if [ "${isRaspberryPi4}" == "1" ]; then
|
||||||
|
board="rp4"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# get how many RAM (in MB)
|
||||||
|
ramMB=$(awk '/MemTotal/ {printf( "%d\n", $2 / 1024 )}' /proc/meminfo)
|
||||||
|
|
||||||
|
# get how many RAM (in GB - approx)
|
||||||
|
ramGB=$(awk '/MemTotal/ {printf( "%d\n", $2 / 950000 )}' /proc/meminfo)
|
||||||
|
|
||||||
|
########################
|
||||||
|
# OUTPUT HARDWARE INFO
|
||||||
|
#######################
|
||||||
|
|
||||||
|
if [ "$1" = "status" ]; then
|
||||||
|
echo "board='${board}'"
|
||||||
|
echo "ramMB=${ramMB}"
|
||||||
|
echo "ramGB=${ramGB}"
|
||||||
|
fi
|
|
@ -1,10 +1,8 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# TODO: check if services/apps are running and stop all ... or let them to outside?
|
|
||||||
|
|
||||||
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
||||||
echo "# managing the RaspiBlitz data - import, export, backup."
|
echo "# managing the RaspiBlitz data - import, export, backup."
|
||||||
echo "# blitz.migration.sh [status|export|import|export-gui|import-gui|migration-umbrel|migration-mynode]"
|
echo "# blitz.migration.sh [export|import|export-gui|migration-umbrel|migration-mynode]"
|
||||||
echo "error='missing parameters'"
|
echo "error='missing parameters'"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -22,25 +20,23 @@ fi
|
||||||
# check if data drive is mounted - other wise cannot operate
|
# check if data drive is mounted - other wise cannot operate
|
||||||
isMounted=$(sudo df | grep -c /mnt/hdd)
|
isMounted=$(sudo df | grep -c /mnt/hdd)
|
||||||
|
|
||||||
# gathering system info
|
|
||||||
isBTRFS=$(lsblk -o FSTYPE,MOUNTPOINT | grep /mnt/hdd | awk '$1=$1' | cut -d " " -f 1 | grep -c btrfs)
|
|
||||||
|
|
||||||
# set place where zipped TAR file gets stored
|
# set place where zipped TAR file gets stored
|
||||||
defaultZipPath="/mnt/hdd/temp"
|
defaultUploadPath="/mnt/hdd/temp/migration"
|
||||||
|
|
||||||
# get local ip
|
# get local ip
|
||||||
source <(/home/admin/config.scripts/internet.sh status local)
|
source <(/home/admin/config.scripts/internet.sh status local)
|
||||||
|
|
||||||
# SCP download and upload links
|
# SCP download and upload links
|
||||||
scpDownloadUnix="scp -r 'bitcoin@${localip}:${defaultZipPath}/raspiblitz-*.tar.gz' ./"
|
scpDownloadUnix="scp -r 'bitcoin@${localip}:${defaultUploadPath}/raspiblitz-*.tar.gz' ./"
|
||||||
scpDownloadWin="scp -r bitcoin@${localip}:${defaultZipPath}/raspiblitz-*.tar.gz ."
|
scpDownloadWin="scp -r bitcoin@${localip}:${defaultUploadPath}/raspiblitz-*.tar.gz ."
|
||||||
scpUploadUnix="scp -r ./raspiblitz-*.tar.gz bitcoin@${localip}:${defaultZipPath}"
|
scpUploadUnix="scp -r ./raspiblitz-*.tar.gz bitcoin@${localip}:${defaultUploadPath}"
|
||||||
scpUploadWin="scp -r ./raspiblitz-*.tar.gz bitcoin@${localip}:${defaultZipPath}"
|
scpUploadWin="scp -r ./raspiblitz-*.tar.gz bitcoin@${localip}:${defaultUploadPath}"
|
||||||
|
|
||||||
# output status data & exit
|
# output status data & exit
|
||||||
if [ "$1" = "status" ]; then
|
if [ "$1" = "status" ]; then
|
||||||
echo "# RASPIBLITZ Data Import & Export"
|
echo "# RASPIBLITZ Data Import & Export"
|
||||||
echo "isBTRFS=${isBTRFS}"
|
echo "localip=\"${localip}\""
|
||||||
|
echo "defaultUploadPath=\"${defaultUploadPath}\""
|
||||||
echo "scpDownloadUnix=\"${scpDownloadUnix}\""
|
echo "scpDownloadUnix=\"${scpDownloadUnix}\""
|
||||||
echo "scpUploadUnix=\"${scpUploadUnix}\""
|
echo "scpUploadUnix=\"${scpUploadUnix}\""
|
||||||
echo "scpDownloadWin=\"${scpDownloadWin}\""
|
echo "scpDownloadWin=\"${scpDownloadWin}\""
|
||||||
|
@ -72,6 +68,11 @@ migrate_lnd_conf () {
|
||||||
# start from fresh configuration template (user will set password B on recovery)
|
# start from fresh configuration template (user will set password B on recovery)
|
||||||
sudo cp /home/admin/assets/lnd.bitcoin.conf /mnt/hdd/lnd/lnd.conf
|
sudo cp /home/admin/assets/lnd.bitcoin.conf /mnt/hdd/lnd/lnd.conf
|
||||||
sudo sed -i "s/^alias=.*/alias=${nodename}/g" /mnt/hdd/lnd/lnd.conf
|
sudo sed -i "s/^alias=.*/alias=${nodename}/g" /mnt/hdd/lnd/lnd.conf
|
||||||
|
|
||||||
|
# make sure correct file permisions are set
|
||||||
|
sudo chown bitcoin:bitcoin /mnt/hdd/lnd/lnd.conf
|
||||||
|
sudo chmod 664 /mnt/hdd/lnd/lnd.conf
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
migrate_raspiblitz_conf () {
|
migrate_raspiblitz_conf () {
|
||||||
|
@ -93,8 +94,8 @@ migrate_raspiblitz_conf () {
|
||||||
echo "lcdrotate=1" >> /home/admin/raspiblitz.conf
|
echo "lcdrotate=1" >> /home/admin/raspiblitz.conf
|
||||||
echo "runBehindTor=on" >> /home/admin/raspiblitz.conf
|
echo "runBehindTor=on" >> /home/admin/raspiblitz.conf
|
||||||
sudo mv /home/admin/raspiblitz.conf /mnt/hdd/raspiblitz.conf
|
sudo mv /home/admin/raspiblitz.conf /mnt/hdd/raspiblitz.conf
|
||||||
sudo chown root:root /mnt/hdd/raspiblitz.conf
|
sudo chown root:sudo /mnt/hdd/raspiblitz.conf
|
||||||
sudo chmod 777 /mnt/hdd/raspiblitz.conf
|
sudo chmod 664 /mnt/hdd/raspiblitz.conf
|
||||||
|
|
||||||
# rename ext4 data drive
|
# rename ext4 data drive
|
||||||
sudo e2label /dev/sda1 BLOCKCHAIN
|
sudo e2label /dev/sda1 BLOCKCHAIN
|
||||||
|
@ -108,22 +109,10 @@ if [ "$1" = "migration-umbrel" ]; then
|
||||||
|
|
||||||
source <(sudo /home/admin/config.scripts/blitz.datadrive.sh status)
|
source <(sudo /home/admin/config.scripts/blitz.datadrive.sh status)
|
||||||
|
|
||||||
# can only migrate unmounted data disks
|
# make sure data drive is mounted
|
||||||
if [ "${isMounted}" == "1" ]; then
|
if [ "${isMounted}" != "1" ]; then
|
||||||
echo "err='cannot migrate mounted drive'"
|
source <(sudo /home/admin/config.scripts/blitz.datadrive.sh tempmount ${hddPartitionCandidate})
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check if the HDD is an umbrel data disk
|
|
||||||
if [ "${hddGotMigrationData}" == "umbrel" ]; then
|
|
||||||
echo "# found UMBREL data disk at ${hddPartitionCandidate}"
|
|
||||||
else
|
|
||||||
echo "err='not an umbrel disk'"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# temp mount the data drive
|
|
||||||
source <(sudo /home/admin/config.scripts/blitz.datadrive.sh tempmount ${hddPartitionCandidate})
|
|
||||||
if [ "${isMounted}" == "1" ]; then
|
if [ "${isMounted}" == "1" ]; then
|
||||||
echo "# mounted ${hddPartitionCandidate} to /mnt/hdd"
|
echo "# mounted ${hddPartitionCandidate} to /mnt/hdd"
|
||||||
else
|
else
|
||||||
|
@ -189,7 +178,7 @@ if [ "$1" = "migration-umbrel" ]; then
|
||||||
# call function for final migration
|
# call function for final migration
|
||||||
migrate_raspiblitz_conf ${nameNode}
|
migrate_raspiblitz_conf ${nameNode}
|
||||||
|
|
||||||
echo "# OK ... data disk converted to RaspiBlitz - reboot with fresh sd card to recover"
|
echo "# OK ... data disk converted to RaspiBlitz"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -202,22 +191,10 @@ if [ "$1" = "migration-mynode" ]; then
|
||||||
|
|
||||||
source <(sudo /home/admin/config.scripts/blitz.datadrive.sh status)
|
source <(sudo /home/admin/config.scripts/blitz.datadrive.sh status)
|
||||||
|
|
||||||
# can only migrate unmounted data disks
|
# make sure data drive is mounted
|
||||||
if [ "${isMounted}" == "1" ]; then
|
if [ "${isMounted}" != "1" ]; then
|
||||||
echo "err='cannot migrate mounted drive'"
|
source <(sudo /home/admin/config.scripts/blitz.datadrive.sh tempmount ${hddPartitionCandidate})
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check if the HDD is an umbrel data disk
|
|
||||||
if [ "${hddGotMigrationData}" == "mynode" ]; then
|
|
||||||
echo "# found MYNODE data disk at ${hddPartitionCandidate}"
|
|
||||||
else
|
|
||||||
echo "err='not an mynode disk'"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# temp mount the data drive
|
|
||||||
source <(sudo /home/admin/config.scripts/blitz.datadrive.sh tempmount ${hddPartitionCandidate})
|
|
||||||
if [ "${isMounted}" == "1" ]; then
|
if [ "${isMounted}" == "1" ]; then
|
||||||
echo "# mounted ${hddPartitionCandidate} to /mnt/hdd"
|
echo "# mounted ${hddPartitionCandidate} to /mnt/hdd"
|
||||||
else
|
else
|
||||||
|
@ -310,23 +287,24 @@ if [ "$1" = "export" ]; then
|
||||||
|
|
||||||
# zip it
|
# zip it
|
||||||
echo "# Building the Export File (this can take some time) .."
|
echo "# Building the Export File (this can take some time) .."
|
||||||
sudo tar -zcvf ${defaultZipPath}/raspiblitz-export-temp.tar.gz -X ~/.exclude.temp /mnt/hdd 1>~/.include.temp 2>/dev/null
|
sudo mkdir -p ${defaultUploadPath}
|
||||||
|
sudo tar -zcvf ${defaultUploadPath}/raspiblitz-export-temp.tar.gz -X ~/.exclude.temp /mnt/hdd 1>~/.include.temp 2>/dev/null
|
||||||
|
|
||||||
# get md5 checksum
|
# get md5 checksum
|
||||||
echo "# Building checksum (can take also a while) ..."
|
echo "# Building checksum (can take also a while) ..."
|
||||||
md5checksum=$(md5sum ${defaultZipPath}/raspiblitz-export-temp.tar.gz | head -n1 | cut -d " " -f1)
|
md5checksum=$(md5sum ${defaultUploadPath}/raspiblitz-export-temp.tar.gz | head -n1 | cut -d " " -f1)
|
||||||
echo "md5checksum=${md5checksum}"
|
echo "md5checksum=${md5checksum}"
|
||||||
|
|
||||||
# get byte size
|
# get byte size
|
||||||
bytesize=$(wc -c ${defaultZipPath}/raspiblitz-export-temp.tar.gz | cut -d " " -f 1)
|
bytesize=$(wc -c ${defaultUploadPath}/raspiblitz-export-temp.tar.gz | cut -d " " -f 1)
|
||||||
echo "bytesize=${bytesize}"
|
echo "bytesize=${bytesize}"
|
||||||
|
|
||||||
# final renaming
|
# final renaming
|
||||||
name="raspiblitz${blitzname}${datestamp}-${md5checksum}.tar.gz"
|
name="raspiblitz${blitzname}${datestamp}-${md5checksum}.tar.gz"
|
||||||
echo "exportpath='${defaultZipPath}'"
|
echo "exportpath='${defaultUploadPath}'"
|
||||||
echo "filename='${name}'"
|
echo "filename='${name}'"
|
||||||
sudo mv ${defaultZipPath}/raspiblitz-export-temp.tar.gz ${defaultZipPath}/${name}
|
sudo mv ${defaultUploadPath}/raspiblitz-export-temp.tar.gz ${defaultUploadPath}/${name}
|
||||||
sudo chown bitcoin:bitcoin ${defaultZipPath}/${name}
|
sudo chown bitcoin:bitcoin ${defaultUploadPath}/${name}
|
||||||
|
|
||||||
# delete temp files
|
# delete temp files
|
||||||
rm ~/.exclude.temp
|
rm ~/.exclude.temp
|
||||||
|
@ -341,7 +319,7 @@ fi
|
||||||
if [ "$1" = "export-gui" ]; then
|
if [ "$1" = "export-gui" ]; then
|
||||||
|
|
||||||
# cleaning old migration files from blitz
|
# cleaning old migration files from blitz
|
||||||
sudo rm ${defaultZipPath}/*.tar.gz 2>/dev/null
|
sudo rm ${defaultUploadPath}/*.tar.gz 2>/dev/null
|
||||||
|
|
||||||
# stopping lnd / bitcoin
|
# stopping lnd / bitcoin
|
||||||
echo "--> stopping services ..."
|
echo "--> stopping services ..."
|
||||||
|
@ -351,7 +329,7 @@ if [ "$1" = "export-gui" ]; then
|
||||||
# create new migration file
|
# create new migration file
|
||||||
clear
|
clear
|
||||||
echo "--> creating blitz migration file ... (please wait)"
|
echo "--> creating blitz migration file ... (please wait)"
|
||||||
source <(sudo /home/admin/config.scripts/blitz.migration.sh "export")
|
source <(sudo /home/admin/config.scripts/blitz.migration.sh export)
|
||||||
if [ ${#filename} -eq 0 ]; then
|
if [ ${#filename} -eq 0 ]; then
|
||||||
echo "# FAIL: was not able to create migration file"
|
echo "# FAIL: was not able to create migration file"
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -381,7 +359,7 @@ if [ "$1" = "export-gui" ]; then
|
||||||
read key
|
read key
|
||||||
echo "Shutting down ...."
|
echo "Shutting down ...."
|
||||||
sleep 4
|
sleep 4
|
||||||
/home/admin/XXshutdown.sh
|
/home/admin/config.scripts/blitz.shutdown.sh
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -391,71 +369,29 @@ fi
|
||||||
|
|
||||||
if [ "$1" = "import" ]; then
|
if [ "$1" = "import" ]; then
|
||||||
|
|
||||||
# check second parameter for path and/or filename of import
|
# BACKGROUND:
|
||||||
importFile="${defaultZipPath}/raspiblitz-*.tar.gz"
|
# the migration import is only called during setup phase - assume a prepared but clean HDD
|
||||||
if [ ${#2} -gt 0 ]; then
|
|
||||||
# check if and/or filename of import
|
# 2nd PARAMETER: file to import (expect that the file was valid checked from calling script)
|
||||||
containsPath=$(echo $2 | grep -c '/')
|
importFile=$2
|
||||||
if [ ${containsPath} -gt 0 ]; then
|
if [ "${importFile}" == "" ]; then
|
||||||
startsOnPath=$(echo $2 | grep -c '^/')
|
echo "error='filename missing'"
|
||||||
if [ ${startsOnPath} -eq 0 ]; then
|
|
||||||
echo "# needs to be an absolute path: ${2}"
|
|
||||||
echo "error='invalid path'"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
if [ -d "$2" ]; then
|
|
||||||
echo "# using path from parameter to search for import"
|
|
||||||
endsOnPath=$(echo $2 | grep -c '/$')
|
|
||||||
if [ ${endsOnPath} -eq 1 ]; then
|
|
||||||
importFile="${2}raspiblitz-*.tar.gz"
|
|
||||||
else
|
|
||||||
importFile="${2}/raspiblitz-*.tar.gz"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "# using path+file from parameter for import"
|
|
||||||
importFile=$2
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
# is just filename - to use with default path
|
|
||||||
echo "# using file from parameter for import"
|
|
||||||
importFile="${defaultZipPath}/${2}"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# checking if file exists and unique
|
|
||||||
echo "# checking for file with: ${importFile}"
|
|
||||||
countZips=$(sudo ls ${importFile} 2>/dev/null | grep -c '.tar.gz')
|
|
||||||
if [ ${countZips} -eq 0 ]; then
|
|
||||||
echo "# can just find file when ends on .tar.gz and exists"
|
|
||||||
echo "scpUploadUnix=\"${scpUploadUnix}\""
|
|
||||||
echo "scpUploadWin=\"${scpUploadWin}\""
|
|
||||||
echo "error='file not found'"
|
|
||||||
exit 1
|
exit 1
|
||||||
elif [ ${countZips} -eq 1 ]; then
|
fi
|
||||||
importFile=$(sudo ls ${importFile})
|
fileExists=$(sudo ls ${importFile} 2>/dev/null | grep -c "${importFile}")
|
||||||
else
|
if [ "${fileExists}" != "1" ]; then
|
||||||
echo "# Multiple files found. Not sure which to use."
|
echo "error='filename not found'"
|
||||||
echo "# Please use absolute-path+file as second parameter."
|
|
||||||
echo "error='file not unique'"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "importFile='${importFile}'"
|
echo "importFile='${importFile}'"
|
||||||
|
|
||||||
echo "# Validating Checksum (can take some time) .."
|
|
||||||
md5checksum=$(md5sum ${importFile} | head -n1 | cut -d " " -f1)
|
|
||||||
isCorrect=$(echo ${importFile} | grep -c ${md5checksum})
|
|
||||||
if [ ${isCorrect} -eq 1 ]; then
|
|
||||||
echo "# OK -> checksum looks good: ${md5checksum}"
|
|
||||||
else
|
|
||||||
echo "# FAIL -> Checksum not correct: ${md5checksum}"
|
|
||||||
echo "# Maybe transfer/upload failed?"
|
|
||||||
echo "error='bad checksum'"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "# Importing (overwrite) (can take some time) .."
|
echo "# Importing (overwrite) (can take some time) .."
|
||||||
sudo tar -xf ${importFile} -C /
|
sudo tar -xf ${importFile} -C /
|
||||||
|
if [ "$?" != "0" ]; then
|
||||||
|
echo "error='non zero exit state of unzipping migration file'"
|
||||||
|
echo "# reboot system ... HDD will offer fresh formating"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# copy bitcoin/litecoin data backups back to original places (if part of backup)
|
# copy bitcoin/litecoin data backups back to original places (if part of backup)
|
||||||
if [ -d "/mnt/hdd/backup_bitcoin" ]; then
|
if [ -d "/mnt/hdd/backup_bitcoin" ]; then
|
||||||
|
@ -475,197 +411,18 @@ if [ "$1" = "import" ]; then
|
||||||
sudo chown bitcoin:bitcoin -R /mnt/storage/litecoin 2>/dev/null
|
sudo chown bitcoin:bitcoin -R /mnt/storage/litecoin 2>/dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "# OK done - you may now want to:"
|
# check migration
|
||||||
echo "# make sure that HDD is not registered in /etc/fstab & reboot"
|
raspiblitzConfExists=$(sudo ls /mnt/hdd/raspiblitz.conf | grep -c "raspiblitz.conf")
|
||||||
echo "# to kickstart recovering system based in imported data"
|
if [ "${raspiblitzConfExists}" != "1" ]; then
|
||||||
|
echo "error='no raspiblitz.conf after unzip migration file'"
|
||||||
|
echo "# reboot system ... HDD will offer fresh formating"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# correcting all user rights on data will be done by provisioning process
|
||||||
|
echo "# OK import done - provisioning process needed"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" = "import-gui" ]; then
|
echo "error='unkown command'"
|
||||||
|
|
||||||
# get info about HDD
|
|
||||||
echo "# Gathering HDD/SSD info ..."
|
|
||||||
source <(sudo /home/admin/config.scripts/blitz.datadrive.sh status)
|
|
||||||
|
|
||||||
# make sure HDD/SSD is not mounted
|
|
||||||
# because importing migration just works during early setup
|
|
||||||
if [ ${isMounted} -eq 1 ]; then
|
|
||||||
echo "FAIL --> cannot import migration data when HDD/SSD is mounted"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# make sure a HDD/SSD is connected
|
|
||||||
if [ ${#hddCandidate} -eq 0 ]; then
|
|
||||||
echo "FAIL --> there is no HDD/SSD connected to migrate data to"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# check if HDD/SSD is big enough
|
|
||||||
if [ ${hddGigaBytes} -lt 120 ]; then
|
|
||||||
echo "FAIL --> connected HDD/SSD is too small"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# ask format for new HDD/SSD
|
|
||||||
OPTIONS=()
|
|
||||||
# check if HDD/SSD contains Bitcoin Blockchain
|
|
||||||
if [ "${hddBlocksBitcoin}" == "1" ]; then
|
|
||||||
OPTIONS+=(KEEP "Dont format & use Blockchain")
|
|
||||||
fi
|
|
||||||
OPTIONS+=(EXT4 "Ext4 & 1 Partition (default)")
|
|
||||||
OPTIONS+=(BTRFS "BTRFS & 3 Partitions (experimental)")
|
|
||||||
|
|
||||||
useBlockchain=0
|
|
||||||
hddFormat=None
|
|
||||||
CHOICE=$(whiptail --clear --title "Formatting ${hddCandidate}" --menu "" 10 52 3 "${OPTIONS[@]}" 2>&1 >/dev/tty)
|
|
||||||
clear
|
|
||||||
case $CHOICE in
|
|
||||||
EXT4)
|
|
||||||
hddFormat=ext4
|
|
||||||
echo "EXT4 FORMAT -->"
|
|
||||||
source <(sudo /home/admin/config.scripts/blitz.datadrive.sh format ext4 ${hddPartitionCandidate})
|
|
||||||
if [ ${#error} -gt 0 ]; then
|
|
||||||
echo "FAIL --> ${error}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
BTRFS)
|
|
||||||
hddFormat=btrfs
|
|
||||||
echo "BTRFS FORMAT"
|
|
||||||
source <(sudo /home/admin/config.scripts/blitz.datadrive.sh format btrfs ${hddCandidate})
|
|
||||||
if [ ${#error} -gt 0 ]; then
|
|
||||||
echo "FAIL --> ${error}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
KEEP)
|
|
||||||
echo "Keep HDD & Blockchain"
|
|
||||||
useBlockchain=1
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "CANCEL"
|
|
||||||
exit 0
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ ${useBlockchain} -eq 1 ]; then
|
|
||||||
if [ ${isBTRFS} -eq 1 ]; then
|
|
||||||
hddFormat=btrfs
|
|
||||||
else
|
|
||||||
hddFormat=ext4
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# now temp mount the HDD/SSD
|
|
||||||
if [ "$hddFormat" == "btrfs" ]; then
|
|
||||||
source <(sudo /home/admin/config.scripts/blitz.datadrive.sh tempmount ${hddCandidate})
|
|
||||||
else
|
|
||||||
source <(sudo /home/admin/config.scripts/blitz.datadrive.sh tempmount ${hddPartitionCandidate})
|
|
||||||
fi
|
|
||||||
if [ ${#error} -gt 0 ]; then
|
|
||||||
echo "FAIL: Was not able to temp mount the HDD/SSD --> ${error}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# make sure all directories are properly linked
|
|
||||||
sudo /home/admin/config.scripts/blitz.datadrive.sh link
|
|
||||||
|
|
||||||
# make sure that temp directory exists and can be written by admin
|
|
||||||
sudo mkdir -p ${defaultZipPath}
|
|
||||||
sudo chmod 777 -R ${defaultZipPath}
|
|
||||||
|
|
||||||
clear
|
|
||||||
echo
|
|
||||||
echo "*****************************"
|
|
||||||
echo "* UPLOAD THE MIGRATION FILE *"
|
|
||||||
echo "*****************************"
|
|
||||||
echo "If you have a migration file on your laptop you can now"
|
|
||||||
echo "upload it and restore on the new HDD/SSD."
|
|
||||||
echo
|
|
||||||
echo "ON YOUR LAPTOP open a new terminal and change into"
|
|
||||||
echo "the directory where your migration file is and"
|
|
||||||
echo "COPY, PASTE AND EXECUTE THE FOLLOWING COMMAND:"
|
|
||||||
echo "scp -r ./raspiblitz-*.tar.gz admin@${localip}:${defaultZipPath}"
|
|
||||||
echo ""
|
|
||||||
echo "Use password 'raspiblitz' to authenticate file transfer."
|
|
||||||
echo "PRESS ENTER when upload is done."
|
|
||||||
read key
|
|
||||||
|
|
||||||
countZips=$(sudo ls ${defaultZipPath}/raspiblitz-*.tar.gz 2>/dev/null | grep -c 'raspiblitz-')
|
|
||||||
|
|
||||||
# in case no upload found
|
|
||||||
if [ ${countZips} -eq 0 ]; then
|
|
||||||
echo
|
|
||||||
echo "FAIL: Was not able to detect uploaded file in ${defaultZipPath}"
|
|
||||||
echo "error='no file found'"
|
|
||||||
sleep 3
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# in case of multiple files
|
|
||||||
if [ ${countZips} -gt 1 ]; then
|
|
||||||
echo
|
|
||||||
echo "# FAIL: Multiple possible files detected in ${defaultZipPath}"
|
|
||||||
echo "error='multiple files'"
|
|
||||||
sleep 3
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# restore upload
|
|
||||||
echo
|
|
||||||
echo "OK: Upload found in ${defaultZipPath} - restoring data ... (please wait)"
|
|
||||||
source <(sudo /home/admin/config.scripts/blitz.migration.sh "import")
|
|
||||||
if [ ${#error} -gt 0 ]; then
|
|
||||||
echo
|
|
||||||
echo "# FAIL: Was not able to restore data"
|
|
||||||
echo "error='${error}'"
|
|
||||||
sleep 3
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# check & load config
|
|
||||||
source /mnt/hdd/raspiblitz.conf
|
|
||||||
if [ ${#network} -eq 0 ]; then
|
|
||||||
echo
|
|
||||||
echo "FAIL: No raspiblitz.conf found after migration restore"
|
|
||||||
echo "error='migration contains no raspiblitz.conf'"
|
|
||||||
sleep 3
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo "OK: Migration data was imported"
|
|
||||||
echo "PRESS ENTER"
|
|
||||||
read key
|
|
||||||
|
|
||||||
# Copy from other computer is only option for Bitcoin
|
|
||||||
if [ "${network}" == "bitcoin" ] && [ ${useBlockchain} -eq 0 ]; then
|
|
||||||
OPTIONS=(SYNC "Re-Sync & Validate Blockchain" \
|
|
||||||
COPY "Copy over LAN from other Computer"
|
|
||||||
)
|
|
||||||
CHOICE=$(whiptail --clear --title "How to get Blockchain?" --menu "" 9 52 2 "${OPTIONS[@]}" 2>&1 >/dev/tty)
|
|
||||||
clear
|
|
||||||
case $CHOICE in
|
|
||||||
COPY)
|
|
||||||
echo "Copy Blockchain Data -->"
|
|
||||||
/home/admin/50copyHDD.sh stop-after-script
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
# if there is no blockchain yet - fallback to syncing
|
|
||||||
if [ $(sudo ls /mnt/hdd/bitcoin/ 2>/dev/null | grep -c blocks) -eq 0 ]; then
|
|
||||||
echo "Setting Blockchain Data to resync ..."
|
|
||||||
sudo -u bitcoin mkdir /mnt/hdd/${network}/blocks 2>/dev/null
|
|
||||||
sudo -u bitcoin mkdir /mnt/hdd/${network}/chainstate 2>/dev/null
|
|
||||||
sudo -u bitcoin touch /mnt/hdd/${network}/blocks/.selfsync
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "--> Now rebooting and kicking your node in to recovery/update mode ..."
|
|
||||||
sudo shutdown -r now
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "error='unknown command'"
|
|
||||||
exit 1
|
exit 1
|
||||||
|
|
63
home.admin/config.scripts/blitz.mnemonic.py
Executable file
63
home.admin/config.scripts/blitz.mnemonic.py
Executable file
|
@ -0,0 +1,63 @@
|
||||||
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
import sys
|
||||||
|
from mnemonic import Mnemonic
|
||||||
|
|
||||||
|
# display config script info
|
||||||
|
if len(sys.argv) <= 1 or sys.argv[1] == "-h" or sys.argv[1] == "help":
|
||||||
|
print("tool for seed words")
|
||||||
|
print("blitz.mnemonic.py generate")
|
||||||
|
print("blitz.mnemonic.py test \"[SEEDWORDS-SPACE-SEPERATED]\"")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
def dump(obj):
|
||||||
|
for attr in dir(obj):
|
||||||
|
print("obj.%s = %r" % (attr, getattr(obj, attr)))
|
||||||
|
|
||||||
|
#######################
|
||||||
|
# GENERATE SEED WORDS
|
||||||
|
#######################
|
||||||
|
def generate():
|
||||||
|
|
||||||
|
mnemo = Mnemonic("english")
|
||||||
|
seedwords = mnemo.generate(strength=256)
|
||||||
|
|
||||||
|
print("seedwords='" + seedwords + "'")
|
||||||
|
|
||||||
|
# add a 6x4 formatted version to the output
|
||||||
|
wordlist = list(seedwords.split(" "))
|
||||||
|
seed_words_6x4 = ""
|
||||||
|
for i in range(0, len(wordlist)):
|
||||||
|
if i % 6 == 0 and i != 0:
|
||||||
|
seed_words_6x4 = seed_words_6x4 + "\n"
|
||||||
|
single_word = str(i + 1) + ":" + wordlist[i]
|
||||||
|
while len(single_word) < 12:
|
||||||
|
single_word = single_word + " "
|
||||||
|
seed_words_6x4 = seed_words_6x4 + single_word
|
||||||
|
print("seedwords6x4='" + seed_words_6x4 + "'")
|
||||||
|
|
||||||
|
|
||||||
|
#######################
|
||||||
|
# TEST SEED WORDS
|
||||||
|
#######################
|
||||||
|
def test(words):
|
||||||
|
|
||||||
|
mnemo = Mnemonic("english")
|
||||||
|
if mnemo.check(words):
|
||||||
|
print("valid=1")
|
||||||
|
else:
|
||||||
|
print("valid=0")
|
||||||
|
|
||||||
|
def main():
|
||||||
|
if sys.argv[1] == "generate":
|
||||||
|
generate()
|
||||||
|
|
||||||
|
elif sys.argv[1] == "test":
|
||||||
|
test(sys.argv[2])
|
||||||
|
|
||||||
|
else:
|
||||||
|
# UNKNOWN PARAMETER
|
||||||
|
print("error='unknown parameter'")
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
|
@ -79,33 +79,33 @@ source /mnt/hdd/raspiblitz.conf 2>/dev/null
|
||||||
if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
||||||
echo "switching the NOTIFY ON"
|
echo "switching the NOTIFY ON"
|
||||||
|
|
||||||
# install sstmp if not already present
|
# install mstmp if not already present
|
||||||
if ! command -v ssmtp >/dev/null; then
|
if ! command -v msmtp >/dev/null; then
|
||||||
[ -z "$(find -H /var/lib/apt/lists -maxdepth 0 -mtime -7)" ] && sudo apt-get update
|
[ -z "$(find -H /var/lib/apt/lists -maxdepth 0 -mtime -7)" ] && sudo apt-get update
|
||||||
sudo apt-get install -y ssmtp
|
sudo apt-get install -y msmtp
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# install python lib for smime into virtual env
|
# install python lib for smime into virtual env
|
||||||
sudo -H /usr/bin/python3 -m pip install smime
|
sudo -H /usr/bin/python3 -m pip install smime
|
||||||
|
|
||||||
# write ssmtp config
|
# write ssmtp config
|
||||||
cat << EOF | sudo tee /etc/ssmtp/ssmtp.conf >/dev/null
|
cat << EOF | sudo tee /etc/msmtprc >/dev/null
|
||||||
#
|
# Set default values for all following accounts.
|
||||||
# Config file for sSMTP sendmail
|
defaults
|
||||||
#
|
port 587
|
||||||
# The person who gets all mail for userids < 1000
|
tls on
|
||||||
# Make this empty to disable rewriting.
|
tls_trust_file /etc/ssl/certs/ca-certificates.crt
|
||||||
Root=${notifyMailTo}
|
|
||||||
|
|
||||||
# hostname of this system
|
account mail
|
||||||
Hostname=${notifyMailHostname}
|
host ${notifyMailServer}
|
||||||
|
from ${notifyMailFromAddress}
|
||||||
|
auth on
|
||||||
|
user ${notifyMailUser}
|
||||||
|
password ${notifyMailPass}
|
||||||
|
|
||||||
|
# Set a default account
|
||||||
|
account default : mail
|
||||||
|
|
||||||
# relay/smarthost server settings
|
|
||||||
Mailhub=${notifyMailServer}
|
|
||||||
AuthUser=${notifyMailUser}
|
|
||||||
AuthPass=${notifyMailPass}
|
|
||||||
UseSTARTTLS=YES
|
|
||||||
FromLineOverride=YES
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# edit raspi blitz config
|
# edit raspi blitz config
|
||||||
|
@ -137,22 +137,22 @@ if [ "$1" = "send" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! command -v ssmtp >/dev/null; then
|
if ! command -v msmtp >/dev/null; then
|
||||||
echo "please run \"on\" first"
|
echo "please run \"on\" first"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# now parse settings from config and use to send the message
|
# now parse settings from config and use to send the message
|
||||||
if [ "${notifyMethod}" = "ext" ]; then
|
if [ "${notifyMethod}" = "ext" ]; then
|
||||||
/usr/bin/python3 /home/admin/XXsendNotification.py ext ${notifyExtCmd} "$2"
|
/usr/bin/python3 /home/admin/config.scripts/blitz.sendnotification.py ext ${notifyExtCmd} "$2"
|
||||||
elif [ "${notifyMethod}" = "mail" ]; then
|
elif [ "${notifyMethod}" = "mail" ]; then
|
||||||
if [ "${notifyMailEncrypt}" = "on" ]; then
|
if [ "${notifyMailEncrypt}" = "on" ]; then
|
||||||
/usr/bin/python3 /home/admin/XXsendNotification.py mail --from-address "${notifyMailFromAddress}" --from-name "${notifyMailFromName}" --cert "${notifyMailToCert}" --encrypt ${notifyMailTo} "${@:3}" "$2"
|
/usr/bin/python3 /home/admin/config.scripts/blitz.sendnotification.py mail --from-address "${notifyMailFromAddress}" --from-name "${notifyMailFromName}" --cert "${notifyMailToCert}" --encrypt ${notifyMailTo} "${@:3}" "$2"
|
||||||
else
|
else
|
||||||
/usr/bin/python3 /home/admin/XXsendNotification.py mail --from-address "${notifyMailFromAddress}" --from-name "${notifyMailFromName}" "${notifyMailTo}" "${@:3}" "$2"
|
/usr/bin/python3 /home/admin/config.scripts/blitz.sendnotification.py mail --from-address "${notifyMailFromAddress}" --from-name "${notifyMailFromName}" "${notifyMailTo}" "${@:3}" "$2"
|
||||||
fi
|
fi
|
||||||
elif [ "${notifyMethod}" = "slack" ]; then
|
elif [ "${notifyMethod}" = "slack" ]; then
|
||||||
/usr/bin/python3 /home/admin/XXsendNotification.py slack -h "$2"
|
/usr/bin/python3 /home/admin/config.scripts/blitz.sendnotification.py slack -h "$2"
|
||||||
else
|
else
|
||||||
echo "unknown notification method - check /mnt/hdd/raspiblitz.conf"
|
echo "unknown notification method - check /mnt/hdd/raspiblitz.conf"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -3,7 +3,18 @@
|
||||||
# Just run this script once after a fresh sd card build
|
# Just run this script once after a fresh sd card build
|
||||||
# to prepare the image for release as a downloadable sd card image
|
# to prepare the image for release as a downloadable sd card image
|
||||||
|
|
||||||
|
# raspiblitz.info & logs
|
||||||
|
echo "cleaning raspiblitz info .."
|
||||||
|
source /home/admin/raspiblitz.info
|
||||||
|
echo "baseimage=${baseimage}" > /home/admin/raspiblitz.info
|
||||||
|
echo "cpu=${cpu}" >> /home/admin/raspiblitz.info
|
||||||
|
echo "displayClass=${displayClass}" >> /home/admin/raspiblitz.info
|
||||||
|
echo "deleting raspiblitz logs .."
|
||||||
|
sudo rm /home/admin/*.log
|
||||||
|
echo "OK"
|
||||||
|
|
||||||
# SSH Pubkeys (make unique for every sd card image install)
|
# SSH Pubkeys (make unique for every sd card image install)
|
||||||
|
echo ""
|
||||||
echo "deleting SSH Pub keys ..."
|
echo "deleting SSH Pub keys ..."
|
||||||
echo "they will get recreated on fresh bootup, by _bootstrap.sh service"
|
echo "they will get recreated on fresh bootup, by _bootstrap.sh service"
|
||||||
sudo rm /etc/ssh/ssh_host_*
|
sudo rm /etc/ssh/ssh_host_*
|
|
@ -11,7 +11,7 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
raise ImportError("Please install missing package: python3 -m pip install smime")
|
raise ImportError("Please install missing package: python3 -m pip install smime")
|
||||||
|
|
||||||
SSMTP_BIN = "/usr/sbin/ssmtp"
|
SMTP_BIN = "/usr/bin/msmtp"
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
@ -107,7 +107,7 @@ def mail(recipient: str = None, message: str = None, subject: str = None, cert:
|
||||||
'From: {} <{}>'.format(from_name, from_address),
|
'From: {} <{}>'.format(from_name, from_address),
|
||||||
"Subject: {}".format(subject),
|
"Subject: {}".format(subject),
|
||||||
"",
|
"",
|
||||||
"{}".format(message.encode('utf8'))
|
"{}".format(message)
|
||||||
]
|
]
|
||||||
|
|
||||||
with open(cert, 'rb') as pem:
|
with open(cert, 'rb') as pem:
|
||||||
|
@ -126,11 +126,11 @@ def mail(recipient: str = None, message: str = None, subject: str = None, cert:
|
||||||
msg_to_send = msg.as_bytes()
|
msg_to_send = msg.as_bytes()
|
||||||
|
|
||||||
# send message via e-Mail
|
# send message via e-Mail
|
||||||
if not os.path.exists(SSMTP_BIN):
|
if not os.path.exists(SMTP_BIN):
|
||||||
raise Exception("File not found: {}".format(SSMTP_BIN))
|
raise Exception("File not found: {}".format(SMTP_BIN))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
cmd = [SSMTP_BIN, recipient]
|
cmd = [SMTP_BIN, recipient]
|
||||||
subprocess.run(cmd, input=msg_to_send, stderr=subprocess.STDOUT)
|
subprocess.run(cmd, input=msg_to_send, stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
except subprocess.CalledProcessError as err:
|
except subprocess.CalledProcessError as err:
|
|
@ -11,12 +11,12 @@ else
|
||||||
echo "Opening $EDITFILE"
|
echo "Opening $EDITFILE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# trap to delete on any exit
|
||||||
|
trap 'rm -f $conf' EXIT
|
||||||
|
|
||||||
# temp conf
|
# temp conf
|
||||||
conf=$(mktemp -p /dev/shm/)
|
conf=$(mktemp -p /dev/shm/)
|
||||||
|
|
||||||
# trap it
|
|
||||||
trap 'rm -f $conf' 0 1 2 5 15
|
|
||||||
|
|
||||||
dialog \
|
dialog \
|
||||||
--title "Editing the $EDITFILE" \
|
--title "Editing the $EDITFILE" \
|
||||||
--editbox "$EDITFILE" 200 200 2> "$conf"
|
--editbox "$EDITFILE" 200 200 2> "$conf"
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
if [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
if [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
||||||
echo "small config script to set a passwords A,B,C & D"
|
echo "small config script to set a passwords A,B,C & D"
|
||||||
echo "blitz.setpassword.sh a [?newpassword] "
|
echo "blitz.setpassword.sh a [?newpassword] "
|
||||||
echo "blitz.setpassword.sh b [?newpassword] "
|
echo "blitz.setpassword.sh b [?newpassword] "
|
||||||
echo "blitz.setpassword.sh c [?oldpassword] [?newpassword] "
|
echo "blitz.setpassword.sh c [?oldpassword] [?newpassword] "
|
||||||
echo "or just as a password enter dialog (result as file)"
|
echo "or just as a password enter dialog (result as file)"
|
||||||
echo "blitz.setpassword.sh [x] [text] [result-file] [?empty-allowed]"
|
echo "blitz.setpassword.sh [x] [text] [result-file] [?empty-allowed]"
|
||||||
|
@ -17,6 +17,9 @@ if [ "$EUID" -ne 0 ]
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# trap to delete on any exit
|
||||||
|
trap 'rm -f $_temp' EXIT
|
||||||
|
|
||||||
# tempfile
|
# tempfile
|
||||||
_temp=$(mktemp -p /dev/shm/)
|
_temp=$(mktemp -p /dev/shm/)
|
||||||
|
|
||||||
|
@ -39,9 +42,14 @@ OPTIONS=()
|
||||||
if [ ${#abcd} -eq 0 ]; then
|
if [ ${#abcd} -eq 0 ]; then
|
||||||
reboot=1;
|
reboot=1;
|
||||||
emptyAllowed=1
|
emptyAllowed=1
|
||||||
OPTIONS+=(A "Master User Password / SSH")
|
OPTIONS+=(A "Master Login Password")
|
||||||
OPTIONS+=(B "RPC Password (blockchain/lnd)")
|
OPTIONS+=(B "RPC/App Password")
|
||||||
OPTIONS+=(C "LND Wallet Password")
|
if [ "${lightning}" == "lnd" ] || [ "${lnd}" == "on" ]; then
|
||||||
|
OPTIONS+=(C "LND Lightning Wallet Password")
|
||||||
|
fi
|
||||||
|
if [ "${cl}" == "on" ] && [ "${clEncryptedHSM}" == "on" ]; then
|
||||||
|
OPTIONS+=(CL "C-Lightning Wallet Password")
|
||||||
|
fi
|
||||||
CHOICE=$(dialog --clear \
|
CHOICE=$(dialog --clear \
|
||||||
--backtitle "RaspiBlitz" \
|
--backtitle "RaspiBlitz" \
|
||||||
--title "Set Password" \
|
--title "Set Password" \
|
||||||
|
@ -63,15 +71,15 @@ if [ ${#abcd} -eq 0 ]; then
|
||||||
D)
|
D)
|
||||||
abcd='d';
|
abcd='d';
|
||||||
;;
|
;;
|
||||||
|
CL)
|
||||||
|
abcd='cl';
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
exit 1
|
exit 0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Changing Password ${abcd} ..."
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
############################
|
############################
|
||||||
# PASSWORD A
|
# PASSWORD A
|
||||||
if [ "${abcd}" = "a" ]; then
|
if [ "${abcd}" = "a" ]; then
|
||||||
|
@ -89,7 +97,7 @@ if [ "${abcd}" = "a" ]; then
|
||||||
echo "CANCEL not possible"
|
echo "CANCEL not possible"
|
||||||
sleep 2
|
sleep 2
|
||||||
else
|
else
|
||||||
exit 1
|
exit 0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -100,7 +108,7 @@ if [ "${abcd}" = "a" ]; then
|
||||||
echo "CANCEL not possible"
|
echo "CANCEL not possible"
|
||||||
sleep 2
|
sleep 2
|
||||||
else
|
else
|
||||||
exit 1
|
exit 0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -108,14 +116,14 @@ if [ "${abcd}" = "a" ]; then
|
||||||
if [ "${password1}" != "${password2}" ]; then
|
if [ "${password1}" != "${password2}" ]; then
|
||||||
dialog --backtitle "RaspiBlitz - Setup" --msgbox "FAIL -> Passwords dont Match\nPlease try again ..." 6 52
|
dialog --backtitle "RaspiBlitz - Setup" --msgbox "FAIL -> Passwords dont Match\nPlease try again ..." 6 52
|
||||||
sudo /home/admin/config.scripts/blitz.setpassword.sh a
|
sudo /home/admin/config.scripts/blitz.setpassword.sh a
|
||||||
exit 1
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# password zero
|
# password zero
|
||||||
if [ ${#password1} -eq 0 ]; then
|
if [ ${#password1} -eq 0 ]; then
|
||||||
dialog --backtitle "RaspiBlitz - Setup" --msgbox "FAIL -> Password cannot be empty\nPlease try again ..." 6 52
|
dialog --backtitle "RaspiBlitz - Setup" --msgbox "FAIL -> Password cannot be empty\nPlease try again ..." 6 52
|
||||||
sudo /home/admin/config.scripts/blitz.setpassword.sh a
|
sudo /home/admin/config.scripts/blitz.setpassword.sh a
|
||||||
exit 1
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check that password does not contain bad characters
|
# check that password does not contain bad characters
|
||||||
|
@ -123,14 +131,14 @@ if [ "${abcd}" = "a" ]; then
|
||||||
if [ ${#clearedResult} != ${#password1} ] || [ ${#clearedResult} -eq 0 ]; then
|
if [ ${#clearedResult} != ${#password1} ] || [ ${#clearedResult} -eq 0 ]; then
|
||||||
dialog --backtitle "RaspiBlitz - Setup" --msgbox "FAIL -> Contains bad characters (spaces, special chars)\nPlease try again ..." 6 52
|
dialog --backtitle "RaspiBlitz - Setup" --msgbox "FAIL -> Contains bad characters (spaces, special chars)\nPlease try again ..." 6 52
|
||||||
sudo /home/admin/config.scripts/blitz.setpassword.sh a
|
sudo /home/admin/config.scripts/blitz.setpassword.sh a
|
||||||
exit 1
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# password longer than 8
|
# password longer than 8
|
||||||
if [ ${#password1} -lt 8 ]; then
|
if [ ${#password1} -lt 8 ]; then
|
||||||
dialog --backtitle "RaspiBlitz - Setup" --msgbox "FAIL -> Password length under 8\nPlease try again ..." 6 52
|
dialog --backtitle "RaspiBlitz - Setup" --msgbox "FAIL -> Password length under 8\nPlease try again ..." 6 52
|
||||||
sudo /home/admin/config.scripts/blitz.setpassword.sh a
|
sudo /home/admin/config.scripts/blitz.setpassword.sh a
|
||||||
exit 1
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# use entered password now as parameter
|
# use entered password now as parameter
|
||||||
|
@ -165,7 +173,7 @@ elif [ "${abcd}" = "b" ]; then
|
||||||
echo "CANCEL not possible"
|
echo "CANCEL not possible"
|
||||||
sleep 2
|
sleep 2
|
||||||
else
|
else
|
||||||
exit 1
|
exit 0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -176,7 +184,7 @@ elif [ "${abcd}" = "b" ]; then
|
||||||
echo "CANCEL not possible"
|
echo "CANCEL not possible"
|
||||||
sleep 2
|
sleep 2
|
||||||
else
|
else
|
||||||
exit 1
|
exit 0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -184,14 +192,14 @@ elif [ "${abcd}" = "b" ]; then
|
||||||
if [ "${password1}" != "${password2}" ]; then
|
if [ "${password1}" != "${password2}" ]; then
|
||||||
dialog --backtitle "RaspiBlitz - Setup" --msgbox "FAIL -> Passwords dont Match\nPlease try again ..." 6 52
|
dialog --backtitle "RaspiBlitz - Setup" --msgbox "FAIL -> Passwords dont Match\nPlease try again ..." 6 52
|
||||||
sudo /home/admin/config.scripts/blitz.setpassword.sh b
|
sudo /home/admin/config.scripts/blitz.setpassword.sh b
|
||||||
exit 1
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# password zero
|
# password zero
|
||||||
if [ ${#password1} -eq 0 ]; then
|
if [ ${#password1} -eq 0 ]; then
|
||||||
dialog --backtitle "RaspiBlitz - Setup" --msgbox "FAIL -> Password cannot be empty\nPlease try again ..." 6 52
|
dialog --backtitle "RaspiBlitz - Setup" --msgbox "FAIL -> Password cannot be empty\nPlease try again ..." 6 52
|
||||||
sudo /home/admin/config.scripts/blitz.setpassword.sh b
|
sudo /home/admin/config.scripts/blitz.setpassword.sh b
|
||||||
exit 1
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check that password does not contain bad characters
|
# check that password does not contain bad characters
|
||||||
|
@ -199,14 +207,14 @@ elif [ "${abcd}" = "b" ]; then
|
||||||
if [ ${#clearedResult} != ${#password1} ] || [ ${#clearedResult} -eq 0 ]; then
|
if [ ${#clearedResult} != ${#password1} ] || [ ${#clearedResult} -eq 0 ]; then
|
||||||
dialog --backtitle "RaspiBlitz - Setup" --msgbox "FAIL -> Contains bad characters (spaces, special chars)\nPlease try again ..." 6 52
|
dialog --backtitle "RaspiBlitz - Setup" --msgbox "FAIL -> Contains bad characters (spaces, special chars)\nPlease try again ..." 6 52
|
||||||
sudo /home/admin/config.scripts/blitz.setpassword.sh b
|
sudo /home/admin/config.scripts/blitz.setpassword.sh b
|
||||||
exit 1
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# password longer than 8
|
# password longer than 8
|
||||||
if [ ${#password1} -lt 8 ]; then
|
if [ ${#password1} -lt 8 ]; then
|
||||||
dialog --backtitle "RaspiBlitz - Setup" --msgbox "FAIL -> Password length under 8\nPlease try again ..." 6 52
|
dialog --backtitle "RaspiBlitz - Setup" --msgbox "FAIL -> Password length under 8\nPlease try again ..." 6 52
|
||||||
sudo /home/admin/config.scripts/blitz.setpassword.sh b
|
sudo /home/admin/config.scripts/blitz.setpassword.sh b
|
||||||
exit 1
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# use entered password now as parameter
|
# use entered password now as parameter
|
||||||
|
@ -333,7 +341,7 @@ elif [ "${abcd}" = "c" ]; then
|
||||||
if [ ${#newPassword} -lt 8 ]; then
|
if [ ${#newPassword} -lt 8 ]; then
|
||||||
dialog --backtitle "RaspiBlitz - Setup" --msgbox "FAIL -> Password length under 8" 6 52
|
dialog --backtitle "RaspiBlitz - Setup" --msgbox "FAIL -> Password length under 8" 6 52
|
||||||
sudo /home/admin/config.scripts/blitz.setpassword.sh c ${oldPassword}
|
sudo /home/admin/config.scripts/blitz.setpassword.sh c ${oldPassword}
|
||||||
exit 1
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ask user to retype new password c
|
# ask user to retype new password c
|
||||||
|
@ -363,27 +371,14 @@ elif [ "${abcd}" = "c" ]; then
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
err=""
|
err=""
|
||||||
source <(sudo /home/admin/config.scripts/lnd.initwallet.py change-password $oldPassword $newPassword)
|
source <(sudo /home/admin/config.scripts/lnd.initwallet.py change-password mainnet $oldPassword $newPassword)
|
||||||
if [ "${err}" != "" ]; then
|
if [ "${err}" != "" ]; then
|
||||||
dialog --backtitle "RaspiBlitz - Setup" --msgbox "FAIL -> Was not able to change password\n\n${err}\n${errMore}" 10 52
|
dialog --backtitle "RaspiBlitz - Setup" --msgbox "FAIL -> Was not able to change password\n\n${err}\n${errMore}" 10 52
|
||||||
clear
|
clear
|
||||||
echo "# FAIL: Was not able to change password"
|
echo "# FAIL: Was not able to change password"
|
||||||
exit 1
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# old manual way
|
|
||||||
# clear
|
|
||||||
# echo ""
|
|
||||||
# echo "****************************************************************************"
|
|
||||||
# echo "Change LND Wallet Password --> lncli --chain=${network} --network=${chain}net changepassword"
|
|
||||||
# echo "****************************************************************************"
|
|
||||||
# echo "This is your Password C on the RaspiBlitz to unlock your LND wallet."
|
|
||||||
# echo "If you had Auto-Unlock active - you need to re-activate after this."
|
|
||||||
# echo "****************************************************************************"
|
|
||||||
# sleep 6
|
|
||||||
# let LND-CLI handle the password change
|
|
||||||
# sudo -u bitcoin lncli --chain=${network} --network=${chain}net changepassword
|
|
||||||
|
|
||||||
# final user output
|
# final user output
|
||||||
echo ""
|
echo ""
|
||||||
echo "OK"
|
echo "OK"
|
||||||
|
@ -415,7 +410,7 @@ elif [ "${abcd}" = "x" ]; then
|
||||||
if [ "${password1}" != "${password2}" ]; then
|
if [ "${password1}" != "${password2}" ]; then
|
||||||
dialog --backtitle "RaspiBlitz" --msgbox "FAIL -> Passwords dont Match\nPlease try again ..." 6 52
|
dialog --backtitle "RaspiBlitz" --msgbox "FAIL -> Passwords dont Match\nPlease try again ..." 6 52
|
||||||
sudo /home/admin/config.scripts/blitz.setpassword.sh x "$2" "$3" "$4"
|
sudo /home/admin/config.scripts/blitz.setpassword.sh x "$2" "$3" "$4"
|
||||||
exit 1
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ${emptyAllowed} -eq 0 ]; then
|
if [ ${emptyAllowed} -eq 0 ]; then
|
||||||
|
@ -424,7 +419,7 @@ elif [ "${abcd}" = "x" ]; then
|
||||||
if [ ${#password1} -eq 0 ]; then
|
if [ ${#password1} -eq 0 ]; then
|
||||||
dialog --backtitle "RaspiBlitz" --msgbox "FAIL -> Password cannot be empty\nPlease try again ..." 6 52
|
dialog --backtitle "RaspiBlitz" --msgbox "FAIL -> Password cannot be empty\nPlease try again ..." 6 52
|
||||||
sudo /home/admin/config.scripts/blitz.setpassword.sh x "$2" "$3" "$4"
|
sudo /home/admin/config.scripts/blitz.setpassword.sh x "$2" "$3" "$4"
|
||||||
exit 1
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check that password does not contain bad characters
|
# check that password does not contain bad characters
|
||||||
|
@ -432,31 +427,36 @@ elif [ "${abcd}" = "x" ]; then
|
||||||
if [ ${#clearedResult} != ${#password1} ] || [ ${#clearedResult} -eq 0 ]; then
|
if [ ${#clearedResult} != ${#password1} ] || [ ${#clearedResult} -eq 0 ]; then
|
||||||
dialog --backtitle "RaspiBlitz" --msgbox "FAIL -> Contains bad characters (spaces, special chars)\nPlease try again ..." 6 62
|
dialog --backtitle "RaspiBlitz" --msgbox "FAIL -> Contains bad characters (spaces, special chars)\nPlease try again ..." 6 62
|
||||||
sudo /home/admin/config.scripts/blitz.setpassword.sh x "$2" "$3" "$4"
|
sudo /home/admin/config.scripts/blitz.setpassword.sh x "$2" "$3" "$4"
|
||||||
exit 1
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# password longer than 8
|
# password longer than 8
|
||||||
if [ ${#password1} -lt 8 ]; then
|
if [ ${#password1} -lt 8 ]; then
|
||||||
dialog --backtitle "RaspiBlitz" --msgbox "FAIL -> Password length under 8\nPlease try again ..." 6 52
|
dialog --backtitle "RaspiBlitz" --msgbox "FAIL -> Password length under 8\nPlease try again ..." 6 52
|
||||||
sudo /home/admin/config.scripts/blitz.setpassword.sh x "$2" "$3" "$4"
|
sudo /home/admin/config.scripts/blitz.setpassword.sh x "$2" "$3" "$4"
|
||||||
exit 1
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# store result is file
|
# store result is file
|
||||||
echo "${password1}" > ${resultFile}
|
echo "${password1}" > ${resultFile}
|
||||||
|
|
||||||
|
elif [ "${abcd}" = "cl" ]; then
|
||||||
|
/home/admin/config.scripts/cl.hsmtool.sh change-password mainnet
|
||||||
|
# do not reboot for cl password
|
||||||
|
reboot=0
|
||||||
|
|
||||||
# everything else
|
# everything else
|
||||||
else
|
else
|
||||||
echo "FAIL: there is no password '${abcd}' (reminder: use lower case)"
|
echo "FAIL: there is no password '${abcd}' (reminder: use lower case)"
|
||||||
exit 1
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# when started with menu ... reboot when done
|
# when started with menu ... reboot when done
|
||||||
if [ "${reboot}" == "1" ]; then
|
if [ "${reboot}" == "1" ]; then
|
||||||
echo "Now rebooting to activate changes ..."
|
echo "Now rebooting to activate changes ..."
|
||||||
sudo /home/admin/XXshutdown.sh reboot
|
sudo /home/admin/config.scripts/blitz.shutdown.sh reboot
|
||||||
else
|
else
|
||||||
echo "..."
|
echo "..."
|
||||||
fi
|
fi
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue