mirror of https://github.com/aredn/aredn.git
Retry failed firmware version downloads (#1053)
This commit is contained in:
parent
185d6e0abf
commit
931bc07c0a
|
@ -274,34 +274,40 @@ if parms.button_refresh_fw then
|
||||||
do
|
do
|
||||||
firmware_versions[k] = v
|
firmware_versions[k] = v
|
||||||
end
|
end
|
||||||
local err = false
|
|
||||||
local board_type = aredn.hardware.get_board_type():gsub(",", "_")
|
local board_type = aredn.hardware.get_board_type():gsub(",", "_")
|
||||||
|
local firmware_list = {}
|
||||||
|
for attempt = 1, 3
|
||||||
|
do
|
||||||
for ver, data in pairs(firmware_versions)
|
for ver, data in pairs(firmware_versions)
|
||||||
do
|
do
|
||||||
local raw = io.popen(curl .. " -o - " .. config_serverpath .. data .. "/overview.json 2> /dev/null")
|
local raw = io.popen(curl .. " -o - " .. config_serverpath .. data .. "/overview.json 2> /dev/null")
|
||||||
local info = luci.jsonc.parse(raw:read("*a") or "")
|
local info = luci.jsonc.parse(raw:read("*a") or "")
|
||||||
raw:close()
|
raw:close()
|
||||||
firmware_versions[ver] = nil
|
|
||||||
if info then
|
if info then
|
||||||
|
firmware_versions[ver] = nil
|
||||||
for _, profile in ipairs(info.profiles)
|
for _, profile in ipairs(info.profiles)
|
||||||
do
|
do
|
||||||
if profile.id == board_type or ((board_type == "qemu-standard-pc-i440fx-piix-1996" or board_type == "VMware, Inc. VMware Virtual Platform") and profile.id == "generic" and profile.target == "x86/64") then
|
if profile.id == board_type or ((board_type == "qemu-standard-pc-i440fx-piix-1996" or board_type == "VMware, Inc. VMware Virtual Platform") and profile.id == "generic" and profile.target == "x86/64") then
|
||||||
firmware_versions[ver] = {
|
firmware_list[ver] = {
|
||||||
overview = config_serverpath .. data .. "/" .. profile.target .. "/" .. profile.id .. ".json",
|
overview = config_serverpath .. data .. "/" .. profile.target .. "/" .. profile.id .. ".json",
|
||||||
target = info.image_url:gsub("{target}", profile.target)
|
target = info.image_url:gsub("{target}", profile.target)
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
end
|
||||||
err = true
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local f = io.open("/tmp/web/firmware.list", "w")
|
local f = io.open("/tmp/web/firmware.list", "w")
|
||||||
if f then
|
if f then
|
||||||
f:write(luci.jsonc.stringify(firmware_versions, true))
|
f:write(luci.jsonc.stringify(firmware_list, true))
|
||||||
f:close()
|
f:close()
|
||||||
end
|
end
|
||||||
|
local err = false
|
||||||
|
for _, _ in pairs(firmware_versions)
|
||||||
|
do
|
||||||
|
err = true
|
||||||
|
end
|
||||||
if err then
|
if err then
|
||||||
fwout("Failed to load all firmware versions. List is incomplete")
|
fwout("Failed to load all firmware versions. List is incomplete")
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue