From 0ace56d72966b98f873a69422a55725b36183d2e Mon Sep 17 00:00:00 2001 From: Jan-Tarek Butt <buttjantarek@googlemail.com> Date: Mon, 13 Jul 2015 18:53:52 +0200 Subject: [PATCH] add two new upgrade script for siteconf --- .../gluon/upgrade/520-node-info-autolocation | 19 +++++++++++++++++++ .../lib/gluon/upgrade/530-node-info-interval | 19 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100755 ffnw-node-info/files/lib/gluon/upgrade/520-node-info-autolocation create mode 100755 ffnw-node-info/files/lib/gluon/upgrade/530-node-info-interval diff --git a/ffnw-node-info/files/lib/gluon/upgrade/520-node-info-autolocation b/ffnw-node-info/files/lib/gluon/upgrade/520-node-info-autolocation new file mode 100755 index 0000000..491184c --- /dev/null +++ b/ffnw-node-info/files/lib/gluon/upgrade/520-node-info-autolocation @@ -0,0 +1,19 @@ +#!/usr/bin/lua + +local site = require 'gluon.site_config' +local uci = require('luci.model.uci').cursor() + +local config = 'gluon-node-info' +local autolocation = uci:get(config, uci:get_first(config, 'location'), 'auto_location') + +if site.location then + default_autolocation = site.location.autolocation +else + default_autolocation = autolocation +end + +if autolocation == 0 then + uci:set(config, uci:get_first(config, 'location'), 'auto_location', default_autolocation) + uci:save(config) + uci:commit(config) +end diff --git a/ffnw-node-info/files/lib/gluon/upgrade/530-node-info-interval b/ffnw-node-info/files/lib/gluon/upgrade/530-node-info-interval new file mode 100755 index 0000000..1878598 --- /dev/null +++ b/ffnw-node-info/files/lib/gluon/upgrade/530-node-info-interval @@ -0,0 +1,19 @@ +#!/usr/bin/lua + +local site = require 'gluon.site_config' +local uci = require('luci.model.uci').cursor() + +local config = 'gluon-node-info' +local interval = uci:get(config, uci:get_first(config, 'location'), 'refresh_interval') + +if site.location then + default_interval = site.location.interval +else + default_interval = interval +end + +if autolocation == 0 then + uci:set(config, uci:get_first(config, 'location'), 'refresh_interval', default_interval) + uci:save(config) + uci:commit(config) +end -- GitLab