From 9695afcc36aec2c0f431ba77b5c33a18d8bf64a5 Mon Sep 17 00:00:00 2001 From: rootzoll Date: Mon, 14 Jan 2019 20:41:33 +0100 Subject: [PATCH] remove double publicIP entry --- home.admin/_bootstrap.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/home.admin/_bootstrap.sh b/home.admin/_bootstrap.sh index 092c27b..f62fbbe 100644 --- a/home.admin/_bootstrap.sh +++ b/home.admin/_bootstrap.sh @@ -258,6 +258,12 @@ if [ ${configExists} -eq 1 ]; then # update public IP on boot freshPublicIP=$(curl -s http://v4.ipv6-test.com/api/myip.php) publicIPValueExists=$( sudo cat ${configFile} | grep -c 'publicIP=' ) + if [ ${publicIPValueExists} -gt 1 ]; then + # remove one + echo "more then one publiIp entry - removing one" >> $logFile + sed -i "s/^publicIP=.*//g" ${configFile} + publicIPValueExists=$( sudo cat ${configFile} | grep -c 'publicIP=' ) + fi if [ ${publicIPValueExists} -eq 0 ]; then echo "create value (${freshPublicIP})" >> $logFile echo "publicIP=${freshPublicIP}" >> $configFile