aboutsummaryrefslogtreecommitdiffstats
path: root/check-routeros-update
diff options
context:
space:
mode:
Diffstat (limited to 'check-routeros-update')
-rw-r--r--check-routeros-update19
1 files changed, 14 insertions, 5 deletions
diff --git a/check-routeros-update b/check-routeros-update
index 931c32f..ea1fd31 100644
--- a/check-routeros-update
+++ b/check-routeros-update
@@ -44,12 +44,11 @@
$LogPrintExit warning "An empty string is not a valid version." true;
}
-:if ($Update->"installed-version" != $Update->"latest-version") do={
- :local NumInstalled [ $VersionToNum ($Update->"installed-version") ];
- :local NumLatest [ $VersionToNum ($Update->"latest-version") ];
+:local NumInstalled [ $VersionToNum ($Update->"installed-version") ];
+:local NumLatest [ $VersionToNum ($Update->"latest-version") ];
- :if ($SafeUpdatePatch = true && $NumInstalled < $NumLatest && \
- ($NumInstalled & 0xffff0000) = ($NumLatest & 0xffff0000)) do={
+:if ($NumInstalled < $NumLatest) do={
+ :if ($SafeUpdatePatch = true && ($NumInstalled & 0xffff0000) = ($NumLatest & 0xffff0000)) do={
$LogPrintExit info ("Version " . $Update->"latest-version" . " is a patch release, updating...") false;
$SendNotification ("RouterOS update") \
("Version " . $Update->"latest-version" . " is a patch update for " . $Update->"channel" . \
@@ -97,3 +96,13 @@
"" "true";
:set SentRouterosUpdateNotification ($Update->"latest-version");
}
+
+:if ($NumInstalled > $NumLatest) do={
+ $SendNotification ("RouterOS version") \
+ ("A different RouterOS version " . ($Update->"latest-version") . \
+ " is available for " . $Identity . ", but it is a downgrade.\n\n" . \
+ [ $DeviceInfo ] . "\n\n" . \
+ "https://mikrotik.com/download/changelogs/" . $Update->"channel" . "-release-tree") \
+ "" "true";
+ :set SentRouterosUpdateNotification ($Update->"latest-version");
+}