diff --git a/tecff-autoupdater-wifi-fallback/Makefile b/tecff-autoupdater-wifi-fallback/Makefile index 7716e53..370ff62 100644 --- a/tecff-autoupdater-wifi-fallback/Makefile +++ b/tecff-autoupdater-wifi-fallback/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=tecff-autoupdater-wifi-fallback -PKG_VERSION:=6 +PKG_VERSION:=7 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) PKG_BUILD_DEPENDS := respondd diff --git a/tecff-autoupdater-wifi-fallback/luasrc/lib/gluon/upgrade/510-autoupdater-wifi-fallback b/tecff-autoupdater-wifi-fallback/luasrc/lib/gluon/upgrade/510-autoupdater-wifi-fallback index ed5c42e..0cd9771 100755 --- a/tecff-autoupdater-wifi-fallback/luasrc/lib/gluon/upgrade/510-autoupdater-wifi-fallback +++ b/tecff-autoupdater-wifi-fallback/luasrc/lib/gluon/upgrade/510-autoupdater-wifi-fallback @@ -89,7 +89,8 @@ uci:save('autoupdater-wifi-fallback') uci:save('network') uci:save('firewall') -local minute = tonumber(util.readfile('/usr/lib/micron.d/autoupdater'):match('^([0-9][0-9]?)%s')) +local content = util.readfile('/usr/lib/micron.d/autoupdater') +local minute = content and tonumber(content:match('^([0-9][0-9]?)%s')) or 0 minute = (minute + 10) % 60 local f = io.open('/usr/lib/micron.d/autoupdater-wifi-fallback', 'w') diff --git a/tecff-autoupdater-wifi-fallback/luasrc/usr/lib/lua/autoupdater-wifi-fallback/util.lua b/tecff-autoupdater-wifi-fallback/luasrc/usr/lib/lua/autoupdater-wifi-fallback/util.lua index 27dcaab..163c197 100644 --- a/tecff-autoupdater-wifi-fallback/luasrc/usr/lib/lua/autoupdater-wifi-fallback/util.lua +++ b/tecff-autoupdater-wifi-fallback/luasrc/usr/lib/lua/autoupdater-wifi-fallback/util.lua @@ -27,14 +27,15 @@ function M.get_available_wifi_networks() for radio, _ in pairs(radios) do local wifitype = iwinfo.type(radio) - local iw = iwinfo[wifitype] - if not iw then - return null - end - local tmplist = iw.scanlist(radio) - for _, net in ipairs(tmplist) do - if net.ssid and net.bssid and net.ssid:match('.*[Ff][Rr][Ee][Ii][Ff][Uu][Nn][Kk].*') then - table.insert (radios[radio], net) + local iw = wifitype and iwinfo[wifitype] + if iw then + local tmplist = iw.scanlist(radio) + if tmplist then + for _, net in ipairs(tmplist) do + if net.ssid and net.bssid and net.ssid:match('.*[Ff][Rr][Ee][Ii][Ff][Uu][Nn][Kk].*') then + table.insert (radios[radio], net) + end + end end end end diff --git a/tecff-autoupdater-wifi-fallback/luasrc/usr/sbin/autoupdater-wifi-fallback b/tecff-autoupdater-wifi-fallback/luasrc/usr/sbin/autoupdater-wifi-fallback index 809aa55..4632d65 100755 --- a/tecff-autoupdater-wifi-fallback/luasrc/usr/sbin/autoupdater-wifi-fallback +++ b/tecff-autoupdater-wifi-fallback/luasrc/usr/sbin/autoupdater-wifi-fallback @@ -91,7 +91,7 @@ end local function run_autoupdater() autil.log('out', 'executing the autoupdater...') - os.execute('/usr/sbin/autoupdater -f -b ' .. branch_name) + return os.execute('/usr/sbin/autoupdater -f -b ' .. branch_name) end local function switch_to_fallback_mode(radio, ssid, bssid) diff --git a/tecff-ssid-changer/Makefile b/tecff-ssid-changer/Makefile index 4ea49d1..9b6d5e8 100644 --- a/tecff-ssid-changer/Makefile +++ b/tecff-ssid-changer/Makefile @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=tecff-ssid-changer PKG_VERSION:=2 -PKG_RELEASE:=0 +PKG_RELEASE:=6 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) diff --git a/tecff-ssid-changer/files/lib/gluon/ssid-changer/ssid-changer.sh b/tecff-ssid-changer/files/lib/gluon/ssid-changer/ssid-changer.sh index 9a3dd37..c1ca508 100755 --- a/tecff-ssid-changer/files/lib/gluon/ssid-changer/ssid-changer.sh +++ b/tecff-ssid-changer/files/lib/gluon/ssid-changer/ssid-changer.sh @@ -66,7 +66,11 @@ fi # check for an active gateway and get its connection quality (TQ) GATEWAY_TQ=0 if [ -f /var/gluon/state/has_default_gw4 ]; then - GATEWAY_TQ="$(batctl gwl -H | grep -e "^\*" | awk -F'[()]' '{print $2}' | tr -d " ")" + GATEWAY_TQ="$(batctl gwl -H 2>/dev/null | grep -e "^\*" | awk -F'[()]' '{print $2}' | tr -d " ")" + # Fallback if default gateway exists but no batman gateway is selected (node is offline for clients) + if [ -z "$GATEWAY_TQ" ]; then + GATEWAY_TQ=0 + fi fi HUP_NEEDED=false