From f68a5662b6fb9361e4f4f815abf9c152fb3c870b Mon Sep 17 00:00:00 2001 From: kb-light Date: Thu, 28 Apr 2016 09:34:33 +0200 Subject: [PATCH] gluon-node-info: add a script to fix whitespaces within the coordinates Signed-off-by: kb-light --- .../lib/gluon/upgrade/520-node-info-whitespace-fix | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 package/gluon-node-info/files/lib/gluon/upgrade/520-node-info-whitespace-fix diff --git a/package/gluon-node-info/files/lib/gluon/upgrade/520-node-info-whitespace-fix b/package/gluon-node-info/files/lib/gluon/upgrade/520-node-info-whitespace-fix new file mode 100755 index 00000000..49e7053d --- /dev/null +++ b/package/gluon-node-info/files/lib/gluon/upgrade/520-node-info-whitespace-fix @@ -0,0 +1,14 @@ +#!/usr/bin/lua +local uci = require('luci.model.uci').cursor() + +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, value:trim()) + end + end + uci:save('gluon-node-info') +end