fix: lnd check for rpcmiddleware (#3804)

This commit is contained in:
openoms 2023-05-08 19:35:18 +01:00 committed by GitHub
parent 4e1f2a4ae9
commit 029525ab4d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 53 additions and 57 deletions

View file

@ -198,8 +198,8 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
echo "# check gpg finger print"
gpg --show-keys --keyid-format LONG ./pgp_keys.asc
fingerprint=$(gpg --show-keys --keyid-format LONG "./pgp_keys.asc" 2>/dev/null \
| grep "${PGPcheck}" -c)
fingerprint=$(gpg --show-keys --keyid-format LONG "./pgp_keys.asc" 2>/dev/null |
grep "${PGPcheck}" -c)
if [ ${fingerprint} -lt 1 ]; then
echo ""
echo "# BUILD WARNING --> LiT PGP author not as expected"
@ -209,7 +209,10 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
fi
gpg --import ./pgp_keys.asc
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)
echo "goodSignature(${goodSignature})"
correctKey=$(echo ${verifyResult} | tr -d " \t\n\r" | grep "${GPGcheck}" -c)
@ -235,16 +238,13 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
###########
# config #
###########
# check if lnd.conf has rpcmiddleware.enable entry under section Application Options
entryExists=$(sudo cat /mnt/hdd/lnd/lnd.conf | grep -c "rpcmiddleware.enable=")
if [ "${entryExists}" == "0" ]; then
echo "# add rpcmiddleware.enable=true to lnd.conf"
sudo sed -i "/^\[Application Options\]$/arpcmiddleware.enable=true" /mnt/hdd/lnd/lnd.conf
fi
# make sure lnd.conf has rpcmiddleware.enable=true
# check if lnd.conf has rpcmiddleware.enable entry under [rpcmiddleware]
if sudo grep rpcmiddleware /mnt/hdd/lnd/lnd.conf; then
sudo sed -i "s/^rpcmiddleware.enable=.*/rpcmiddleware.enable=true/g" /mnt/hdd/lnd/lnd.conf
else
sudo bash -c "echo '[rpcmiddleware]' >> /mnt/hdd/lnd/lnd.conf"
sudo bash -c "echo 'rpcmiddleware.enable=true' >> /mnt/hdd/lnd/lnd.conf"
fi
if [ "${runBehindTor}" = "on" ]; then
echo "# Connect to the Pool, Loop and Terminal server through Tor"
@ -408,4 +408,3 @@ fi
echo "FAIL - Unknown Parameter $1"
echo "may need reboot to run normal again"
exit 1

View file

@ -22,8 +22,7 @@ echo "# lndConfFile(${lndConfFile})"
# 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
LINENUMBER=$2
NAME=$3
@ -118,7 +117,6 @@ if [ "$1" == "prestart" ]; then
echo "# ${network}.node insert/update"
setting ${lndConfFile} ${insertLine} "${network}\.node" "${network}d"
##### BITCOIND OPTIONS SECTION #####
# [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)
fi
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
fi
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)
fi
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
fi
setting ${lndConfFile} ${insertLine} "${network}d\.rpcuser" "${RPCUSER}"
@ -308,7 +306,7 @@ fi
##### RPCMIDDLEWARE SECTION #####
# [rpcmiddleware]
sectionName="[Rr]pcmiddleware"
sectionName="rpcmiddleware"
echo "# [${sectionName}] config ..."
# make sure lnd config has a [rpcmiddleware] section
@ -337,7 +335,6 @@ fi
# SET/UPDATE rpcmiddleware.enable
setting ${lndConfFile} ${insertLine} "rpcmiddleware.enable" "true"
echo "# OK PRESTART DONE"
######################################################################