services: add lndmanage (#915)

This commit is contained in:
openoms 2019-12-17 18:33:18 +00:00 committed by GitHub
parent e40e1f65d9
commit 07ec866adc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 81 additions and 2 deletions

View File

@ -19,6 +19,7 @@ if [ ${#touchscreen} -eq 0 ]; then touchscreen=0; fi
if [ ${#lcdrotate} -eq 0 ]; then lcdrotate=0; fi if [ ${#lcdrotate} -eq 0 ]; then lcdrotate=0; fi
if [ ${#BTCPayServer} -eq 0 ]; then BTCPayServer="off"; fi if [ ${#BTCPayServer} -eq 0 ]; then BTCPayServer="off"; fi
if [ ${#ElectRS} -eq 0 ]; then ElectRS="off"; fi if [ ${#ElectRS} -eq 0 ]; then ElectRS="off"; fi
if [ ${#lndmanage} -eq 0 ]; then lndmanage="off"; fi
echo "map chain to on/off" echo "map chain to on/off"
chainValue="off" chainValue="off"
@ -56,7 +57,7 @@ fi
echo "run dialog ..." echo "run dialog ..."
if [ "${runBehindTor}" = "on" ]; then if [ "${runBehindTor}" = "on" ]; then
CHOICES=$(dialog --title ' Additional Services ' --checklist ' use spacebar to activate/de-activate ' 20 45 12 \ CHOICES=$(dialog --title ' Additional Services ' --checklist ' use spacebar to activate/de-activate ' 21 45 13 \
1 'Channel Autopilot' ${autoPilot} \ 1 'Channel Autopilot' ${autoPilot} \
l 'Lightning Loop' ${loop} \ l 'Lightning Loop' ${loop} \
2 'Testnet' ${chainValue} \ 2 'Testnet' ${chainValue} \
@ -69,9 +70,10 @@ b 'BTC-RPC-Explorer' ${BTCRPCexplorer} \
r 'LCD Rotate' ${lcdrotateMenu} \ r 'LCD Rotate' ${lcdrotateMenu} \
e 'Electrum Rust Server' ${ElectRS} \ e 'Electrum Rust Server' ${ElectRS} \
p 'BTCPayServer' ${BTCPayServer} \ p 'BTCPayServer' ${BTCPayServer} \
m 'lndmanage' ${lndmanage} \
2>&1 >/dev/tty) 2>&1 >/dev/tty)
else else
CHOICES=$(dialog --title ' Additional Services ' --checklist ' use spacebar to activate/de-activate ' 21 45 13 \ CHOICES=$(dialog --title ' Additional Services ' --checklist ' use spacebar to activate/de-activate ' 22 45 14 \
1 'Channel Autopilot' ${autoPilot} \ 1 'Channel Autopilot' ${autoPilot} \
l 'Lightning Loop' ${loop} \ l 'Lightning Loop' ${loop} \
2 'Testnet' ${chainValue} \ 2 'Testnet' ${chainValue} \
@ -86,6 +88,7 @@ b 'BTC-RPC-Explorer' ${BTCRPCexplorer} \
r 'LCD Rotate' ${lcdrotateMenu} \ r 'LCD Rotate' ${lcdrotateMenu} \
e 'Electrum Rust Server' ${ElectRS} \ e 'Electrum Rust Server' ${ElectRS} \
p 'BTCPayServer' ${BTCPayServer} \ p 'BTCPayServer' ${BTCPayServer} \
m 'lndmanage' ${lndmanage} \
2>&1 >/dev/tty) 2>&1 >/dev/tty)
fi fi
@ -122,6 +125,10 @@ if [ "${loop}" != "${choice}" ]; then
echo "Loop Setting changed .." echo "Loop Setting changed .."
anychange=1 anychange=1
sudo /home/admin/config.scripts/bonus.loop.sh ${choice} sudo /home/admin/config.scripts/bonus.loop.sh ${choice}
whiptail --title " Installed the Lightning Loop Service (loopd) " --msgbox "\
Usage and examples: https://github.com/lightninglabs/loop#loop-out-swaps\n
Start from the command line by typing 'loop' to see the options.
" 10 75
needsReboot=0 needsReboot=0
else else
echo "Loop Setting unchanged." echo "Loop Setting unchanged."
@ -510,6 +517,24 @@ else
echo "BTCPayServer setting not changed." echo "BTCPayServer setting not changed."
fi fi
# LNDMANAGE process choice
choice="off"; check=$(echo "${CHOICES}" | grep -c "m")
if [ ${check} -eq 1 ]; then choice="on"; fi
if [ "${lndmanage}" != "${choice}" ]; then
echo "lndmanage Setting changed .."
anychange=1
sudo /home/admin/config.scripts/bonus.lndmanage.sh ${choice}
whiptail --title " Installed lndmanage " --msgbox "\
Usage: https://github.com/bitromortac/lndmanage/blob/master/README.md\n
Start with the line:
'cd lndmanage & source venv/bin/activate & lndmanage'\n
To exit: type 'deactivate' and press ENTER
" 12 75
needsReboot=0
else
echo "lndmanage setting unchanged."
fi
if [ ${anychange} -eq 0 ]; then if [ ${anychange} -eq 0 ]; then
dialog --msgbox "NOTHING CHANGED!\nUse Spacebar to check/uncheck services." 8 58 dialog --msgbox "NOTHING CHANGED!\nUse Spacebar to check/uncheck services." 8 58
exit 0 exit 0

View File

@ -0,0 +1,54 @@
#!/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]"
exit 1
fi
# add default value to raspi config if needed
if [ ${#lndmanage} -eq 0 ]; then
echo "lndmanage=off" >> /mnt/hdd/raspiblitz.conf
fi
# install
if [ "$1" = "1" ] || [ "$1" = "on" ]; then
echo "*** INSTALL LNDMANAGE ***"
mkdir lndmanage
cd lndmanage
# activate virtual environment
sudo apt install -y python3-venv
python3 -m venv venv
source venv/bin/activate
# get dependencies
sudo apt install -y python3-dev libatlas-base-dev
pip3 install wheel
pip3 install lndmanage==0.8.0.1
# setting value in raspi blitz config
sudo sed -i "s/^lndmanage=.*/lndmanage=on/g" /mnt/hdd/raspiblitz.conf
echo "usage: https://github.com/bitromortac/lndmanage/blob/master/README.md"
echo "start with the line:"
echo "'cd lndmanage & source venv/bin/activate & lndmanage'"
echo "to exit type 'deactivate' and press ENTER"
exit 0
fi
# switch off
if [ "$1" = "0" ] || [ "$1" = "off" ]; then
# setting value in raspi blitz config
sudo sed -i "s/^lndmanage=.*/lndmanage=off/g" /mnt/hdd/raspiblitz.conf
echo "*** REMOVING LNDMANAGE ***"
sudo rm -rf /home/admin/lndmanage
echo "OK, lndmanage is removed."
exit 0
fi
echo "FAIL - Unknown Parameter $1"
exit 1