cln clboss update to latest commit, add simple update (#4121)

* clboss: buildfrom github clone, add update option
* cln clboss update to latest commit
This commit is contained in:
openoms 2023-08-25 22:11:06 +02:00 committed by GitHub
parent 43ee57d069
commit 70eae57b03
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,28 +2,34 @@
# https://github.com/ZmnSCPxj/clboss#operating # https://github.com/ZmnSCPxj/clboss#operating
# https://github.com/ZmnSCPxj/clboss/releases # https://github.com/ZmnSCPxj/clboss/releases
CLBOSSVERSION="0.13A" # https://github.com/ZmnSCPxj/clboss/commits/master
CLBOSSVERSION="ef5c41612da0d544b0ed1f3e986b4b07126723a1"
# command info # command info
if [ $# -lt 1 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ];then if [ $# -lt 1 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
echo echo
echo "Install or remove the CLBOSS Core Lightning plugin" echo "Install or remove the CLBOSS Core Lightning plugin"
echo "version: v${CLBOSSVERSION}" echo "version: v${CLBOSSVERSION}"
echo "Usage:" echo "Usage:"
echo "cl-plugin.clboss.sh [on|off] [testnet|mainnet|signet]" echo "cl-plugin.clboss.sh [on|off] [mainnet|testnet] <latest>"
echo "cl-plugin.clboss.sh [info]" echo "cl-plugin.clboss.sh info"
echo "cl-plugin.clboss.sh update"
echo echo
exit 1 exit 1
fi fi
if [ $# -gt 2 ] && [ $3 = latest ]; then
CLBOSSVERSION=""
fi
# source <(/home/admin/config.scripts/network.aliases.sh getvars cl <mainnet|testnet|signet>) # source <(/home/admin/config.scripts/network.aliases.sh getvars cl <mainnet|testnet|signet>)
source <(/home/admin/config.scripts/network.aliases.sh getvars cl $2) source <(/home/admin/config.scripts/network.aliases.sh getvars cl $2)
if [ "$1" = info ]; then if [ "$1" = info ]; then
whiptail --title " CLBOSS WARNING " \ whiptail --title " CLBOSS WARNING " \
--yes-button "Install" \ --yes-button "Install" \
--no-button "Cancel" \ --no-button "Cancel" \
--yesno " --yesno "
The goal of CLBOSS is to make the node able to pay and receive payments The goal of CLBOSS is to make the node able to pay and receive payments
on the lightning network reliably without needing active management. on the lightning network reliably without needing active management.
It is not a tool to run a profitable lightning node and it can lose some sats on fees. It is not a tool to run a profitable lightning node and it can lose some sats on fees.
@ -40,35 +46,39 @@ https://github.com/ZmnSCPxj/clboss#operating
" 0 0 " 0 0
fi fi
function buildFromSource() {
version=$1
# dependencies
sudo apt install -y build-essential pkg-config libev-dev \
libcurl4-gnutls-dev libsqlite3-dev dnsutils
sudo apt install -y git automake autoconf-archive libtool
if [ "$1" = on ];then # download
cd /home/bitcoin/cl-plugins-available/ || exit 1
if [ ! -f /home/bitcoin/cl-plugins-available/clboss-${CLBOSSVERSION}.tar.gz ];then sudo -u bitcoin git clone https://github.com/ZmnSCPxj/clboss
cd clboss || exit 1
# download tarball if [[ -v version && -n "$version" ]]; then
sudo -u bitcoin wget \ sudo -u bitcoin git reset --hard ${version}
https://github.com/ZmnSCPxj/clboss/releases/download/${CLBOSSVERSION}/clboss-${CLBOSSVERSION}.tar.gz \
-O /home/bitcoin/cl-plugins-available/clboss-${CLBOSSVERSION}.tar.gz || exit 1
fi fi
if [ ! -f /home/bitcoin/cl-plugins-available/clboss-${CLBOSSVERSION}/clboss ];then # build
# dependencies sudo -u bitcoin autoreconf -i
sudo apt install -y build-essential pkg-config libev-dev \ sudo -u bitcoin ./configure && sudo -u bitcoin make
libcurl4-gnutls-dev libsqlite3-dev dnsutils # sudo make install # optional - installs to /usr/local/bin/clboss
}
if [ "$1" = on ]; then
if [ ! -f /home/bitcoin/cl-plugins-available/clboss/clboss ]; then
buildFromSource ${CLBOSSVERSION}
# install
cd /home/bitcoin/cl-plugins-available/ || exit 1
sudo -u bitcoin tar -xvf clboss-${CLBOSSVERSION}.tar.gz
cd clboss-${CLBOSSVERSION} || exit 1
sudo -u bitcoin ./configure && sudo -u bitcoin make
# sudo make install # installs to /usr/local/bin/clboss
fi fi
# symlink to enable # refresh symlink to enable
if [ ! -L /home/bitcoin/${netprefix}cl-plugins-enabled/clboss ];then sudo rm /home/bitcoin/${netprefix}cl-plugins-enabled/clboss 2>/dev/null
sudo ln -s /home/bitcoin/cl-plugins-available/clboss-${CLBOSSVERSION}/clboss \ sudo ln -s /home/bitcoin/cl-plugins-available/clboss/clboss \
/home/bitcoin/${netprefix}cl-plugins-enabled /home/bitcoin/${netprefix}cl-plugins-enabled/
fi
# setting value in raspiblitz.conf # setting value in raspiblitz.conf
/home/admin/config.scripts/blitz.conf.sh set ${netprefix}clboss "on" /home/admin/config.scripts/blitz.conf.sh set ${netprefix}clboss "on"
@ -85,17 +95,18 @@ if [ "$1" = on ];then
echo "${netprefix}cl clboss-status" echo "${netprefix}cl clboss-status"
echo "https://github.com/ZmnSCPxj/clboss#operating" echo "https://github.com/ZmnSCPxj/clboss#operating"
exit 0
fi fi
if [ "$1" = off ];then if [ "$1" = off ]; then
# delete symlink # delete symlink
sudo rm -rf /home/bitcoin/${netprefix}cl-plugins-enabled/clboss sudo rm -rf /home/bitcoin/${netprefix}cl-plugins-enabled/clboss
echo "# Restart the ${netprefix}lightningd.service to deactivate clboss" echo "# Restarting the ${netprefix}lightningd.service to deactivate clboss"
sudo systemctl restart ${netprefix}lightningd sudo systemctl restart ${netprefix}lightningd
# purge # purge
if [ "$(echo "$@" | grep -c purge)" -gt 0 ];then if [ "$(echo "$@" | grep -c purge)" -gt 0 ]; then
echo "# Delete plugin" echo "# Delete plugin"
sudo rm -rf /home/bitcoin/cl-plugins-available/clboss* sudo rm -rf /home/bitcoin/cl-plugins-available/clboss*
sudo rm -f /usr/local/bin/clboss sudo rm -f /usr/local/bin/clboss
@ -105,4 +116,25 @@ if [ "$1" = off ];then
/home/admin/config.scripts/blitz.conf.sh set ${netprefix}clboss "off" /home/admin/config.scripts/blitz.conf.sh set ${netprefix}clboss "off"
echo "# clboss was uninstalled for $CHAIN" echo "# clboss was uninstalled for $CHAIN"
exit 0
fi fi
if [ "$1" = update ]; then
if [ ! -f /home/bitcoin/cl-plugins-available/clboss/clboss ]; then
/home/admin/config.scrips/cl-plugin/clboss.sh on "${CHAIN}"
exit 0
else
sudo rm -rf /home/bitcoin/cl-plugins-available/clboss
buildFromSource
echo "# clboss was updated to the latest master commit"
echo "# Restarting ${netprefix}lightningd to activate"
sudo systemctl restart ${netprefix}lightningd
exit 0
fi
fi
echo "# FAIL - Unknown Parameter $1"
exit 1