diff options
author | Christian Hesse <mail@eworm.de> | 2020-07-07 08:55:49 +0200 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2020-07-07 09:27:40 +0200 |
commit | 22a9a11c738300d2ff29e065e9f2edca1f2f7709 (patch) | |
tree | c6a6d85739d94f20f1749829834f61df09c465b0 | |
parent | 2907dbe18f0ac17b9fcae5df56b673d129839d66 (diff) |
check-routeros-update: install update only, notification on downgrade
-rw-r--r-- | check-routeros-update | 19 |
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"); +} |