From b50b2cceb39c438fa02704c3f6ccc709077d98d5 Mon Sep 17 00:00:00 2001 From: rootzoll Date: Tue, 11 Dec 2018 00:53:07 +0100 Subject: [PATCH] moved publicIP to raspiconf file --- home.admin/_bootstrap.sh | 38 +++++++++++++++++++++---------- home.admin/assets/lnd.service | 2 +- home.admin/assets/lnd.tor.service | 9 +------- 3 files changed, 28 insertions(+), 21 deletions(-) diff --git a/home.admin/_bootstrap.sh b/home.admin/_bootstrap.sh index 1635949..79b4996 100644 --- a/home.admin/_bootstrap.sh +++ b/home.admin/_bootstrap.sh @@ -66,15 +66,6 @@ if [ ${afterSetupScriptExists} -eq 1 ]; then sleep 100 fi - -################################ -# PUBLIC IP -# for LND on startup -################################ -printf "PUBLICIP=$(curl -vv ipinfo.io/ip 2> /run/publicip.log)\n" > /run/publicip; -chmod 774 /run/publicip - - ################################ # HDD CHECK & PRE-INIT ################################ @@ -221,14 +212,37 @@ if [ ${hddIsAutoMounted} -eq 0 ]; then sudo umount -l /mnt/hdd exit 0 +fi # END - no automount + +##################################### +# UPDATE HDD CONFIG FILE (if exists) +##################################### + +echo "Check if HDD contains configuration .." >> $logFile +configExists=$(ls ${configFile} | grep -c '.conf') +if [ ${configExists} -eq 1 ]; then + + # load values + echo "load and update publicIP" >> $logFile + source ${configFile} + + # update public IP on boot + freshPublicIP=$(curl -vv ipinfo.io/ip 2>/dev/null) + if [ ${#publicIP} -eq 0 ]; then + echo "create value (${freshPublicIP})" >> $logFile + echo "publicIP=${freshPublicIP}" >> $configFile + else + echo "update value (${freshPublicIP})" >> $logFile + sed -i "s/^publicIP=.*/publicIP=${freshPublicIP}/g" ${configFile} + fi + fi ################################ -# INFOFILE BASICS +# SD INFOFILE BASICS ################################ -# EXIT on BOOTSTRAP HERE AT THE MOMENT -echo "DONE BOOTSTRAP (before any configs etc)" >> $logFile sed -i "s/^state=.*/state=ready/g" ${infoFile} sed -i "s/^message=.*/message='waiting login'/g" ${infoFile} +echo "DONE BOOTSTRAP" >> $logFile exit 0 \ No newline at end of file diff --git a/home.admin/assets/lnd.service b/home.admin/assets/lnd.service index 2340762..593c07c 100644 --- a/home.admin/assets/lnd.service +++ b/home.admin/assets/lnd.service @@ -9,7 +9,7 @@ After=bitcoind.service #OnFailure=systemd-sendmail@%n [Service] -EnvironmentFile=/run/publicip +EnvironmentFile=/mnt/hdd/raspiblitz.conf ExecStart=/usr/local/bin/lnd --externalip=${PUBLICIP} PIDFile=/home/bitcoin/.lnd/lnd.pid User=bitcoin diff --git a/home.admin/assets/lnd.tor.service b/home.admin/assets/lnd.tor.service index 5ea48e1..68a2942 100644 --- a/home.admin/assets/lnd.tor.service +++ b/home.admin/assets/lnd.tor.service @@ -9,15 +9,8 @@ After=bitcoind.service #OnFailure=systemd-sendmail@%n [Service] -# get var PUBIP from file -EnvironmentFile=/mnt/hdd/tor/v3Address - -# TOR Hidden Service v2 +EnvironmentFile=/mnt/hdd/raspiblitz.conf ExecStart=/usr/local/bin/lnd --tor.active --tor.v2 --listen=127.0.0.1:9735 - -# TOR Hidden Service v3 -# ExecStart=/usr/local/bin/lnd --tor.active --tor.v3 --externalip=${V3ADDRESS} --listen=127.0.0.1:9735 - PIDFile=/home/bitcoin/.lnd/lnd.pid User=bitcoin Group=bitcoin