From 654aa290e47d6091f3b0b5b95270c5cc9aad34ed Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Fri, 6 Nov 2020 18:13:06 +0100 Subject: [PATCH] #1740 adding pool to recovery & SSH menus (#1747) --- home.admin/00mainMenu.sh | 8 +++++++- home.admin/00settingsMenuServices.sh | 16 ++++++++++++++++ home.admin/_bootstrap.provision.sh | 9 +++++++++ home.admin/_commands.sh | 9 +++++++-- home.admin/config.scripts/bonus.pool.sh | 7 +++---- 5 files changed, 42 insertions(+), 7 deletions(-) diff --git a/home.admin/00mainMenu.sh b/home.admin/00mainMenu.sh index 5131ec63f..551e06966 100755 --- a/home.admin/00mainMenu.sh +++ b/home.admin/00mainMenu.sh @@ -107,6 +107,9 @@ fi if [ "${zerotier}" == "on" ]; then OPTIONS+=(ZEROTIER "ZeroTier") fi +if [ "${pool}" == "on" ]; then + OPTIONS+=(POOL "Lightning Pool") +fi # Basic Options OPTIONS+=(INFO "RaspiBlitz Status Screen") @@ -234,7 +237,7 @@ case $CHOICE in BOS) sudo /home/admin/config.scripts/bonus.bos.sh menu ;; - PYBLOCK) + PYBLOCK) sudo /home/admin/config.scripts/bonus.pyblock.sh menu ;; THUB) @@ -243,6 +246,9 @@ case $CHOICE in ZEROTIER) sudo /home/admin/config.scripts/bonus.zerotier.sh menu ;; + POOL) + sudo /home/admin/config.scripts/bonus.pool.sh menu + ;; SUBSCRIBE) /home/admin/config.scripts/blitz.subscriptions.py ;; diff --git a/home.admin/00settingsMenuServices.sh b/home.admin/00settingsMenuServices.sh index 9448fa627..2eb1638b9 100755 --- a/home.admin/00settingsMenuServices.sh +++ b/home.admin/00settingsMenuServices.sh @@ -20,6 +20,7 @@ if [ ${#faraday} -eq 0 ]; then faraday="off"; fi if [ ${#bos} -eq 0 ]; then bos="off"; fi if [ ${#pyblock} -eq 0 ]; then pyblock="off"; fi if [ ${#thunderhub} -eq 0 ]; then thunderhub="off"; fi +if [ ${#pool} -eq 0 ]; then pool="off"; fi # show select dialog echo "run dialog ..." @@ -39,6 +40,7 @@ OPTIONS+=(o 'Balance of Satoshis' ${bos}) OPTIONS+=(y 'PyBLOCK' ${pyblock}) OPTIONS+=(f 'Faraday' ${faraday}) OPTIONS+=(m 'lndmanage' ${lndmanage}) +OPTIONS+=(c 'Lightning Pool' ${pool}) CHOICES=$(dialog --title ' Additional Services ' --checklist ' use spacebar to activate/de-activate ' 20 45 12 "${OPTIONS[@]}" 2>&1 >/dev/tty) @@ -347,6 +349,20 @@ else echo "LNbits setting unchanged." fi +# Lightning Pool +choice="off"; check=$(echo "${CHOICES}" | grep -c "c") +if [ ${check} -eq 1 ]; then choice="on"; fi +if [ "${pool}" != "${choice}" ]; then + echo "Pool Setting changed .." + anychange=1 + sudo -u admin /home/admin/config.scripts/bonus.pool.sh ${choice} + if [ "${choice}" = "on" ]; then + sudo -u admin /home/admin/config.scripts/bonus.pool.sh menu + fi +else + echo "Pool setting unchanged." +fi + # JoinMarket process choice choice="off"; check=$(echo "${CHOICES}" | grep -c "j") if [ ${check} -eq 1 ]; then choice="on"; fi diff --git a/home.admin/_bootstrap.provision.sh b/home.admin/_bootstrap.provision.sh index c76b146f5..f2a1207a8 100755 --- a/home.admin/_bootstrap.provision.sh +++ b/home.admin/_bootstrap.provision.sh @@ -519,6 +519,15 @@ else echo "Provisioning Stacking Sats Kraken - keep default" >> ${logFile} fi +# pool +if [ "${pool}" = "on" ]; then + echo "Provisioning Pool - run config script" >> ${logFile} + sudo sed -i "s/^message=.*/message='Setup Pool'/g" ${infoFile} + sudo -u admin /home/admin/config.scripts/bonus.pool.sh on >> ${logFile} 2>&1 +else + echo "Provisioning Pool - keep default" >> ${logFile} +fi + # custom install script from user customInstallAvailable=$(sudo ls /mnt/hdd/app-data/custom-installs.sh 2>/dev/null | grep -c "custom-installs.sh") if [ ${customInstallAvailable} -gt 0 ]; then diff --git a/home.admin/_commands.sh b/home.admin/_commands.sh index 498357435..2238fbe0b 100755 --- a/home.admin/_commands.sh +++ b/home.admin/_commands.sh @@ -147,6 +147,7 @@ function jm() { if [ $(grep -c "joinmarket=on" < /mnt/hdd/raspiblitz.conf) -eq 1 ]; then echo "# switching to the joinmarket user with the command: 'sudo su - joinmarket'" sudo su - joinmarket + echo "# use command 'raspiblitz' to return to menu" else echo "JoinMarket is not installed - to install run:" echo "sudo /home/admin/config.scripts/bonus.joinmarket.sh on" @@ -158,8 +159,8 @@ function jm() { function faraday() { if [ $(grep -c "faraday=on" < /mnt/hdd/raspiblitz.conf) -eq 1 ]; then echo "# switching to the faraday user with the command: 'sudo su - faraday'" - echo "# when done use command 'exit' to return to admin user" - echo "# see faraday options with --> frcli -help" + echo "# use command 'exit' and then 'raspiblitz' to return to menu" + echo "# use command 'frcli --help' now to get more info" sudo su - faraday else echo "Faraday is not installed - to install run:" @@ -172,6 +173,8 @@ function faraday() { function loop() { if [ $(grep -c "loop=on" < /mnt/hdd/raspiblitz.conf) -eq 1 ]; then echo "# switching to the loop user with the command: 'sudo su - loop'" + echo "# use command 'exit' and then 'raspiblitz' to return to menu" + echo "# use command 'loop --help' now to get more info" sudo su - loop else echo "Lightning Loop is not installed - to install run:" @@ -184,6 +187,8 @@ function loop() { function pool() { if [ $(grep -c "pool=on" < /mnt/hdd/raspiblitz.conf) -gt 0 ]; then echo "# switching to the pool user with the command: 'sudo su - pool'" + echo "# use command 'exit' and then 'raspiblitz' to return to menu" + echo "# use command 'pool --help' now to get more info" sudo su - pool else echo "Pool is not installed - to install run:" diff --git a/home.admin/config.scripts/bonus.pool.sh b/home.admin/config.scripts/bonus.pool.sh index e1304b978..a5f6565a8 100644 --- a/home.admin/config.scripts/bonus.pool.sh +++ b/home.admin/config.scripts/bonus.pool.sh @@ -20,11 +20,10 @@ fi # show info menu if [ "$1" = "menu" ]; then - dialog --title " Info Pool Service " --msgbox "\n\ + whiptail --title " Info Pool Service " --msgbox "\ Usage and examples: https://github.com/lightninglabs/pool\n -Use the shortcut 'pool' in the terminal to switch to the dedicated user.\n -Type 'pool' again to see the options. -" 11 56 +Use the shortcut 'pool' in the terminal to switch to the dedicated user and type 'pool' again to see the options. +" 12 56 exit 0 fi