mirror of
https://github.com/rootzoll/raspiblitz.git
synced 2025-03-01 00:59:23 +01:00
fix: lnd check for rpcmiddleware (#3804)
This commit is contained in:
parent
4e1f2a4ae9
commit
029525ab4d
2 changed files with 53 additions and 57 deletions
|
@ -5,10 +5,10 @@ LITVERSION="0.9.2-alpha"
|
||||||
|
|
||||||
# command info
|
# command info
|
||||||
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
||||||
echo "config script to switch the Lightning Terminal Service on or off"
|
echo "config script to switch the Lightning Terminal Service on or off"
|
||||||
echo "installs the version $LITVERSION"
|
echo "installs the version $LITVERSION"
|
||||||
echo "bonus.lit.sh [on|off|menu]"
|
echo "bonus.lit.sh [on|off|menu]"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check who signed the release in https://github.com/lightninglabs/lightning-terminal/releases
|
# check who signed the release in https://github.com/lightninglabs/lightning-terminal/releases
|
||||||
|
@ -78,16 +78,16 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
||||||
|
|
||||||
# switching off single installs of pool, loop or faraday if installed
|
# switching off single installs of pool, loop or faraday if installed
|
||||||
if [ "${loop}" = "on" ]; then
|
if [ "${loop}" = "on" ]; then
|
||||||
echo "# Replacing single install of: LOOP"
|
echo "# Replacing single install of: LOOP"
|
||||||
/home/admin/config.scripts/bonus.loop.sh off
|
/home/admin/config.scripts/bonus.loop.sh off
|
||||||
fi
|
fi
|
||||||
if [ "${pool}" = "on" ]; then
|
if [ "${pool}" = "on" ]; then
|
||||||
echo "# Replacing single install of: POOL"
|
echo "# Replacing single install of: POOL"
|
||||||
/home/admin/config.scripts/bonus.pool.sh off
|
/home/admin/config.scripts/bonus.pool.sh off
|
||||||
fi
|
fi
|
||||||
if [ "${faraday}" = "on" ]; then
|
if [ "${faraday}" = "on" ]; then
|
||||||
echo "# Replacing single install of: FARADAY"
|
echo "# Replacing single install of: FARADAY"
|
||||||
/home/admin/config.scripts/bonus.faraday.sh off
|
/home/admin/config.scripts/bonus.faraday.sh off
|
||||||
fi
|
fi
|
||||||
|
|
||||||
isInstalled=$(sudo ls /etc/systemd/system/litd.service 2>/dev/null | grep -c 'litd.service')
|
isInstalled=$(sudo ls /etc/systemd/system/litd.service 2>/dev/null | grep -c 'litd.service')
|
||||||
|
@ -96,7 +96,7 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
||||||
# create dedicated user
|
# create dedicated user
|
||||||
sudo adduser --disabled-password --gecos "" lit
|
sudo adduser --disabled-password --gecos "" lit
|
||||||
# make sure symlink to central app-data directory exists
|
# make sure symlink to central app-data directory exists
|
||||||
sudo rm -rf /home/lit/.lnd # not a symlink.. delete it silently
|
sudo rm -rf /home/lit/.lnd # not a symlink.. delete it silently
|
||||||
# create symlink
|
# create symlink
|
||||||
sudo ln -s "/mnt/hdd/app-data/lnd/" "/home/lit/.lnd"
|
sudo ln -s "/mnt/hdd/app-data/lnd/" "/home/lit/.lnd"
|
||||||
|
|
||||||
|
@ -160,21 +160,21 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
||||||
uname -m
|
uname -m
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
echo "OK running on $(uname -m) architecture."
|
echo "OK running on $(uname -m) architecture."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
downloadDir="/home/admin/download/lit" # edit your download directory
|
downloadDir="/home/admin/download/lit" # edit your download directory
|
||||||
rm -rf "${downloadDir}"
|
rm -rf "${downloadDir}"
|
||||||
mkdir -p "${downloadDir}"
|
mkdir -p "${downloadDir}"
|
||||||
cd "${downloadDir}" || exit 1
|
cd "${downloadDir}" || exit 1
|
||||||
|
|
||||||
# extract the SHA256 hash from the manifest file for the corresponding platform
|
# extract the SHA256 hash from the manifest file for the corresponding platform
|
||||||
wget -N https://github.com/lightninglabs/lightning-terminal/releases/download/v${LITVERSION}/manifest-v${LITVERSION}.txt
|
wget -N https://github.com/lightninglabs/lightning-terminal/releases/download/v${LITVERSION}/manifest-v${LITVERSION}.txt
|
||||||
if [ ${isARM} -eq 1 ] ; then
|
if [ ${isARM} -eq 1 ]; then
|
||||||
OSversion="armv7"
|
OSversion="armv7"
|
||||||
elif [ ${isAARCH64} -eq 1 ] ; then
|
elif [ ${isAARCH64} -eq 1 ]; then
|
||||||
OSversion="arm64"
|
OSversion="arm64"
|
||||||
elif [ ${isX86_64} -eq 1 ] ; then
|
elif [ ${isX86_64} -eq 1 ]; then
|
||||||
OSversion="amd64"
|
OSversion="amd64"
|
||||||
fi
|
fi
|
||||||
SHA256=$(grep -i "linux-$OSversion" manifest-v$LITVERSION.txt | cut -d " " -f1)
|
SHA256=$(grep -i "linux-$OSversion" manifest-v$LITVERSION.txt | cut -d " " -f1)
|
||||||
|
@ -198,8 +198,8 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
||||||
|
|
||||||
echo "# check gpg finger print"
|
echo "# check gpg finger print"
|
||||||
gpg --show-keys --keyid-format LONG ./pgp_keys.asc
|
gpg --show-keys --keyid-format LONG ./pgp_keys.asc
|
||||||
fingerprint=$(gpg --show-keys --keyid-format LONG "./pgp_keys.asc" 2>/dev/null \
|
fingerprint=$(gpg --show-keys --keyid-format LONG "./pgp_keys.asc" 2>/dev/null |
|
||||||
| grep "${PGPcheck}" -c)
|
grep "${PGPcheck}" -c)
|
||||||
if [ ${fingerprint} -lt 1 ]; then
|
if [ ${fingerprint} -lt 1 ]; then
|
||||||
echo ""
|
echo ""
|
||||||
echo "# BUILD WARNING --> LiT PGP author not as expected"
|
echo "# BUILD WARNING --> LiT PGP author not as expected"
|
||||||
|
@ -209,7 +209,10 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
||||||
fi
|
fi
|
||||||
gpg --import ./pgp_keys.asc
|
gpg --import ./pgp_keys.asc
|
||||||
sleep 3
|
sleep 3
|
||||||
verifyResult=$(LANG=en_US.utf8; gpg --verify manifest-v${LITVERSION}.sig manifest-v${LITVERSION}.txt 2>&1)
|
verifyResult=$(
|
||||||
|
LANG=en_US.utf8
|
||||||
|
gpg --verify manifest-v${LITVERSION}.sig manifest-v${LITVERSION}.txt 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} | tr -d " \t\n\r" | grep "${GPGcheck}" -c)
|
correctKey=$(echo ${verifyResult} | tr -d " \t\n\r" | grep "${GPGcheck}" -c)
|
||||||
|
@ -235,17 +238,14 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
||||||
###########
|
###########
|
||||||
# config #
|
# config #
|
||||||
###########
|
###########
|
||||||
|
# check if lnd.conf has rpcmiddleware.enable entry under [rpcmiddleware]
|
||||||
# check if lnd.conf has rpcmiddleware.enable entry under section Application Options
|
if sudo grep rpcmiddleware /mnt/hdd/lnd/lnd.conf; then
|
||||||
entryExists=$(sudo cat /mnt/hdd/lnd/lnd.conf | grep -c "rpcmiddleware.enable=")
|
sudo sed -i "s/^rpcmiddleware.enable=.*/rpcmiddleware.enable=true/g" /mnt/hdd/lnd/lnd.conf
|
||||||
if [ "${entryExists}" == "0" ]; then
|
else
|
||||||
echo "# add rpcmiddleware.enable=true to lnd.conf"
|
sudo bash -c "echo '[rpcmiddleware]' >> /mnt/hdd/lnd/lnd.conf"
|
||||||
sudo sed -i "/^\[Application Options\]$/arpcmiddleware.enable=true" /mnt/hdd/lnd/lnd.conf
|
sudo bash -c "echo 'rpcmiddleware.enable=true' >> /mnt/hdd/lnd/lnd.conf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# make sure lnd.conf has rpcmiddleware.enable=true
|
|
||||||
sudo sed -i "s/^rpcmiddleware.enable=.*/rpcmiddleware.enable=true/g" /mnt/hdd/lnd/lnd.conf
|
|
||||||
|
|
||||||
if [ "${runBehindTor}" = "on" ]; then
|
if [ "${runBehindTor}" = "on" ]; then
|
||||||
echo "# Connect to the Pool, Loop and Terminal server through Tor"
|
echo "# Connect to the Pool, Loop and Terminal server through Tor"
|
||||||
LOOPPROXY="loop.server.proxy=127.0.0.1:9050"
|
LOOPPROXY="loop.server.proxy=127.0.0.1:9050"
|
||||||
|
@ -408,4 +408,3 @@ fi
|
||||||
echo "FAIL - Unknown Parameter $1"
|
echo "FAIL - Unknown Parameter $1"
|
||||||
echo "may need reboot to run normal again"
|
echo "may need reboot to run normal again"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,7 @@ echo "# lndConfFile(${lndConfFile})"
|
||||||
# so it tries to make sure the config is in valid shape
|
# so it tries to make sure the config is in valid shape
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
function setting() # FILE LINENUMBER NAME VALUE
|
function setting() { # FILE LINENUMBER NAME VALUE
|
||||||
{
|
|
||||||
FILE=$1
|
FILE=$1
|
||||||
LINENUMBER=$2
|
LINENUMBER=$2
|
||||||
NAME=$3
|
NAME=$3
|
||||||
|
@ -118,7 +117,6 @@ if [ "$1" == "prestart" ]; then
|
||||||
echo "# ${network}.node insert/update"
|
echo "# ${network}.node insert/update"
|
||||||
setting ${lndConfFile} ${insertLine} "${network}\.node" "${network}d"
|
setting ${lndConfFile} ${insertLine} "${network}\.node" "${network}d"
|
||||||
|
|
||||||
|
|
||||||
##### BITCOIND OPTIONS SECTION #####
|
##### BITCOIND OPTIONS SECTION #####
|
||||||
|
|
||||||
# [bitcoind]
|
# [bitcoind]
|
||||||
|
@ -164,7 +162,7 @@ if [ "$1" == "prestart" ]; then
|
||||||
RPCPSW=$(cat /mnt/hdd/${network}/${network}.conf | grep "^${network}d.rpcpassword=" | cut -d "=" -f2 | tail -n 1)
|
RPCPSW=$(cat /mnt/hdd/${network}/${network}.conf | grep "^${network}d.rpcpassword=" | cut -d "=" -f2 | tail -n 1)
|
||||||
fi
|
fi
|
||||||
if [ "${RPCPSW}" == "" ]; then
|
if [ "${RPCPSW}" == "" ]; then
|
||||||
1>&2 echo "FAIL: 'rpcpassword' not found in /mnt/hdd/${network}/${network}.conf"
|
echo 1>&2 "FAIL: 'rpcpassword' not found in /mnt/hdd/${network}/${network}.conf"
|
||||||
exit 11
|
exit 11
|
||||||
fi
|
fi
|
||||||
setting ${lndConfFile} ${insertLine} "${network}d\.rpcpass" "${RPCPSW}"
|
setting ${lndConfFile} ${insertLine} "${network}d\.rpcpass" "${RPCPSW}"
|
||||||
|
@ -175,7 +173,7 @@ if [ "$1" == "prestart" ]; then
|
||||||
RPCUSER=$(cat /mnt/hdd/${network}/${network}.conf | grep "^${network}d.rpcuser=" | cut -d "=" -f2 | tail -n 1)
|
RPCUSER=$(cat /mnt/hdd/${network}/${network}.conf | grep "^${network}d.rpcuser=" | cut -d "=" -f2 | tail -n 1)
|
||||||
fi
|
fi
|
||||||
if [ "${RPCUSER}" == "" ]; then
|
if [ "${RPCUSER}" == "" ]; then
|
||||||
1>&2 echo "FAIL: 'rpcuser' not found in /mnt/hdd/${network}/${network}.conf"
|
echo 1>&2 "FAIL: 'rpcuser' not found in /mnt/hdd/${network}/${network}.conf"
|
||||||
exit 12
|
exit 12
|
||||||
fi
|
fi
|
||||||
setting ${lndConfFile} ${insertLine} "${network}d\.rpcuser" "${RPCUSER}"
|
setting ${lndConfFile} ${insertLine} "${network}d\.rpcuser" "${RPCUSER}"
|
||||||
|
@ -258,7 +256,7 @@ if [ "$1" == "prestart" ]; then
|
||||||
# limit workers to the number of cores
|
# limit workers to the number of cores
|
||||||
setting ${lndConfFile} ${insertLine} "workers.write" "${cores}"
|
setting ${lndConfFile} ${insertLine} "workers.write" "${cores}"
|
||||||
setting ${lndConfFile} ${insertLine} "workers.sig" "${cores}"
|
setting ${lndConfFile} ${insertLine} "workers.sig" "${cores}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
##### TOR SECTION #####
|
##### TOR SECTION #####
|
||||||
|
|
||||||
|
@ -296,7 +294,7 @@ fi
|
||||||
|
|
||||||
# take care of incompatible settings https://github.com/rootzoll/raspiblitz/issues/2787#issuecomment-991245694
|
# take care of incompatible settings https://github.com/rootzoll/raspiblitz/issues/2787#issuecomment-991245694
|
||||||
if [ $(cat ${lndConfFile} | grep -c "^tor.skip-proxy-for-clearnet-targets=true") -gt 0 ] ||
|
if [ $(cat ${lndConfFile} | grep -c "^tor.skip-proxy-for-clearnet-targets=true") -gt 0 ] ||
|
||||||
[ $(cat ${lndConfFile} | grep -c "^tor.skip-proxy-for-clearnet-targets=1") -gt 0 ]; then
|
[ $(cat ${lndConfFile} | grep -c "^tor.skip-proxy-for-clearnet-targets=1") -gt 0 ]; then
|
||||||
setting ${lndConfFile} ${insertLine} "tor.streamisolation" "false"
|
setting ${lndConfFile} ${insertLine} "tor.streamisolation" "false"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -308,7 +306,7 @@ fi
|
||||||
##### RPCMIDDLEWARE SECTION #####
|
##### RPCMIDDLEWARE SECTION #####
|
||||||
|
|
||||||
# [rpcmiddleware]
|
# [rpcmiddleware]
|
||||||
sectionName="[Rr]pcmiddleware"
|
sectionName="rpcmiddleware"
|
||||||
echo "# [${sectionName}] config ..."
|
echo "# [${sectionName}] config ..."
|
||||||
|
|
||||||
# make sure lnd config has a [rpcmiddleware] section
|
# make sure lnd config has a [rpcmiddleware] section
|
||||||
|
@ -337,7 +335,6 @@ fi
|
||||||
# SET/UPDATE rpcmiddleware.enable
|
# SET/UPDATE rpcmiddleware.enable
|
||||||
setting ${lndConfFile} ${insertLine} "rpcmiddleware.enable" "true"
|
setting ${lndConfFile} ${insertLine} "rpcmiddleware.enable" "true"
|
||||||
|
|
||||||
|
|
||||||
echo "# OK PRESTART DONE"
|
echo "# OK PRESTART DONE"
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
|
@ -411,25 +408,25 @@ elif [ "$1" == "basic-setup" ]; then
|
||||||
echo "err='$(netprefix)lnd.conf: blockchain network in $(netprefix)lnd.conf (${lndNetwork}) is different from raspiblitz.conf (${network})'"
|
echo "err='$(netprefix)lnd.conf: blockchain network in $(netprefix)lnd.conf (${lndNetwork}) is different from raspiblitz.conf (${network})'"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# # get chain from config (TESTNET / MAINNET)
|
# # get chain from config (TESTNET / MAINNET)
|
||||||
# lndChain=""
|
# lndChain=""
|
||||||
# source <(sudo cat /mnt/hdd/lnd/lnd.conf 2>/dev/null | grep "${lndNetwork}.mainnet" | sed 's/^[a-z]*\.//g')
|
# source <(sudo cat /mnt/hdd/lnd/lnd.conf 2>/dev/null | grep "${lndNetwork}.mainnet" | sed 's/^[a-z]*\.//g')
|
||||||
# source <(sudo cat /mnt/hdd/lnd/lnd.conf 2>/dev/null | grep "${lndNetwork}.testnet" | sed 's/^[a-z]*\.//g')
|
# source <(sudo cat /mnt/hdd/lnd/lnd.conf 2>/dev/null | grep "${lndNetwork}.testnet" | sed 's/^[a-z]*\.//g')
|
||||||
# if [ "${mainnet}" == "1" ] && [ "${testnet}" == "1" ]; then
|
# if [ "${mainnet}" == "1" ] && [ "${testnet}" == "1" ]; then
|
||||||
# echo "err='lnd.conf: mainnet and testnet are set active at the same time'"
|
# echo "err='lnd.conf: mainnet and testnet are set active at the same time'"
|
||||||
# elif [ "${mainnet}" == "1" ]; then
|
# elif [ "${mainnet}" == "1" ]; then
|
||||||
# lndChain="main"
|
# lndChain="main"
|
||||||
# elif [ "${testnet}" == "1" ]; then
|
# elif [ "${testnet}" == "1" ]; then
|
||||||
# lndChain="test"
|
# lndChain="test"
|
||||||
# else
|
# else
|
||||||
# echo "err='lnd.conf: neither testnet or mainnet is set active (raspiblitz needs one of them active in lnd.conf)'"
|
# echo "err='lnd.conf: neither testnet or mainnet is set active (raspiblitz needs one of them active in lnd.conf)'"
|
||||||
# fi
|
# fi
|
||||||
# echo "chain='${lndChain}'"
|
# echo "chain='${lndChain}'"
|
||||||
#
|
#
|
||||||
# # check if chain is same the raspiblitz config
|
# # check if chain is same the raspiblitz config
|
||||||
# if [ "${chain}" != "${lndChain}" ]; then
|
# if [ "${chain}" != "${lndChain}" ]; then
|
||||||
# echo "err='lnd.conf: testnet/mainnet in lnd.conf (${lndChain}) is different from raspiblitz.conf (${chain})'"
|
# echo "err='lnd.conf: testnet/mainnet in lnd.conf (${lndChain}) is different from raspiblitz.conf (${chain})'"
|
||||||
# fi
|
# fi
|
||||||
|
|
||||||
# check for admin macaroon exist (on HDD)
|
# check for admin macaroon exist (on HDD)
|
||||||
adminMacaroonExists=$(sudo ls /mnt/hdd/lnd/data/chain/${network}/${chain}net/admin.macaroon 2>/dev/null | grep -c 'admin.macaroon')
|
adminMacaroonExists=$(sudo ls /mnt/hdd/lnd/data/chain/${network}/${chain}net/admin.macaroon 2>/dev/null | grep -c 'admin.macaroon')
|
||||||
|
|
Loading…
Add table
Reference in a new issue