fix cln watchtower client plugin (#4459)

* exit if doesn't compile, format

* fix watchtower config option
This commit is contained in:
openoms 2024-03-09 08:40:36 +00:00 committed by GitHub
parent 2f0abcf7fa
commit 0592776504
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -19,7 +19,6 @@ source /mnt/hdd/raspiblitz.conf #to get runBehindTor
plugin="watchtower-client"
pkg_dependencies="libssl-dev"
if [ "$1" = info ]; then
whiptail --title "The Eye of Satoshi CLN Watchtower" \
--msgbox "
@ -48,11 +47,10 @@ https://github.com/talaia-labs/rust-teos/tree/master/watchtower-plugin
exit 0
fi
if [ "$1" = "on" ]; then
# rust for rust-teos, includes rustfmt
sudo -u bitcoin curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
sudo -u bitcoin curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs |
sudo -u bitcoin sh -s -- -y
#Cleanup existing
@ -73,8 +71,8 @@ if [ "$1" = "on" ];then
#Compile
cd /home/bitcoin/cl-plugins-available/rust-teos || exit 1
sudo -u bitcoin /home/bitcoin/.cargo/bin/cargo install --path watchtower-plugin \
--target-dir /home/bitcoin/cl-plugins-available/${plugin}
sudo -u bitcoin /home/bitcoin/.cargo/bin/cargo install --locked --path watchtower-plugin \
--target-dir /home/bitcoin/cl-plugins-available/${plugin} || exit 1
#Symlink to enable
if [ ! -L /home/bitcoin/${netprefix}cl-plugins-enabled/${plugin} ]; then
@ -82,9 +80,16 @@ if [ "$1" = "on" ];then
sudo -u bitcoin ln -s /home/bitcoin/cl-plugins-available/${plugin}/release/${plugin} /home/bitcoin/${netprefix}cl-plugins-enabled/${plugin}
fi
#check if toronly node, then add watchtower-proxy config to CL
if [ "$runBehindTor" = on ]; then
echo "watchtower-proxy=127.0.0.1:9050" | sudo tee -a ${CLCONF}
#check if toronly node, then add watchtower proxy config to CL
if [ "$runBehindTor" = "on" ]; then
# Check if the line is already in the file
if ! grep -q "^proxy=127.0.0.1:9050$" "${CLCONF}"; then
# If not, append the line to the file
echo "Adding proxy configuration to ${CLCONF}"
echo "proxy=127.0.0.1:9050" | sudo tee -a "${CLCONF}" >/dev/null
else
echo "Proxy configuration already exists in ${CLCONF}"
fi
fi
# setting value in raspiblitz.conf
@ -98,14 +103,10 @@ if [ "$1" = "on" ];then
fi
if [ "$1" = off ]; then
# delete symlink
sudo rm -rf /home/bitcoin/${netprefix}cl-plugins-enabled/${plugin}
# delete watchtower-proxy config line from ${CLCONF}
sudo sed -i '/watchtower-proxy=/d' ${CLCONF}
echo "# Restart the ${netprefix}lightningd.service to deactivate ${plugin}"
sudo systemctl restart ${netprefix}lightningd
@ -116,10 +117,8 @@ if [ "$1" = off ];then
sudo rm -rf /home/bitcoin/cl-plugins-available/${plugin}
fi
# setting value in raspi blitz config
/home/admin/config.scripts/blitz.conf.sh set ${netprefix}clWatchtowerClient "off"
echo "# watchtower-client was uninstalled for ${CHAIN}"
fi