aboutsummaryrefslogtreecommitdiffstats
path: root/check-routeros-update
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2018-09-10 09:44:36 +0200
committerGravatar Christian Hesse <mail@eworm.de>2018-09-10 09:44:36 +0200
commit8f4986af0bb0ecea13594b9ea2bbcfbaa6c8a7e7 (patch)
tree43018abe95d562d11fc56944908096d382342f33 /check-routeros-update
parenta1951cc86a206abd0b6d46d579a8247af42904f8 (diff)
parent2de26a6617911d88fe0e4c10b861df670f0f17e6 (diff)
Merge branch 'fetch-as-value'
Diffstat (limited to 'check-routeros-update')
-rw-r--r--check-routeros-update19
1 files changed, 15 insertions, 4 deletions
diff --git a/check-routeros-update b/check-routeros-update
index bcbe742..4810368 100644
--- a/check-routeros-update
+++ b/check-routeros-update
@@ -7,6 +7,7 @@
:global "identity";
:global "email-general-to";
:global "email-general-cc";
+:global "safe-update-url";
:global "sent-routeros-update-notification";
:if ([ :len [ / system package find where name="wireless" disabled=no ] ] > 0) do={
@@ -20,15 +21,25 @@
:local installedversion [ / system package update get installed-version ];
:local latestversion [ / system package update get latest-version ];
-:if ($"sent-routeros-update-notification" = $latestversion) do={
- :error ("Already sent the RouterOS update notification for version" . $latestversion . ".");
-}
-
:if ($installedversion != $latestversion) do={
:local channel [ / system package update get channel ];
:local model [ / system routerboard get model ];
:local serialnumber [ / system routerboard get serial-number ];
+ :if ([ :len $"safe-update-url" ] > 0) do={
+ :local result [ / tool fetch check-certificate=yes-without-crl \
+ ($"safe-update-url" . $channel) output=user as-value ];
+ :if ($result->"status" = "finished" && $result->"data" = $latestversion) do={
+ :log info ("Version " . $latestversion . " is assumed safe, updating...");
+ / system package update install;
+ :error "Waiting for system to reboot.";
+ }
+ }
+
+ :if ($"sent-routeros-update-notification" = $latestversion) do={
+ :error ("Already sent the RouterOS update notification for version" . $latestversion . ".");
+ }
+
/ tool e-mail send to=$"email-general-to" cc=$"email-general-cc" \
subject=("[" . $identity . "] RouterOS update notification") \
body=("There is a RouterOS update available\n\n" . \