gluon/package/gluon-node-info/luasrc/lib/gluon/upgrade/520-node-info-whitespace-fix

16 lines
452 B
Lua
Executable File

#!/usr/bin/lua
local uci = require('simple-uci').cursor()
local util = require 'gluon.util'
local sname = uci:get_first('gluon-node-info', 'location')
if sname then
local options = {'longitude', 'latitude', 'altitude'}
for _, option in ipairs(options) do
local value = uci:get('gluon-node-info', sname, option)
if value then
uci:set('gluon-node-info', sname, option, util.trim(value))
end
end
uci:save('gluon-node-info')
end