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,20 +2,26 @@
# https://github.com/ZmnSCPxj/clboss#operating
# https://github.com/ZmnSCPxj/clboss/releases
CLBOSSVERSION="0.13A"
# https://github.com/ZmnSCPxj/clboss/commits/master
CLBOSSVERSION="ef5c41612da0d544b0ed1f3e986b4b07126723a1"
# command info
if [ $# -lt 1 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ];then
if [ $# -lt 1 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
echo
echo "Install or remove the CLBOSS Core Lightning plugin"
echo "version: v${CLBOSSVERSION}"
echo "Usage:"
echo "cl-plugin.clboss.sh [on|off] [testnet|mainnet|signet]"
echo "cl-plugin.clboss.sh [info]"
echo "cl-plugin.clboss.sh [on|off] [mainnet|testnet] <latest>"
echo "cl-plugin.clboss.sh info"
echo "cl-plugin.clboss.sh update"
echo
exit 1
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 $2)
@ -40,36 +46,40 @@ https://github.com/ZmnSCPxj/clboss#operating
" 0 0
fi
if [ "$1" = on ];then
if [ ! -f /home/bitcoin/cl-plugins-available/clboss-${CLBOSSVERSION}.tar.gz ];then
# download tarball
sudo -u bitcoin wget \
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
if [ ! -f /home/bitcoin/cl-plugins-available/clboss-${CLBOSSVERSION}/clboss ];then
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
# install
# download
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
sudo -u bitcoin git clone https://github.com/ZmnSCPxj/clboss
cd clboss || exit 1
if [[ -v version && -n "$version" ]]; then
sudo -u bitcoin git reset --hard ${version}
fi
# symlink to enable
if [ ! -L /home/bitcoin/${netprefix}cl-plugins-enabled/clboss ];then
sudo ln -s /home/bitcoin/cl-plugins-available/clboss-${CLBOSSVERSION}/clboss \
/home/bitcoin/${netprefix}cl-plugins-enabled
# build
sudo -u bitcoin autoreconf -i
sudo -u bitcoin ./configure && sudo -u bitcoin make
# 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}
fi
# refresh symlink to enable
sudo rm /home/bitcoin/${netprefix}cl-plugins-enabled/clboss 2>/dev/null
sudo ln -s /home/bitcoin/cl-plugins-available/clboss/clboss \
/home/bitcoin/${netprefix}cl-plugins-enabled/
# setting value in raspiblitz.conf
/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 "https://github.com/ZmnSCPxj/clboss#operating"
exit 0
fi
if [ "$1" = off ];then
if [ "$1" = off ]; then
# delete symlink
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
# purge
if [ "$(echo "$@" | grep -c purge)" -gt 0 ];then
if [ "$(echo "$@" | grep -c purge)" -gt 0 ]; then
echo "# Delete plugin"
sudo rm -rf /home/bitcoin/cl-plugins-available/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"
echo "# clboss was uninstalled for $CHAIN"
exit 0
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