From 1a6234f866321aca9bcbf775e993650b08877bec Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Wed, 3 Apr 2019 01:34:42 +0100 Subject: [PATCH] #386 set custom LND port --- home.admin/config.scripts/lnd.setport.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/home.admin/config.scripts/lnd.setport.sh b/home.admin/config.scripts/lnd.setport.sh index e880f82..3b67558 100644 --- a/home.admin/config.scripts/lnd.setport.sh +++ b/home.admin/config.scripts/lnd.setport.sh @@ -1,6 +1,7 @@ #!/bin/bash # based on: https://github.com/rootzoll/raspiblitz/issues/100#issuecomment-465997126 +# based on: https://github.com/rootzoll/raspiblitz/issues/386 if [ $# -eq 0 ]; then echo "small config script set the port LND is running on" @@ -62,6 +63,16 @@ sudo systemctl disable lnd echo "change port in lnd config" sudo sed -i "s/^listen=.*/listen=0.0.0.0:${portnumber}/g" /mnt/hdd/lnd/lnd.conf +# add to raspiblitz.config (so it can survive update) +valueExists=$(sudo cat /mnt/hdd/raspiblitz.conf | grep -c 'customPortLND=') +if [ ${valueExists} -eq 0 ]; then + # add as new value + echo "customPortLND=${portnumber}" >> /mnt/hdd/raspiblitz.conf +else + # update existing value + sudo sed -i "s/^customPortLND=.*/customPortLND=${portnumber}/g" /mnt/hdd/raspiblitz.conf +fi + # editing service file echo "editing /etc/systemd/system/lnd.service" sudo sed -i "s/^ExecStart=\/usr\/local\/bin\/lnd.*/ExecStart=\/usr\/local\/bin\/lnd --externalip=\${publicIP}:${portnumber}/g" /etc/systemd/system/lnd.service