Commit 307f4d1e authored by chrissi^'s avatar chrissi^
Browse files

autoupdater-wifi-fallback: Use mirror from autoupdater config

Also: write the fallback_mirrors into the autoupdater config using the
upgrade-script.
Writing the mirrors here is a little dirty. Better would be to write
them from the site.conf. But this is a task for later me.
parent 615106b1
......@@ -31,9 +31,14 @@ uci:section('network', 'interface', 'fallback6',{
sourcefilter = false,
})
uci:set('autoupdater', 'stable', 'fallback_mirror', 'http://firmware.freifunk-bs.de/stable/sysupgrade')
uci:set('autoupdater', 'beta', 'fallback_mirror', 'http://firmware.freifunk-bs.de/beta/sysupgrade')
uci:set('autoupdater', 'experimental', 'fallback_mirror', 'http://firmware.freifunk-bs.de/experimental/sysupgrade')
uci:save('autoupdater-wifi-fallback')
uci:save('network')
uci:save('wireless')
uci:save('autoupdater')
local minute = tonumber(autil.read_file('/usr/lib/micron.d/autoupdater'):match('^([0-9][0-9]?)%s'))
minute = (minute + 10) % 60
......
......@@ -8,6 +8,14 @@ local force = false
local min_uptime_secs = 3600
local branch_name = uci:get('autoupdater', 'settings', 'branch')
local mirrors = uci:get('autoupdater', branch_name, 'fallback_mirror')
local mirror = nil
if mirrors == nil then
io.popen('logger -s -t autoupdater-wifi-fallback -p local0.info "no fallback_url for current autoupdater branch. exit"')
os.exit(1)
end
mirror = mirrors
local function parse_args()
local i = 1
while arg[i] do
......@@ -65,7 +73,7 @@ end
local function run_autoupdater()
io.popen('logger -s -t autoupdater-wifi-fallback -p local0.info "execute the autoupdater"')
os.execute('/usr/sbin/autoupdater -f -b ' .. branch_name)
os.execute('/usr/sbin/autoupdater -f -b ' .. branch_name .. ' ' .. mirror)
end
local function switch_to_fallback_mode(radio, ssid, bssid)
......@@ -127,6 +135,8 @@ if (pfc and not coc) or force then
end
uci:save(configname)
io.popen('logger -s -t autoupdater-wifi-fallback -p local0.info "Offline since ' .. tostring(os.time() - tonumber(unreachable_since)) .. 's"')
io.popen('logger -s -t autoupdater-wifi-fallback -p local0.info "Need ' .. tostring(offset) .. 's to fall back to wifi-client. Waiting"')
if force or tonumber(unreachable_since) + offset < os.time() then
io.popen('logger -s -t autoupdater-wifi-fallback -p local0.info "going to fallback mode"')
for radio, netlist in pairs(autil.get_available_wifi_networks()) do
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment