#if no Internet, we connect to the hidden AP and download the file from another Node in range
else
# connect to wireless hidden ap here and download the json File from the nearest router
# Only do that, when we have no gateway in range. If the Uplinkrouter changed the hood, we lost the GW and do this automatically again, I think! Nice idea?
if ! isGatewayAvailable ; then
#now we haven't a gateway in Range, we search for a hidden AP to get a keyxchangev2data file!
#first we delete all wifi settings
rm -f /www/public/keyxchangev2data # delete this, so interfaces are recreated if reconnect with unchanged hood file takes place
if ! wifiDelAll; then
echo "Can't delete current wifi setup"
exit 1
fi
#now we look for phy and add this
for phy in $(iw phy | awk '/^Wiphy/{ print $2 }'); do
radio="$(wifiAddPhyCond "$phy" "2" "$chan2ghz")"
radio5="$(wifiAddPhyCond "$phy" "5" "$chan5ghz")"
[ -n "$radio5" ] && radio="$radio5"
#and here we add the station
if ! wifiAddSta "$radio" "config.franken.freifunk.net" "configSta"; then
echo "Can't add Sta interface on $radio."
exit 1
else
uci -q set network.configSta=interface
uci -q set network.configSta.proto='static'
uci -q commit network
fi
done
wifi
# wait a moment to start the interface
sleep 10;
# and here we can download the Hoodfile from the other node