raspiblitz/home.admin/config.scripts/bonus.lndmanage.sh
/rootzoll 75171c09e3
merge prepare v1.9.0rc5 (#3824)
* extend sd card before fatpack (#3783)
* Fatpack sd card expand (#3784)
* extend sd card before fatpack
* fix expansion detection
* Bump lnbits to 0.10.5 and add path to poetry in systemd script (#3787)
* fix: don't reinstall same CLN version + fmt (#3796)
* fix: lnd check for rpcmiddleware (#3804)
* fix: joininbox update, hide jm api error from lcd (#3801)
* fix: hide jm api error from lcd
* joininbox update to v0.7.8
* fix: remove lnbits user when off, improve checks (#3798)
* reduce bitcoind memory usage w  MALLOC_ARENA_MAX=1 (#3780)
* Misc fixed towards v1.9.0 (#3808)
* get web api info
* #3772 increase curl timeout
* #3805 change "Please Login"
* #3807 fix cln jrpc socket access (#3815)
* Btcpay 193 (#3812)
* Update BTCPay v1.9.3
* btcpay verify with web-flow
* lnbits 0.10.6 update (#3814)
* Fatpack: LCD on & cl-plugin.cln-grpc OFF (#3817)
* make sure fatpack is LCD activated
* remove cl-plugin.cln-grpc.sh by default
* #3793 fix socket jrpc
* lndmanage 0.15.0 (#3818)

---------

Co-authored-by: Stephan Oeste <emzy@emzy.de>
Co-authored-by: openoms <43343391+openoms@users.noreply.github.com>
2023-05-11 17:12:28 +02:00

115 lines
3.7 KiB
Bash
Executable file

#!/bin/bash
# command info
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
echo "config script to install or uninstall lndmanage"
echo "bonus.lndmanage.sh [on|off|menu]"
exit 1
fi
# set version of LND manage to install
# https://github.com/bitromortac/lndmanage/releases
lndmanageVersion="0.15.0"
pgpKeyDownload="https://github.com/bitromortac.gpg"
gpgFingerprint="0453B9F5071261A40FDB34181965063FC13BEBE2"
source /mnt/hdd/raspiblitz.conf
# show info menu
if [ "$1" = "menu" ]; then
dialog --title " Info lndmanage " --msgbox "\n\
Usage: https://github.com/bitromortac/lndmanage/blob/master/README.md or
lndmanage --help.\n
To start type: 'manage' in the command line.
" 9 75
exit 0
fi
# install
if [ "$1" = "1" ] || [ "$1" = "on" ]; then
directoryExists=$(sudo ls /home/admin/lndmanage 2>/dev/null | wc -l)
if [ ${directoryExists} -gt 0 ]; then
echo "# FAIL - LNDMANAGE already installed"
sleep 3
exit 1
fi
echo "*** INSTALL LNDMANAGE ***"
# make sure needed os dependencies are installed
sudo apt-get install -y libatlas-base-dev
# prepare directory
mkdir /home/admin/lndmanage 2>/dev/null
sudo chown admin:admin /home/admin/lndmanage
echo "# downloading files ..."
cd /home/admin/lndmanage
sudo -u admin wget -N https://github.com/bitromortac/lndmanage/releases/download/v${lndmanageVersion}/lndmanage-${lndmanageVersion}-py3-none-any.whl
sudo -u admin wget -N https://github.com/bitromortac/lndmanage/releases/download/v${lndmanageVersion}/lndmanage-${lndmanageVersion}-py3-none-any.whl.asc
sudo -u admin wget -N ${pgpKeyDownload} -O sigingkey.gpg
echo "# checking signing keys ..."
gpg --import sigingkey.gpg
verifyResult=$(LANG=en_US.utf8; gpg --verify lndmanage-${lndmanageVersion}-py3-none-any.whl.asc 2>&1)
goodSignature=$(echo ${verifyResult} | grep 'Good signature' -c)
correctKey=$(echo ${verifyResult} | tr -d " \t\n\r" | grep "${gpgFingerprint}" -c)
echo "goodSignature='${goodSignature}'"
echo "correctKey='${correctKey}'"
if [ ${goodSignature} -gt 0 ] && [ ${correctKey} -gt 0 ]; then
echo "# OK signature is valid"
else
echo "error='invalid signature'"
sudo rm -rf /home/admin/lndmanage
sleep 5
exit 1
fi
echo "# installing ..."
python3 -m venv venv
source /home/admin/lndmanage/venv/bin/activate
python3 -m pip install lndmanage-${lndmanageVersion}-py3-none-any.whl
# get build dependencies
# python3 -m pip install --upgrade pip wheel setuptools
# install lndmanage
# python3 -m pip install lndmanage==0.11.0
# check if install was successful
if [ $(python3 -m pip list | grep -c "lndmanage") -eq 0 ]; then
echo
echo "## FAIL --> Was not able to install LNDMANAGE"
echo "## Maybe because of internet network issues - try again later."
sudo rm -rf /home/admin/lndmanage
sleep 5
exit 1
fi
# setting value in raspi blitz config
/home/admin/config.scripts/blitz.conf.sh set lndmanage "on"
echo "#######################################################################"
echo "# OK install done"
echo "#######################################################################"
echo "# To start type: 'manage' in the command line."
echo "# To exit the venv - type 'deactivate' and press ENTER"
echo "# usage: https://github.com/bitromortac/lndmanage/blob/master/README.md"
echo "# usage: lndmanage --help"
exit 0
fi
# switch off
if [ "$1" = "0" ] || [ "$1" = "off" ]; then
# setting value in raspi blitz config
/home/admin/config.scripts/blitz.conf.sh set lndmanage "off"
echo "*** REMOVING LNDMANAGE ***"
sudo rm -rf /home/admin/lndmanage
echo "# OK, lndmanage is removed."
exit 0
fi
echo "FAIL - Unknown Parameter $1"
exit 1