diff --git a/package/gluon-autoupdater/luasrc/lib/gluon/upgrade/500-autoupdater b/package/gluon-autoupdater/luasrc/lib/gluon/upgrade/500-autoupdater index 6ccd3072f91c7a9d23d5af3567d9a81d058b8d3f..10f6197f77b656061c2f2cd4b1a91613a178eef8 100755 --- a/package/gluon-autoupdater/luasrc/lib/gluon/upgrade/500-autoupdater +++ b/package/gluon-autoupdater/luasrc/lib/gluon/upgrade/500-autoupdater @@ -21,16 +21,21 @@ for name, config in pairs(site.autoupdater.branches()) do end end -if not uci:get('autoupdater', 'settings') then - local enabled = unistd.access('/lib/gluon/autoupdater/default_enabled') ~= nil - - local branch = site.autoupdater.branch(min_branch) +local function default_branch() local f = io.open('/lib/gluon/autoupdater/default_branch') if f then - branch = f:read('*line') + local ret = f:read('*line') f:close() + return ret end + return site.autoupdater.branch(min_branch) +end + +if not uci:get('autoupdater', 'settings') then + local enabled = unistd.access('/lib/gluon/autoupdater/default_enabled') ~= nil + + local branch = default_branch() if not branch then enabled = false end