From 1032bbdf9cc9e9d749ad41f46e819245cfbdbd97 Mon Sep 17 00:00:00 2001 From: kb-light Date: Sun, 12 Nov 2017 15:04:05 +0100 Subject: [PATCH 1/2] gluon-autoupdater: add the posibility to delay the autoupdate on a node --- .../luasrc/lib/gluon/upgrade/500-autoupdater | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package/gluon-autoupdater/luasrc/lib/gluon/upgrade/500-autoupdater b/package/gluon-autoupdater/luasrc/lib/gluon/upgrade/500-autoupdater index a4e042a9..07061620 100755 --- a/package/gluon-autoupdater/luasrc/lib/gluon/upgrade/500-autoupdater +++ b/package/gluon-autoupdater/luasrc/lib/gluon/upgrade/500-autoupdater @@ -47,6 +47,7 @@ autoupdater_util.randomseed() local minute = math.random(0, 59) local f = io.open('/usr/lib/micron.d/autoupdater', 'w') -f:write(string.format('%i 4 * * * /usr/sbin/autoupdater\n', minute)) -f:write(string.format('%i 0-3,5-23 * * * /usr/sbin/autoupdater --fallback\n', minute)) +f:write(string.format('%i 4 * * * [ "$(uci -q get autoupdater.settings.delay)" == "1" ] && /usr/sbin/autoupdater --fallback || /usr/sbin/autoupdater\n', minute)) +f:write(string.format('%i 5 * * * [ "$(uci -q get autoupdater.settings.delay)" == "1" ] && /usr/sbin/autoupdater || /usr/sbin/autoupdater --fallback\n', minute)) +f:write(string.format('%i 0-3,6-23 * * * /usr/sbin/autoupdater --fallback\n', minute)) f:close() From 1bf872badd96be81731441c3cfb4d754c6506978 Mon Sep 17 00:00:00 2001 From: kb-light Date: Sun, 12 Nov 2017 15:04:40 +0100 Subject: [PATCH 2/2] gluon-web-autoupdater: make autoupdater delay configurable via advanced settings --- package/gluon-web-autoupdater/i18n/de.po | 12 ++++++++++++ package/gluon-web-autoupdater/i18n/fr.po | 9 +++++++++ .../i18n/gluon-web-autoupdater.pot | 9 +++++++++ .../luasrc/lib/gluon/web/model/admin/autoupdater.lua | 9 +++++++++ 4 files changed, 39 insertions(+) diff --git a/package/gluon-web-autoupdater/i18n/de.po b/package/gluon-web-autoupdater/i18n/de.po index 9f1fbecf..2c639845 100644 --- a/package/gluon-web-autoupdater/i18n/de.po +++ b/package/gluon-web-autoupdater/i18n/de.po @@ -18,3 +18,15 @@ msgstr "Branch" msgid "Enable" msgstr "Aktivieren" + +msgid "Delay" +msgstr "Verzögerung" + +msgid "" +"You can delay the regular autoupdate for about an hour. This may be useful " +"if using the PoE passthrough for powering another node." + +msgstr "" +"Du kannst das reguläre automatische Update um eine Stunde verzögern. Dies " +"kann hilfreich sein, wenn du PoE-Passthrough nutzt, um einen weiteren Knoten " +"zu versorgen." diff --git a/package/gluon-web-autoupdater/i18n/fr.po b/package/gluon-web-autoupdater/i18n/fr.po index fec24176..a9f6238d 100644 --- a/package/gluon-web-autoupdater/i18n/fr.po +++ b/package/gluon-web-autoupdater/i18n/fr.po @@ -18,3 +18,12 @@ msgstr "Branche" msgid "Enable" msgstr "Activer" + +msgid "Delay" +msgstr "Retard" + +msgid "" +"You can delay the regular autoupdate for about an hour. This may be useful " +"if using the PoE passthrough for powering another node." + +msgstr "" diff --git a/package/gluon-web-autoupdater/i18n/gluon-web-autoupdater.pot b/package/gluon-web-autoupdater/i18n/gluon-web-autoupdater.pot index 1cce85c3..aefd88bf 100644 --- a/package/gluon-web-autoupdater/i18n/gluon-web-autoupdater.pot +++ b/package/gluon-web-autoupdater/i18n/gluon-web-autoupdater.pot @@ -9,3 +9,12 @@ msgstr "" msgid "Enable" msgstr "" + +msgid "Delay" +msgstr "" + +msgid "" +"You can delay the regular autoupdate for about an hour. This may be useful " +"if using the PoE passthrough for powering another node." + +msgstr "" diff --git a/package/gluon-web-autoupdater/luasrc/lib/gluon/web/model/admin/autoupdater.lua b/package/gluon-web-autoupdater/luasrc/lib/gluon/web/model/admin/autoupdater.lua index adf7cbd6..9107bc0d 100644 --- a/package/gluon-web-autoupdater/luasrc/lib/gluon/web/model/admin/autoupdater.lua +++ b/package/gluon-web-autoupdater/luasrc/lib/gluon/web/model/admin/autoupdater.lua @@ -32,6 +32,15 @@ function o:write(data) uci:set("autoupdater", autoupdater, "branch", data) end +o = s:option(Flag, "delay", translate("Delay"), translate( + "You can delay the regular autoupdate for about an hour. This may " .. + "be useful if using the PoE passthrough for powering another node." +)) +o.default = uci:get_bool("autoupdater", autoupdater, "delay") +function o:write(data) + uci:set("autoupdater", autoupdater, "delay", data) +end + function f:write() uci:commit("autoupdater") end