From patchwork Fri Jan 5 11:03:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: fff-hoods: Replace hiddenapflag by check for real conditions From: Adrian Schmutzler X-Patchwork-Id: 747 Message-Id: <1515150239-3154-1-git-send-email-freifunk@adrianschmutzler.de> To: franken-dev@freifunk.net Date: Fri, 5 Jan 2018 12:03:59 +0100 Instead of using the hiddenapflag file, we can just check whether the hood file copy used by the webserver is present. As a second condition, we check whether the w2configap is not configured yet. This fixes the following minor issue: Previously, if configurehood has run once, the hiddenapflag was set, but the configap not set up yet. If then a restart happens, the flag is gone (/tmp), but not recreated until a change in the hood file appears. Thus, no configap would be set up until that point. Since we check for a real condition now, this can't be happening. Signed-off-by: Adrian Schmutzler --- src/packages/fff/fff-hoods/files/usr/sbin/configurehood | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood index 34f31a2..95a1bf4 100755 --- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood +++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood @@ -9,7 +9,6 @@ sectorlocal=/etc/sectorfile sectortmp=/tmp/sectorfile sectorcopy=/www/hood/sectorfile -hiddenapfile=/tmp/hiddenapflag resetnetworkfile=/tmp/resetnetwork hoodlocal=/etc/hoodfile @@ -39,7 +38,7 @@ hasInternet() { # Hidden AP check -if [ -f "$hiddenapfile" ]; then +if [ -s "$hoodfilecopy" ] && ! uci -q get wireless.w2configap > /dev/null ; then if isGatewayAvailable ; then for radio in $(uci show wireless | sed -n 's,.*\.\([a-z0-9]*\)=wifi-device,\1,p'); do @@ -59,8 +58,6 @@ if [ -f "$hiddenapfile" ]; then uci commit network wifi - - rm "$hiddenapfile" fi fi @@ -240,9 +237,6 @@ if [ -s "$hoodfile" ]; then exit 1 fi - # here we set a bit for add hidden AP - touch "$hiddenapfile" - # add 802.11s mesh if type == "802.11s" if ( [ -n "$radio5" ] && [ "$mesh_type5" == "802.11s" ] ) || [ "$mesh_type2" == "802.11s" ]; then if ! wifiAddMesh "$radio" "$mesh_id"; then