From f18b7c6fe1856bf75cfbbbad93c09fb450335bcf Mon Sep 17 00:00:00 2001 From: openoms Date: Sat, 14 Dec 2019 01:26:10 +0000 Subject: [PATCH] services: add loop to menu --- home.admin/00settingsMenuServices.sh | 19 +++++++++++++++++-- home.admin/config.scripts/bonus.loop.sh | 14 ++++++++------ 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/home.admin/00settingsMenuServices.sh b/home.admin/00settingsMenuServices.sh index 64d71ab9..acbea464 100644 --- a/home.admin/00settingsMenuServices.sh +++ b/home.admin/00settingsMenuServices.sh @@ -7,6 +7,7 @@ source /mnt/hdd/raspiblitz.conf echo "services default values" if [ ${#autoPilot} -eq 0 ]; then autoPilot="off"; fi +if [ ${#loop} -eq 0 ]; then loop="off"; fi if [ ${#autoUnlock} -eq 0 ]; then autoUnlock="off"; fi if [ ${#runBehindTor} -eq 0 ]; then runBehindTor="off"; fi if [ ${#rtlWebinterface} -eq 0 ]; then rtlWebinterface="off"; fi @@ -55,8 +56,9 @@ fi echo "run dialog ..." if [ "${runBehindTor}" = "on" ]; then -CHOICES=$(dialog --title ' Additional Services ' --checklist ' use spacebar to activate/de-activate ' 19 45 11 \ +CHOICES=$(dialog --title ' Additional Services ' --checklist ' use spacebar to activate/de-activate ' 20 45 12 \ 1 'Channel Autopilot' ${autoPilot} \ +l 'Lightning Loop' ${loop} \ 2 'Testnet' ${chainValue} \ 3 ${dynDomainMenu} ${domainValue} \ 4 'Run behind TOR' ${runBehindTor} \ @@ -69,8 +71,9 @@ e 'Electrum Rust Server' ${ElectRS} \ p 'BTCPayServer' ${BTCPayServer} \ 2>&1 >/dev/tty) else -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} \ +l 'Lightning Loop' ${loop} \ 2 'Testnet' ${chainValue} \ 3 ${dynDomainMenu} ${domainValue} \ 4 'Run behind TOR' ${runBehindTor} \ @@ -112,6 +115,18 @@ else echo "Autopilot Setting unchanged." fi +# LOOP process choice +choice="off"; check=$(echo "${CHOICES}" | grep -c "l") +if [ ${check} -eq 1 ]; then choice="on"; fi +if [ "${loop}" != "${choice}" ]; then + echo "Loop Setting changed .." + anychange=1 + sudo /home/admin/config.scripts/bonus.loop.sh ${choice} + needsReboot=0 +else + echo "Loop Setting unchanged." +fi + # TESTNET process choice choice="main"; check=$(echo "${CHOICES}" | grep -c "2") if [ ${check} -eq 1 ]; then choice="test"; fi diff --git a/home.admin/config.scripts/bonus.loop.sh b/home.admin/config.scripts/bonus.loop.sh index f823df8a..f3411f6c 100644 --- a/home.admin/config.scripts/bonus.loop.sh +++ b/home.admin/config.scripts/bonus.loop.sh @@ -53,10 +53,10 @@ RestartSec=60 WantedBy=multi-user.target " | sudo tee -a /etc/systemd/system/loopd.service sudo systemctl enable loopd - echo "OK - the the Lightning Loop service is now enabled" + echo "OK - the Lightning Loop service is now enabled" else - echo "RTL already installed." + echo "Loop service already installed." fi # start service @@ -66,6 +66,8 @@ WantedBy=multi-user.target # setting value in raspi blitz config sudo sed -i "s/^loop=.*/loop=on/g" /mnt/hdd/raspiblitz.conf + echo "Find info on how to use on https://github.com/lightninglabs/loop#loop-out-swaps" + exit 0 fi @@ -75,12 +77,12 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then # setting value in raspi blitz config sudo sed -i "s/^loop=.*/loop=off/g" /mnt/hdd/raspiblitz.conf - isInstalled=$(sudo ls /etc/systemd/system/loop.service 2>/dev/null | grep -c 'loop.service') + isInstalled=$(sudo ls /etc/systemd/system/loopd.service 2>/dev/null | grep -c 'loopd.service') if [ ${isInstalled} -eq 1 ]; then echo "*** REMOVING LIGHTNING LOOP SERVICE ***" - sudo systemctl stop loop - sudo systemctl disable loop - sudo rm /etc/systemd/system/loop.service + sudo systemctl stop loopd + sudo systemctl disable loopd + sudo rm /etc/systemd/system/loopd.service sudo rm -rf /home/bitcoin/loop echo "OK, the Loop Service is removed." else