gluon/package/gluon-node-info/files/lib/gluon/upgrade/510-node-info-role
Matthias Schiffer 6cf03bab37
treewide: replace normal uses of luci.model.uci with simple-uci to reduce LuCI dependencies
We also make use of the boolean support of simple-uci to make scripts
clearer.
2017-02-10 02:10:01 +01:00

19 lines
403 B
Lua
Executable File

#!/usr/bin/lua
local site = require 'gluon.site_config'
local uci = require('simple-uci').cursor()
local config = 'gluon-node-info'
local role = uci:get(config, uci:get_first(config, 'system'), 'role')
if site.roles then
default_role = site.roles.default
else
default_role = ''
end
if not role then
uci:set(config, uci:get_first(config, 'system'), 'role', default_role)
uci:save(config)
end