4658afb2c6
Avoid commiting configs inbetween to decrease number of flash writes. Fixes #714.
19 lines
407 B
Lua
Executable File
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
|