From 2ff8ee241d27a2d3b010e7e963ffda8249e4659a Mon Sep 17 00:00:00 2001 From: openoms Date: Wed, 25 Dec 2019 01:22:24 +0100 Subject: [PATCH 1/6] nodejs: specify download path --- home.admin/config.scripts/bonus.nodejs.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/home.admin/config.scripts/bonus.nodejs.sh b/home.admin/config.scripts/bonus.nodejs.sh index 33eb22508..4ca1a7d45 100644 --- a/home.admin/config.scripts/bonus.nodejs.sh +++ b/home.admin/config.scripts/bonus.nodejs.sh @@ -57,6 +57,7 @@ if [ ${nodeJSInstalled} -eq 0 ]; then echo "*** Install NodeJS $VERSION-$DISTRO ***" # download + cd /home/admin/download wget https://nodejs.org/dist/$VERSION/node-$VERSION-$DISTRO.tar.xz # checksum isChecksumValid=$(sha256sum node-$VERSION-$DISTRO.tar.xz | grep -c "${CHECKSUM}") From d6d44f10fc368968587e2901c91395ddb4ab7148 Mon Sep 17 00:00:00 2001 From: openoms Date: Wed, 25 Dec 2019 01:23:34 +0100 Subject: [PATCH 2/6] provision: install services with admin --- home.admin/_bootstrap.provision.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/home.admin/_bootstrap.provision.sh b/home.admin/_bootstrap.provision.sh index bd2f0a21e..e91b16a55 100644 --- a/home.admin/_bootstrap.provision.sh +++ b/home.admin/_bootstrap.provision.sh @@ -164,7 +164,7 @@ fi if [ "${rtlWebinterface}" = "on" ]; then echo "Provisioning RTL - run config script" >> ${logFile} sudo sed -i "s/^message=.*/message='Setup RTL (takes time)'/g" ${infoFile} - /home/admin/config.scripts/bonus.rtl.sh on >> ${logFile} 2>&1 + sudo -u admin /home/admin/config.scripts/bonus.rtl.sh on >> ${logFile} 2>&1 sudo systemctl disable RTL # will get enabled after recover dialog else echo "Provisioning RTL - keep default" >> ${logFile} @@ -174,7 +174,7 @@ fi if [ "${loop}" = "on" ]; then echo "Provisioning Lightning Loop - run config script" >> ${logFile} sudo sed -i "s/^message=.*/message='Setup Lightning Loop'/g" ${infoFile} - /home/admin/config.scripts/bonus.loop.sh on >> ${logFile} 2>&1 + sudo -u admin /home/admin/config.scripts/bonus.loop.sh on >> ${logFile} 2>&1 sudo systemctl disable loopd # will get enabled after recover dialog else echo "Provisioning Lightning Loop - keep default" >> ${logFile} @@ -184,7 +184,7 @@ fi if [ "${BTCRPCexplorer}" = "on" ]; then echo "Provisioning BTCRPCexplorer - run config script" >> ${logFile} sudo sed -i "s/^message=.*/message='Setup BTCRPCexplorer (takes time)'/g" ${infoFile} - /home/admin/config.scripts/bonus.btc-rpc-explorer.sh on >> ${logFile} 2>&1 + sudo -u admin /home/admin/config.scripts/bonus.btc-rpc-explorer.sh on >> ${logFile} 2>&1 sudo systemctl disable btc-rpc-explorer # will get enabled after recover dialog else echo "Provisioning BTCRPCexplorer - keep default" >> ${logFile} @@ -194,7 +194,7 @@ fi if [ "${ElectRS}" = "on" ]; then echo "Provisioning ElectRS - run config script" >> ${logFile} sudo sed -i "s/^message=.*/message='Setup ElectRS (takes time)'/g" ${infoFile} - /home/admin/config.scripts/bonus.electrs.sh on >> ${logFile} 2>&1 + sudo -u admin /home/admin/config.scripts/bonus.electrs.sh on >> ${logFile} 2>&1 sudo systemctl disable electrs # will get enabled after recover dialog else echo "Provisioning ElectRS - keep default" >> ${logFile} @@ -212,7 +212,7 @@ fi if [ "${lndmanage}" = "on" ]; then echo "Provisioning lndmanage - run config script" >> ${logFile} sudo sed -i "s/^message=.*/message='Setup lndmanage '/g" ${infoFile} - /home/admin/config.scripts/bonus.lndmanage.sh on >> ${logFile} 2>&1 + sudo -u admin /home/admin/config.scripts/bonus.lndmanage.sh on >> ${logFile} 2>&1 else echo "Provisioning ElectRS - keep default" >> ${logFile} fi From 45bfa65e894f5e7dd567dd9d23956f1a608d8826 Mon Sep 17 00:00:00 2001 From: openoms Date: Wed, 25 Dec 2019 01:41:31 +0100 Subject: [PATCH 3/6] services: start outside of install scripts --- home.admin/00settingsMenuServices.sh | 13 +++++++++---- home.admin/config.scripts/bonus.btc-rpc-explorer.sh | 4 ---- home.admin/config.scripts/bonus.electrs.sh | 4 ---- home.admin/config.scripts/bonus.loop.sh | 4 ---- home.admin/config.scripts/bonus.rtl.sh | 4 ---- 5 files changed, 9 insertions(+), 20 deletions(-) diff --git a/home.admin/00settingsMenuServices.sh b/home.admin/00settingsMenuServices.sh index 283ec01de..62eeb0421 100644 --- a/home.admin/00settingsMenuServices.sh +++ b/home.admin/00settingsMenuServices.sh @@ -128,18 +128,20 @@ if [ "${loop}" != "${choice}" ]; then errorOnInstall=$? if [ "${choice}" = "on" ]; then if [ ${errorOnInstall} -eq 0 ]; then - # add Go vars to current session + sudo systemctl start loopd if [ ${#GOPATH} -eq 0 ]; then whiptail --title " Installed the Lightning Loop Service (loopd) " --msgbox "\ Usage and examples: https://github.com/lightninglabs/loop#loop-out-swaps\n -Start a new terminal session (log in again with ssh) and -start from the command line by typing 'loop' to see the options. +Start from the command line after the reboot +Use the command 'loop' to see the options. " 11 75 + needsReboot=1 else whiptail --title " Installed the Lightning Loop Service (loopd) " --msgbox "\ Usage and examples: https://github.com/lightninglabs/loop#loop-out-swaps\n -Use can use command 'loop' to see the options. +Use the command 'loop' to see the options. " 10 75 + needsReboot=0 fi else l1="FAILED to install Lightning LOOP" @@ -319,6 +321,7 @@ if [ "${rtlWebinterface}" != "${choice}" ]; then errorOnInstall=$? if [ "${choice}" = "on" ]; then if [ ${errorOnInstall} -eq 0 ]; then + sudo systemctl start RTL localip=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/') if [ "${runBehindTor}" = "on" ]; then TOR_ADDRESS=$(sudo cat /mnt/hdd/tor/RTL/hostname) @@ -356,6 +359,7 @@ if [ "${BTCRPCexplorer}" != "${choice}" ]; then errorOnInstall=$? if [ "${choice}" = "on" ]; then if [ ${errorOnInstall} -eq 0 ]; then + sudo sytemctl start btc-rpc-explorer localip=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/') if [ "${runBehindTor}" = "on" ]; then TOR_ADDRESS=$(sudo cat /mnt/hdd/tor/btc-rpc-explorer/hostname) @@ -443,6 +447,7 @@ if [ "${ElectRS}" != "${choice}" ]; then errorOnInstall=$? if [ "${choice}" = "on" ]; then if [ ${errorOnInstall} -eq 0 ]; then + sudo systemctl start electrs localip=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/') if [ "${runBehindTor}" = "on" ]; then TOR_ADDRESS=$(sudo cat /mnt/hdd/tor/electrs/hostname) diff --git a/home.admin/config.scripts/bonus.btc-rpc-explorer.sh b/home.admin/config.scripts/bonus.btc-rpc-explorer.sh index 396b93552..ca7e3ba37 100644 --- a/home.admin/config.scripts/bonus.btc-rpc-explorer.sh +++ b/home.admin/config.scripts/bonus.btc-rpc-explorer.sh @@ -156,10 +156,6 @@ EOF echo "BTC-RPC-explorer already installed." fi - # start service - echo "Starting service" - sudo systemctl start btc-rpc-explorer 2>/dev/null - # setting value in raspi blitz config sudo sed -i "s/^BTCRPCexplorer=.*/BTCRPCexplorer=on/g" /mnt/hdd/raspiblitz.conf diff --git a/home.admin/config.scripts/bonus.electrs.sh b/home.admin/config.scripts/bonus.electrs.sh index e0857774d..7ba70ec5f 100644 --- a/home.admin/config.scripts/bonus.electrs.sh +++ b/home.admin/config.scripts/bonus.electrs.sh @@ -266,7 +266,6 @@ RestartSec=60 WantedBy=multi-user.target " | sudo tee -a /etc/systemd/system/electrs.service sudo systemctl enable electrs - sudo systemctl start electrs # manual start: # sudo -u electrs /home/electrs/.cargo/bin/cargo run --release -- --index-batch-size=10 --electrum-rpc-addr="0.0.0.0:50001" echo "" @@ -277,9 +276,6 @@ WantedBy=multi-user.target else echo "ElectRS is already installed." - # start service - echo "start service" - sudo systemctl start electrs 2>/dev/null fi # setting value in raspiblitz config diff --git a/home.admin/config.scripts/bonus.loop.sh b/home.admin/config.scripts/bonus.loop.sh index 5b1b8ce1b..015a4fd9e 100644 --- a/home.admin/config.scripts/bonus.loop.sh +++ b/home.admin/config.scripts/bonus.loop.sh @@ -63,10 +63,6 @@ WantedBy=multi-user.target else echo "Loop service already installed." fi - - # start service - echo "Starting service" - sudo systemctl start loopd 2>/dev/null # setting value in raspi blitz config sudo sed -i "s/^loop=.*/loop=on/g" /mnt/hdd/raspiblitz.conf diff --git a/home.admin/config.scripts/bonus.rtl.sh b/home.admin/config.scripts/bonus.rtl.sh index d8e778409..eabe69c01 100755 --- a/home.admin/config.scripts/bonus.rtl.sh +++ b/home.admin/config.scripts/bonus.rtl.sh @@ -93,10 +93,6 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then echo "RTL already installed." fi - # start service - echo "Starting service" - sudo systemctl start RTL 2>/dev/null - # setting value in raspi blitz config sudo sed -i "s/^rtlWebinterface=.*/rtlWebinterface=on/g" /mnt/hdd/raspiblitz.conf From 04209f57dc5dfcb29b52c3205ec948ed199831f0 Mon Sep 17 00:00:00 2001 From: openoms Date: Wed, 25 Dec 2019 08:28:01 +0100 Subject: [PATCH 4/6] electrsAddressAPI: set only in _background.sh --- home.admin/config.scripts/bonus.btc-rpc-explorer.sh | 3 ++- home.admin/config.scripts/bonus.electrs.sh | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/home.admin/config.scripts/bonus.btc-rpc-explorer.sh b/home.admin/config.scripts/bonus.btc-rpc-explorer.sh index ca7e3ba37..b432d7c47 100644 --- a/home.admin/config.scripts/bonus.btc-rpc-explorer.sh +++ b/home.admin/config.scripts/bonus.btc-rpc-explorer.sh @@ -163,7 +163,8 @@ EOF echo "monitor with: sudo tail -n 20 -f /mnt/hdd/bitcoin/debug.log" ## Enable BTCEXP_ADDRESS_API if BTC-RPC-Explorer is active - /home/admin/config.scripts/bonus.electrsexplorer.sh + # see /home/admin/config.scripts/bonus.electrsexplorer.sh + # run every 10 min by _background.sh # Hidden Service for BTC-RPC-explorer if Tor is active source /mnt/hdd/raspiblitz.conf diff --git a/home.admin/config.scripts/bonus.electrs.sh b/home.admin/config.scripts/bonus.electrs.sh index 7ba70ec5f..f4836f07c 100644 --- a/home.admin/config.scripts/bonus.electrs.sh +++ b/home.admin/config.scripts/bonus.electrs.sh @@ -307,7 +307,8 @@ WantedBy=multi-user.target fi ## Enable BTCEXP_ADDRESS_API if BTC-RPC-Explorer is active - /home/admin/config.scripts/bonus.electrsexplorer.sh + # see /home/admin/config.scripts/bonus.electrsexplorer.sh + # run every 10 min by _background.sh echo "" echo "To connect through SSL from outside of the local network make sure the port 50002 is forwarded on the router" @@ -344,7 +345,7 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then echo "OK ElectRS removed." ## Disable BTCEXP_ADDRESS_API if BTC-RPC-Explorer is active - /home/admin/config.scripts/bonus.electrsexplorer.sh off + /home/admin/config.scripts/bonus.electrsexplorer.sh else echo "ElectRS is not installed." fi From d07f1bfa72bf56e2b609a3cca24c6f4f5787a6a2 Mon Sep 17 00:00:00 2001 From: openoms Date: Wed, 25 Dec 2019 08:54:47 +0100 Subject: [PATCH 5/6] go, nodejs: specify download dir and clean the tar --- home.admin/config.scripts/bonus.go.sh | 5 +++-- home.admin/config.scripts/bonus.nodejs.sh | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/home.admin/config.scripts/bonus.go.sh b/home.admin/config.scripts/bonus.go.sh index 258144baa..d8890fe62 100755 --- a/home.admin/config.scripts/bonus.go.sh +++ b/home.admin/config.scripts/bonus.go.sh @@ -33,15 +33,16 @@ if [ ${goInstalled} -eq 0 ];then echo "*** Installing Go v${goVersion} for ${goOSversion} ***" # wget https://storage.googleapis.com/golang/go${goVersion}.linux-${goOSversion}.tar.gz - sudo rm *.gz + cd /home/admin/download wget https://dl.google.com/go/go${goVersion}.linux-${goOSversion}.tar.gz if [ ! -f "./go${goVersion}.linux-${goOSversion}.tar.gz" ] then echo "!!! FAIL !!! Download not success." + rm -f go${goVersion}.linux-${goOSversion}.tar.gz* exit 1 fi sudo tar -C /usr/local -xzf go${goVersion}.linux-${goOSversion}.tar.gz - sudo rm *.gz + rm -f go${goVersion}.linux-${goOSversion}.tar.gz* sudo mkdir /usr/local/gocode sudo chmod 777 /usr/local/gocode export GOROOT=/usr/local/go diff --git a/home.admin/config.scripts/bonus.nodejs.sh b/home.admin/config.scripts/bonus.nodejs.sh index 4ca1a7d45..ea1a5feb9 100644 --- a/home.admin/config.scripts/bonus.nodejs.sh +++ b/home.admin/config.scripts/bonus.nodejs.sh @@ -63,6 +63,7 @@ if [ ${nodeJSInstalled} -eq 0 ]; then isChecksumValid=$(sha256sum node-$VERSION-$DISTRO.tar.xz | grep -c "${CHECKSUM}") if [ ${isChecksumValid} -eq 0 ]; then echo "FAIL: The checksum of node-$VERSION-$DISTRO.tar.xz is NOT ${CHECKSUM}" + rm -f node-$VERSION-$DISTRO.tar.xz* exit 1 fi echo "OK CHECKSUM of nodeJS is OK" @@ -70,7 +71,8 @@ if [ ${nodeJSInstalled} -eq 0 ]; then # install sudo mkdir -p /usr/local/lib/nodejs - sudo tar -xJvf node-$VERSION-$DISTRO.tar.xz -C /usr/local/lib/nodejs + sudo tar -xJvf node-$VERSION-$DISTRO.tar.xz -C /usr/local/lib/nodejs + rm -f node-$VERSION-$DISTRO.tar.xz* export PATH=/usr/local/lib/nodejs/node-$VERSION-$DISTRO/bin:$PATH sudo ln -s /usr/local/lib/nodejs/node-$VERSION-$DISTRO/bin/node /usr/bin/node sudo ln -s /usr/local/lib/nodejs/node-$VERSION-$DISTRO/bin/npm /usr/bin/npm From 4da96b9ec0b1bc7eb5638ee164bccc0580dc097a Mon Sep 17 00:00:00 2001 From: openoms Date: Wed, 25 Dec 2019 09:05:51 +0100 Subject: [PATCH 6/6] loop: format messagebox after install --- home.admin/00settingsMenuServices.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/home.admin/00settingsMenuServices.sh b/home.admin/00settingsMenuServices.sh index 62eeb0421..e965d243d 100644 --- a/home.admin/00settingsMenuServices.sh +++ b/home.admin/00settingsMenuServices.sh @@ -132,15 +132,15 @@ if [ "${loop}" != "${choice}" ]; then if [ ${#GOPATH} -eq 0 ]; then 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 after the reboot +Start from the command line after the reboot. Use the command 'loop' to see the options. -" 11 75 +" 11 56 needsReboot=1 else whiptail --title " Installed the Lightning Loop Service (loopd) " --msgbox "\ Usage and examples: https://github.com/lightninglabs/loop#loop-out-swaps\n Use the command 'loop' to see the options. -" 10 75 +" 10 56 needsReboot=0 fi else