mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-04-12 05:39:22 +02:00
#312 localIP as placeholder if publiIP not available
This commit is contained in:
parent
56c0c2ccec
commit
140c82ad01
@ -50,6 +50,8 @@ if [ ${existsHDD} -gt 0 ]; then
|
||||
configFile="/mnt/hdd/raspiblitz.conf"
|
||||
configExists=$(sudo ls ${configFile} | grep -c 'raspiblitz.conf')
|
||||
if [ ${configExists} -eq 0 ]; then
|
||||
|
||||
# create file and use init values from raspiblitz.info
|
||||
source /home/admin/_version.info
|
||||
sudo touch $configFile
|
||||
sudo chmod 777 ${configFile}
|
||||
@ -58,6 +60,17 @@ if [ ${existsHDD} -gt 0 ]; then
|
||||
echo "network=${network}" >> $configFile
|
||||
echo "chain=${chain}" >> $configFile
|
||||
echo "hostname=${hostname}" >> $configFile
|
||||
|
||||
# try to determine publicIP and if not possible use localIP as placeholder
|
||||
# https://github.com/rootzoll/raspiblitz/issues/312#issuecomment-462675101
|
||||
freshPublicIP=$(curl -s http://v4.ipv6-test.com/api/myip.php)
|
||||
if [ ${#freshPublicIP} -eq 0 ]; then
|
||||
localIP=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
|
||||
echo "WARNING: No publicIP information at all yet - working with placeholder : ${localIP}"
|
||||
freshPublicIP="${localIP}"
|
||||
fi
|
||||
echo "publicIP=${freshPublicIP}" >> $configFile
|
||||
|
||||
fi
|
||||
|
||||
# move SSH pub keys to HDD so that they survive an update
|
||||
|
@ -73,12 +73,6 @@ echo "enable lazy firewall"
|
||||
sudo ufw --force enable
|
||||
echo ""
|
||||
|
||||
# set raspi config as environment for lnd service
|
||||
sudo systemctl stop lnd
|
||||
sudo systemctl disable lnd
|
||||
sudo sed -i "s/^EnvironmentFile=.*/EnvironmentFile=\/mnt\/hdd\/raspiblitz.conf/g" /etc/systemd/system/lnd.service
|
||||
sudo systemctl enable lnd
|
||||
|
||||
# update system
|
||||
echo ""
|
||||
echo "*** Update System ***"
|
||||
|
@ -288,6 +288,15 @@ if [ ${configExists} -eq 1 ]; then
|
||||
# wait otherwise looking for publicIP fails
|
||||
sleep 5
|
||||
freshPublicIP=$(curl -s http://v4.ipv6-test.com/api/myip.php)
|
||||
if [ ${#freshPublicIP} -eq 0 ]; then
|
||||
# prevent having no publicIP set at all and LND getting stuck
|
||||
# https://github.com/rootzoll/raspiblitz/issues/312#issuecomment-462675101
|
||||
if [ ${#publicIP} -eq 0 ]; then
|
||||
localIP=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
|
||||
echo "WARNING: No publicIP information at all - working with placeholder: ${localIP}" >> $logFile
|
||||
freshPublicIP="${localIP}"
|
||||
fi
|
||||
fi
|
||||
if [ ${#freshPublicIP} -eq 0 ]; then
|
||||
echo "WARNING: Was not able to determine external IP on startup." >> $logFile
|
||||
else
|
||||
|
@ -9,7 +9,7 @@ After=bitcoind.service
|
||||
#OnFailure=systemd-sendmail@%n
|
||||
|
||||
[Service]
|
||||
EnvironmentFile=
|
||||
EnvironmentFile=/mnt/hdd/raspiblitz.conf
|
||||
ExecStart=/usr/local/bin/lnd --externalip=${publicIP}
|
||||
PIDFile=/home/bitcoin/.lnd/lnd.pid
|
||||
User=bitcoin
|
||||
|
Loading…
x
Reference in New Issue
Block a user