mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-09-25 11:13:12 +02:00
apply bitcoin and lncli aliases in all scripts
This commit is contained in:
@@ -158,8 +158,11 @@ if [ "${chain}" != "${choice}" ]; then
|
|||||||
echo "B) Answer 'n' because you don't have a 'cipher seed mnemonic' (24 words) yet"
|
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 "C) For 'passphrase' to encrypt your 'cipher seed' use PASSWORD D (optional)"
|
||||||
echo "****************************************************************************"
|
echo "****************************************************************************"
|
||||||
sudo -u bitcoin /usr/local/bin/lncli --chain=${network} --network=${chain}net create 2>error.out
|
source <(/home/admin/config.scripts/network.aliases.sh getvars lnd ${choice}net)
|
||||||
error=`sudo cat error.out`
|
shopt -s expand_aliases
|
||||||
|
alias lncli_alias="$lncli_alias"
|
||||||
|
lncli_alias create 2>error.out
|
||||||
|
error=$(sudo cat error.out)
|
||||||
if [ ${#error} -eq 0 ]; then
|
if [ ${#error} -eq 0 ]; then
|
||||||
sleep 2
|
sleep 2
|
||||||
# WIN
|
# WIN
|
||||||
|
@@ -50,6 +50,11 @@ fi
|
|||||||
lndRunning=$(systemctl status lnd.service 2>/dev/null | grep -c running)
|
lndRunning=$(systemctl status lnd.service 2>/dev/null | grep -c running)
|
||||||
if [ ${lndRunning} -eq 1 ]; then
|
if [ ${lndRunning} -eq 1 ]; then
|
||||||
|
|
||||||
|
source <(/home/admin/config.scripts/network.aliases.sh getvars lnd)
|
||||||
|
shopt -s expand_aliases
|
||||||
|
alias bitcoincli_alias="$bitcoincli_alias"
|
||||||
|
alias lncli_alias="$lncli_alias"
|
||||||
|
|
||||||
echo "LND is running ..."
|
echo "LND is running ..."
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
@@ -60,7 +65,7 @@ if [ ${lndRunning} -eq 1 ]; then
|
|||||||
if [ ${walletExists} -eq 1 ];then
|
if [ ${walletExists} -eq 1 ];then
|
||||||
echo "lnd wallet exists ... checking if locked"
|
echo "lnd wallet exists ... checking if locked"
|
||||||
sleep 2
|
sleep 2
|
||||||
walletLocked=$(sudo -u bitcoin /usr/local/bin/lncli getinfo 2>&1 | grep -c unlock)
|
walletLocked=$($lncli_alias getinfo 2>&1 | grep -c unlock)
|
||||||
fi
|
fi
|
||||||
if [ ${walletLocked} -gt 0 ]; then
|
if [ ${walletLocked} -gt 0 ]; then
|
||||||
# LND wallet is locked
|
# LND wallet is locked
|
||||||
@@ -70,7 +75,7 @@ if [ ${lndRunning} -eq 1 ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# check if blockchain still syncing (during sync sometimes CLI returns with error at this point)
|
# 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')
|
chainInfo=$($bitcoincli_alias getblockchaininfo 2>/dev/null | grep 'initialblockdownload')
|
||||||
chainSyncing=1
|
chainSyncing=1
|
||||||
if [ ${#chainInfo} -gt 0 ];then
|
if [ ${#chainInfo} -gt 0 ];then
|
||||||
echo "check chaininfo"
|
echo "check chaininfo"
|
||||||
@@ -86,7 +91,7 @@ if [ ${lndRunning} -eq 1 ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# check if lnd is scanning blockchain
|
# check if lnd is scanning blockchain
|
||||||
lndInfo=$(sudo -u bitcoin /usr/local/bin/lncli --chain=${network} getinfo 2>/dev/null | grep "synced_to_chain")
|
lndInfo=$($lncli_alias --chain=${network} getinfo 2>/dev/null | grep "synced_to_chain")
|
||||||
lndSyncing=1
|
lndSyncing=1
|
||||||
if [ ${#lndInfo} -gt 0 ];then
|
if [ ${#lndInfo} -gt 0 ];then
|
||||||
lndSyncing=$(echo "${chainInfo}" | grep "false" -c)
|
lndSyncing=$(echo "${chainInfo}" | grep "false" -c)
|
||||||
|
@@ -22,11 +22,11 @@ if [ ${#chain} -eq 0 ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# CHECK #########
|
# CHECK #########
|
||||||
|
source <(/home/admin/config.scripts/network.aliases.sh getvars)
|
||||||
echo "*** Check ${network} Running ***"
|
echo "*** Check ${network} Running ***"
|
||||||
bitcoinRunning=$(systemctl status ${network}d.service 2>/dev/null | grep -c running)
|
bitcoinRunning=$(systemctl status ${netprefix}${network}d.service 2>/dev/null | grep -c running)
|
||||||
if [ ${bitcoinRunning} -eq 0 ]; then
|
if [ ${bitcoinRunning} -eq 0 ]; then
|
||||||
bitcoinRunning=$(sudo -u bitcoin ${network}-cli -datadir=/home/bitcoin/.${network} getblockchaininfo | grep -c verificationprogress)
|
bitcoinRunning=$($bitcoincli_alias getblockchaininfo | grep -c verificationprogress)
|
||||||
fi
|
fi
|
||||||
if [ ${bitcoinRunning} -eq 0 ]; then
|
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
|
whiptail --title "70initLND - WARNING" --yes-button "Retry" --no-button "EXIT+Logs" --yesno "Service ${network}d is not running." 8 50
|
||||||
@@ -46,7 +46,7 @@ loopCount=0
|
|||||||
while [ ${chainIsReady} -eq 0 ]
|
while [ ${chainIsReady} -eq 0 ]
|
||||||
do
|
do
|
||||||
loopCount=$(($loopCount +1))
|
loopCount=$(($loopCount +1))
|
||||||
result=$(sudo -u bitcoin ${network}-cli -datadir=/home/bitcoin/.${network} getblockchaininfo 2>error.out)
|
result=$($bitcoincli_alias getblockchaininfo 2>error.out)
|
||||||
error=$(cat error.out)
|
error=$(cat error.out)
|
||||||
rm error.out
|
rm error.out
|
||||||
if [ ${#error} -gt 0 ]; then
|
if [ ${#error} -gt 0 ]; then
|
||||||
|
@@ -8,6 +8,8 @@ source /mnt/hdd/raspiblitz.conf
|
|||||||
# 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)
|
||||||
|
|
||||||
|
source <(/home/admin/config.scripts/network.aliases.sh getvars lnd $1)
|
||||||
|
|
||||||
# BASIC MENU INFO
|
# BASIC MENU INFO
|
||||||
HEIGHT=13
|
HEIGHT=13
|
||||||
WIDTH=64
|
WIDTH=64
|
||||||
@@ -33,7 +35,7 @@ fi
|
|||||||
|
|
||||||
OPTIONS+=(NAME "Change Name/Alias of Node")
|
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')
|
openChannels=$($lncli_alias listchannels 2>/dev/null | jq '.[] | length')
|
||||||
if [ ${#openChannels} -gt 0 ] && [ ${openChannels} -gt 0 ]; then
|
if [ ${#openChannels} -gt 0 ] && [ ${openChannels} -gt 0 ]; then
|
||||||
OPTIONS+=(CLOSEALL "Close all open Channels")
|
OPTIONS+=(CLOSEALL "Close all open Channels")
|
||||||
HEIGHT=$((HEIGHT+1))
|
HEIGHT=$((HEIGHT+1))
|
||||||
|
@@ -18,9 +18,12 @@ echo "**************************************************************************
|
|||||||
echo "HELP: Enter your PASSWORD C"
|
echo "HELP: Enter your PASSWORD C"
|
||||||
echo "You may wait some seconds until you get asked for password."
|
echo "You may wait some seconds until you get asked for password."
|
||||||
echo "****************************************************************************"
|
echo "****************************************************************************"
|
||||||
|
source <(/home/admin/config.scripts/network.aliases.sh getvars lnd)
|
||||||
|
shopt -s expand_aliases
|
||||||
|
alias lncli_alias="$lncli_alias"
|
||||||
while :
|
while :
|
||||||
do
|
do
|
||||||
sudo -u bitcoin /usr/local/bin/lncli --chain=${network} unlock
|
lncli_alias --chain=${network} unlock
|
||||||
sleep 4
|
sleep 4
|
||||||
locked=$(sudo tail -n 1 /mnt/hdd/lnd/logs/${network}/${chain}net/lnd.log 2>/dev/null | grep -c unlock)
|
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
|
if [ ${locked} -eq 0 ]; then
|
||||||
|
@@ -53,7 +53,7 @@ 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: "
|
||||||
|
@@ -400,7 +400,8 @@ 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/network.aliases.sh getvars lnd)
|
||||||
|
locked=$($lncli_alias getinfo 2>&1 | grep -c unlock)
|
||||||
if [ ${locked} -gt 0 ]; then
|
if [ ${locked} -gt 0 ]; then
|
||||||
|
|
||||||
echo "STARTING AUTO-UNLOCK ..."
|
echo "STARTING AUTO-UNLOCK ..."
|
||||||
@@ -441,7 +442,8 @@ do
|
|||||||
# check if flag exists (got created on 50syncHDD.sh)
|
# check if flag exists (got created on 50syncHDD.sh)
|
||||||
flagExists=$(ls /mnt/hdd/${network}/blocks/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"
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Usage:
|
# Usage:
|
||||||
# source <(/home/admin/config.scripts/network.aliases.sh <lnd|cln> <mainnet|testnet|signet>
|
# source <(/home/admin/config.scripts/network.aliases.sh getvars <lnd|cln> <mainnet|testnet|signet>)
|
||||||
# shopt -s expand_aliases
|
# shopt -s expand_aliases
|
||||||
# alias bitcoincli_alias="$bitcoincli_alias"
|
# alias bitcoincli_alias="$bitcoincli_alias"
|
||||||
# alias lncli_alias="$lncli_alias"
|
# alias lncli_alias="$lncli_alias"
|
||||||
@@ -55,7 +55,6 @@ if [ $1 = getvars ];then
|
|||||||
echo "portprefix=''"
|
echo "portprefix=''"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#TODO ALL
|
|
||||||
# instead of all
|
# instead of all
|
||||||
# sudo -u bitcoin /usr/local/bin/lncli --chain=${network} --network=${chain}net
|
# sudo -u bitcoin /usr/local/bin/lncli --chain=${network} --network=${chain}net
|
||||||
echo "lncli_alias=\"sudo -u bitcoin /usr/local/bin/lncli -n=${chain}net --rpcserver localhost:1${L2rpcportmod}009\""
|
echo "lncli_alias=\"sudo -u bitcoin /usr/local/bin/lncli -n=${chain}net --rpcserver localhost:1${L2rpcportmod}009\""
|
||||||
|
Reference in New Issue
Block a user