gluon/package/gluon-node-info/files/lib/gluon/upgrade/510-node-info-role
Matthias Schiffer 4658afb2c6 gluon-core: commit all UCI configs at the end
Avoid commiting configs inbetween to decrease number of flash writes.

Fixes #714.
2016-04-02 18:56:45 +02:00

19 lines
407 B
Lua
Executable File

#!/usr/bin/lua
local site = require 'gluon.site_config'
local uci = require('luci.model.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