gluon-autoupdater: revert to default branch when configured branch is invalid
An invalid branch may be set for various reasons: - Previous firmware had an invalid default branch - Branch list has changed and old UCI branch config was removed by a site-specific upgrade script - Manual UCI configuration
This commit is contained in:
parent
2c65f0834b
commit
53cf8796c7
@ -32,19 +32,23 @@ local function default_branch()
|
||||
return site.autoupdater.branch(min_branch)
|
||||
end
|
||||
|
||||
local enabled, branch
|
||||
if not uci:get('autoupdater', 'settings') then
|
||||
local enabled = unistd.access('/lib/gluon/autoupdater/default_enabled') ~= nil
|
||||
enabled = unistd.access('/lib/gluon/autoupdater/default_enabled') ~= nil
|
||||
end
|
||||
|
||||
local branch = default_branch()
|
||||
local old_branch = uci:get('autoupdater', 'settings', 'branch')
|
||||
if not old_branch or not uci:get('autoupdater', old_branch) then
|
||||
branch = default_branch()
|
||||
if not branch then
|
||||
enabled = false
|
||||
end
|
||||
end
|
||||
|
||||
uci:section('autoupdater', 'autoupdater', 'settings', {
|
||||
enabled = enabled,
|
||||
branch = branch,
|
||||
})
|
||||
end
|
||||
|
||||
uci:set('autoupdater', 'settings', 'version_file', '/lib/gluon/release')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user