add Suez to menu for CLN and LND

needs to be installed with the bitcoin user to be able to interact with CLN
related: https://github.com/rootzoll/raspiblitz/issues/2366
This commit is contained in:
openoms 2021-07-17 20:31:27 +01:00
parent 7819ff90db
commit abd4d1ded1
No known key found for this signature in database
GPG key ID: 5BFB77609B081B65
4 changed files with 50 additions and 31 deletions

View file

@ -32,9 +32,10 @@ ln_channels_online="$(echo "${ln_getInfo}" | jq -r '.num_active_channels')" 2>/d
cln_num_inactive_channels="$(echo "${ln_getInfo}" | jq -r '.num_inactive_channels')" 2>/dev/null
openChannels=$((ln_channels_online+cln_num_inactive_channels))
if [ ${#openChannels} -gt 0 ] && [ ${openChannels} -gt 0 ]; then
OPTIONS+=(SUEZ "Visualize channels")
OPTIONS+=(CLOSEALL "Close all open Channels on $CHAIN")
HEIGHT=$((HEIGHT+1))
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
HEIGHT=$((HEIGHT+2))
CHOICE_HEIGHT=$((CHOICE_HEIGHT+2))
fi
if [ ${#LNdefault} -gt 0 ]&&[ $LNdefault = lnd ];then
@ -88,6 +89,19 @@ case $CHOICE in
exit 0
fi
;;
SUEZ)
clear
if [ ! -f /home/bitcoin/suez/suez ];then
/home/admin/config.scripts/bonus.suez.sh on
fi
cd /home/bitcoin/suez || exit 1
sudo -u bitcoin /home/bitcoin/.local/bin/poetry run ./suez \
--client=c-lightning \
--client-args=--conf=/home/bitcoin/.lightning/${netprefix}config
echo
echo "Press ENTER to return to main menu."
read key
;;
CLOSEALL)
/home/admin/BBcloseAllChannels.sh cln $CHAIN
echo "Press ENTER to return to main menu."

View file

@ -37,9 +37,10 @@ OPTIONS+=(NAME "Change Name/Alias of Node")
openChannels=$($lncli_alias listchannels 2>/dev/null | jq '.[] | length')
if [ ${#openChannels} -gt 0 ] && [ ${openChannels} -gt 0 ]; then
OPTIONS+=(CLOSEALL "Close all open Channels")
HEIGHT=$((HEIGHT+1))
CHOICE_HEIGHT=$((CHOICE_HEIGHT+1))
OPTIONS+=(SUEZ "Visualize channels")
OPTIONS+=(CLOSEALL "Close all open Channels on $CHAIN")
HEIGHT=$((HEIGHT+2))
CHOICE_HEIGHT=$((CHOICE_HEIGHT+2))
fi
OPTIONS+=(CASHOUT "Withdraw all funds from LND on $CHAIN")
@ -115,6 +116,19 @@ case $CHOICE in
exit 0
fi
;;
SUEZ)
clear
if [ ! -f /home/bitcoin/suez/suez ];then
/home/admin/config.scripts/bonus.suez.sh on
fi
cd /home/bitcoin/suez || exit 1
sudo -u bitcoin /home/bitcoin/.local/bin/poetry run ./suez \
--client-args=-n=${CHAIN} \
--client-args=--rpcserver=localhost:1${L2rpcportmod}009
echo
echo "Press ENTER to return to main menu."
read key
;;
CLOSEALL)
/home/admin/BBcloseAllChannels.sh lnd $CHAIN
echo "Press ENTER to return to main menu."

View file

@ -19,7 +19,6 @@ if ! grep -Eq "^suez=" /mnt/hdd/raspiblitz.conf; then
fi
# show info menu
# alias suez="cd /home/suez/suez && /home/suez/.local/bin/poetry run ./suez"
if [ "$1" = "menu" ]; then
dialog --title " Info Suez" --msgbox "
Suez is a command line tool.
@ -34,30 +33,21 @@ fi
if [ "$1" = "1" ] || [ "$1" = "on" ]; then
echo "# INSTALL SUEZ"
# create user
sudo adduser --disabled-password --gecos "" suez
cd /home/suez || exit 1
cd /home/bitcoin || exit 1
# dependency
sudo -u suez curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py\
| sudo -u suez python -
sudo -u bitcoin curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py\
| sudo -u bitcoin python -
# download source code
sudo -u suez git clone https://github.com/prusnak/suez.git
sudo -u bitcoin git clone https://github.com/prusnak/suez.git
cd suez || exit 1
sudo -u suez git reset --hard $SUEZVERSION
sudo -u suez /home/suez/.local/bin/poetry install
sudo -u bitcoin git reset --hard $SUEZVERSION
sudo -u bitcoin /home/bitcoin/.local/bin/poetry install
# make sure symlink to central app-data directory exists ***"
sudo rm -rf /home/suez/.lnd # not a symlink.. delete it silently
# create symlink
sudo ln -s "/mnt/hdd/app-data/lnd/" "/home/suez/.lnd"
# add user to group with admin access to lnd
sudo /usr/sbin/usermod --append --groups lndadmin suez
echo "# Adding alias"
echo "alias suez='cd /home/suez/suez && sudo -u suez /home/suez/.local/bin/poetry run ./suez'"\
echo "alias suez='cd /home/bitcoin/suez && sudo -u bitcoin /home/bitcoin/.local/bin/poetry run ./suez'"\
| sudo tee -a /home/admin/_aliases
# setting value in raspi blitz config
@ -89,14 +79,14 @@ fi
# update
if [ "$1" = "update" ]; then
echo "# UPDATE SUEZ"
cd /home/suez || exit 1
cd /home/bitcoin || exit 1
# dependency
sudo -u suez curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py\
| sudo -u suez python -
sudo -u bitcoin curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py\
| sudo -u bitcoin python -
# download source code
sudo -u suez git clone https://github.com/prusnak/suez.git
sudo -u bitcoin git clone https://github.com/prusnak/suez.git
cd suez || exit 1
sudo -u suez /home/suez/.local/bin/poetry install
sudo -u bitcoin /home/bitcoin/.local/bin/poetry install
echo "# Updated to the latest in https://github.com/prusnak/suez/commits/master"
exit 0
fi

View file

@ -59,6 +59,7 @@ if [ $1 = getvars ];then
# netprefix is: "" | t | s
# portprefix is: "" | 1 | 3
# L2rpcportmod is: 0 | 1 | 3
if [ ${chain} = "test" ];then
netprefix="t"
L1rpcportmod=1
@ -77,6 +78,7 @@ if [ $1 = getvars ];then
fi
echo "netprefix=${netprefix}"
echo "portprefix=${portprefix}"
echo "L2rpcportmod=${L2rpcportmod}"
# CLNETWORK is: bitcoin / signet / testnet
if [ $chain = main ];then
@ -96,5 +98,4 @@ if [ $1 = getvars ];then
fi
#TODO
# where /lnd.conf is not changed to /${netprefix}lnd.conf
# the service remains mainnet only
# where /lnd.conf is not changed to /${netprefix}lnd.conf the service remains for mainnet only