From 7d20cec9cc59d09ac8d33fe7b8b662eba7629732 Mon Sep 17 00:00:00 2001 From: Jan-Tarek Butt <buttjantarek@googlemail.com> Date: Wed, 20 May 2015 00:31:46 +0200 Subject: [PATCH] add mesh_eth check and remove debuging code --- .../files/lib/ffnw/autoupdater-mod/autoupdater | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/autoupdater-mod/files/lib/ffnw/autoupdater-mod/autoupdater b/autoupdater-mod/files/lib/ffnw/autoupdater-mod/autoupdater index c47882b..0283676 100755 --- a/autoupdater-mod/files/lib/ffnw/autoupdater-mod/autoupdater +++ b/autoupdater-mod/files/lib/ffnw/autoupdater-mod/autoupdater @@ -10,6 +10,7 @@ local autoupdater_util = require('autoupdater.util') local autoupdater_version = require('autoupdater.version') local pidPath="/var/run/autoupdater.pid" local direct_vpn= false +local mesh_lan = false if io.open(pidPath, "r") ~=nil then io.stderr:write("The autoupdater is still running.\n") @@ -31,20 +32,15 @@ function wait(seconds) repeat until os.time() > start + seconds end -function write_new_firmware_version(f_version) - local dateV = os.date() - local fileV = io.open("/etc/config/upgradeV", "a") - fileV:write( f_version .. " | " .. dateV .. '\n') - fileV:close() - return 0 -end - local foreach_count=1 for originator in io.popen(string.format("cat /sys/kernel/debug/batman_adv/bat0/originators"), 'r'):lines() do if foreach_count > 2 then if string.find(originator,"vpn") ~= nil then direct_vpn=true end + if string.find(originator,"eth") ~= nil then + mesh_lan = true + end end foreach_count = foreach_count + 1 end @@ -218,12 +214,12 @@ local function autoupdate(mirror) if direct_vpn == true then wait(28800) -- Wait for 8h + elseif mesh_lan == true then + wait(21600) -- Wait for 6h else wait(14400) -- Wait for 4h end - write_new_firmware_version(manifest.version) - io.stderr:write('Upgrading firmware...\n') local null = nixio.open('/dev/null', 'w+') if null then -- GitLab