Skip to content
Snippets Groups Projects
520-node-info-autolocation 523 B
Newer Older
#!/usr/bin/lua

local site = require 'gluon.site_config'
local uci = require('luci.model.uci').cursor()
local config = 'gluon-node-info'
local auto_location = uci:get(config, uci:get_first(config, 'location'), 'auto_location')
if site.location.autolocation then
  default_autolocation = tonumber(site.location.autolocation)
else
  default_autolocation = 0
end

if not auto_location then
  uci:set(config, uci:get_first(config, 'location'),'auto_location', default_autolocation)
  uci:save(config)
  uci:commit(config)
end