switch SUMMARY to cl-plugin.summars (#4625)

* add summars plugin script

* switch to summars plugin, remove summary plugin
This commit is contained in:
openoms 2024-06-19 22:56:42 +02:00 committed by GitHub
parent 13acbe94b0
commit c5c984f3e5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 45 additions and 46 deletions

View file

@ -56,7 +56,7 @@ CHOICE=$(dialog --clear \
case $CHOICE in case $CHOICE in
SUMMARY) SUMMARY)
clear clear
/home/admin/config.scripts/cl-plugin.summary.sh $CHAIN /home/admin/config.scripts/cl-plugin.summars.sh $CHAIN
echo "Press ENTER to return to main menu." echo "Press ENTER to return to main menu."
read key read key
;; ;;

View file

@ -0,0 +1,44 @@
#!/bin/bash
# command info
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
echo
echo "Install and show the output if the summars plugin for Core Lightning"
echo "Usage:"
echo "cl-plugin.summars.sh [testnet|mainnet|signet] [runonce]"
echo
exit 1
fi
source <(/home/admin/config.scripts/network.aliases.sh getvars cl $1)
if [ $($lightningcli_alias | grep -c "summars") -eq 0 ]; then
echo "# Starting the summars plugin"
if [ ! -f /home/bitcoin/cl-plugins-available/summars/target/release/summars ]; then
if [ ! -f /home/bitcoin/.cargo/bin/cargo ]; then
# get Rust
sudo -u bitcoin curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sudo -u bitcoin sh -s -- -y
fi
if [ ! -d "/home/bitcoin/cl-plugins-available/summars" ]; then
sudo -u bitcoin mkdir /home/bitcoin/cl-plugins-available 2>/dev/null
cd /home/bitcoin/cl-plugins-available || exit 1
sudo -u bitcoin git clone https://github.com/daywalker90/summars.git
fi
cd /home/bitcoin/cl-plugins-available/summars || exit 1
sudo -u bitcoin /home/bitcoin/.cargo/bin/cargo build --release
fi
$lightningcli_alias plugin start -H /home/bitcoin/cl-plugins-available/summars/target/release/summars 1>/dev/null
fi
echo
echo "# Running:"
echo "${netprefix}lightning-cli -H summars summars-columns=IN_SATS,OUT_SATS,GRAPH_SATS,ALIAS summars-sort-by=IN_SATS"
echo
$lightningcli_alias -H summars summars-columns=IN_SATS,OUT_SATS,GRAPH_SATS,ALIAS summars-sort-by=IN_SATS
echo
if [ "$(echo "$@" | grep -c "runonce")" -gt 0 ]; then
$lightningcli_alias plugin stop /home/bitcoin/cl-plugins-available/summars/target/release/summars
fi

View file

@ -1,45 +0,0 @@
#!/bin/bash
# command info
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ];then
echo
echo "Install and show the output if the summary plugin forCore Lightning"
echo "Usage:"
echo "cl-plugin.summary.sh [testnet|mainnet|signet] [runonce]"
echo
exit 1
fi
source <(/home/admin/config.scripts/network.aliases.sh getvars cl $1)
if [ ! -f "/home/bitcoin/cl-plugins-available/plugins/summary/summary.py" ]; then
sudo -u bitcoin mkdir /home/bitcoin/cl-plugins-available
cd /home/bitcoin/cl-plugins-available || exit 1
sudo -u bitcoin git clone https://github.com/lightningd/plugins.git
fi
if [ $($lightningcli_alias | grep -c "summary") -eq 0 ];then
echo "# Starting the summary plugin"
# https://github.com/ElementsProject/lightning/tree/master/contrib/pylightning
sudo -u bitcoin pip install --user pylightning 1>/dev/null
# https://github.com/lightningd/plugins#dynamic-plugin-initialization
sudo -u bitcoin pip install --user -r /home/bitcoin/cl-plugins-available/plugins/summary/requirements.txt 1>/dev/null
$lightningcli_alias plugin start -H /home/bitcoin/cl-plugins-available/plugins/summary/summary.py 1>/dev/null
fi
echo
echo "Node URI:"
ln_getinfo=$($lightningcli_alias -H getinfo 2>/dev/null)
pubkey=$(echo "$ln_getinfo" | grep "id=" | cut -d= -f2)
toraddress=$(echo "$ln_getinfo" | grep ".onion" | cut -d= -f2)
port=$(echo "$ln_getinfo" | grep "port" | tail -n1 | cut -d= -f2)
echo "${pubkey}@${toraddress}:${port}"
echo
echo "# Running:"
echo "${netprefix}lightning-cli -H summary"
echo
$lightningcli_alias -H summary
echo
if [ "$(echo "$@" | grep -c "runonce")" -gt 0 ];then
$lightningcli_alias plugin stop /home/bitcoin/cl-plugins-available/plugins/summary/summary.py
fi