From patchwork Wed Jun 13 14:36:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [3/4] configurehood: Only provide hood file from GW/KeyXchange via WWW From: Adrian Schmutzler X-Patchwork-Id: 861 Message-Id: <1528900566-9555-4-git-send-email-freifunk@adrianschmutzler.de> To: franken-dev@freifunk.net Date: Wed, 13 Jun 2018 16:36:05 +0200 Signed-off-by: Adrian Schmutzler --- src/packages/fff/fff-hoods/files/usr/sbin/configurehood | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood index baee487..1c1eda7 100755 --- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood +++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood @@ -12,8 +12,10 @@ sectorfiletmp=/tmp/sectorfile sectorfilewww=/www/hood/sectorfile hoodfilelocal=/etc/hoodfile +hoodfileisauth=/tmp/hoodfileisauth rm -f "$hoodfiletmp" +rm -f "$hoodfileisauth" # auth file is associated with hoodfiletmp, so delete it here, too # Gatewaycheck function isGatewayAvailable() { @@ -77,7 +79,7 @@ if [ -s "$hoodfilelocal" ]; then else # if we have Internet, we download the Hoodfile from the keyxchangev2 if hasInternet ; then - getKeyserverHoodfile "$hoodfiletmp" + getKeyserverHoodfile "$hoodfiletmp" && touch "$hoodfileisauth" rm -f "$sectorfiletmp" [ -s "$sectorfilelocal" ] || rm -f "$sectorfilewww" # If internet present, no custom config should be distributed, except when local file is present @@ -108,7 +110,7 @@ else fi else echo "We have a Gateway in Range, we load the keyxchangev2data from fe80::1" - getGatewayHoodfile "$hoodfiletmp" + getGatewayHoodfile "$hoodfiletmp" && touch "$hoodfileisauth" #UPLINK: Do nothing fi fi @@ -215,7 +217,7 @@ if [ -s "$hoodfiletmp" ]; then # copy the file to webroot so that other mesh routers can download it; # copy only after all other steps so IF can be reentered if something goes wrong cp "$hoodfiletmp" "$hoodfileref" - cp "$hoodfiletmp" "$hoodfilewww" + [ -f "$hoodfileisauth" ] && cp "$hoodfiletmp" "$hoodfilewww" [ -s "$sectorfiletmp" ] && cp "$sectorfiletmp" "$sectorfilewww" # This is a workaround to enable alfred on devices which do not see a configap during initial setup