aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2022-07-18 23:46:49 +0200
committerGravatar Christian Hesse <mail@eworm.de>2022-07-18 23:46:49 +0200
commitce03f447699677c456018c84a71accd615d01ea5 (patch)
tree0bfa4de34b3b9b77e0b265161aa4625bfa4daf9f
parentb67b9ec1c17c47fca970449c13c6e94f42a1dcb6 (diff)
check-routeros-update: use a better check for valid version
Currently the latest version in long-term branch is 0.0... And the script is sending downgrade notifications. 😝 Obviously that is not a valid version... With this changen a version has to be 7.0 and above to be considered valid.
-rw-r--r--check-routeros-update8
1 files changed, 4 insertions, 4 deletions
diff --git a/check-routeros-update b/check-routeros-update
index acca9b9..9e1de8e 100644
--- a/check-routeros-update
+++ b/check-routeros-update
@@ -53,10 +53,6 @@ $LogPrintExit2 debug $0 ("Checking for updates...") false;
/system/package/update/check-for-updates without-paging as-value;
:local Update [ /system/package/update/get ];
-:if ([ :len ($Update->"latest-version") ] = 0) do={
- $LogPrintExit2 info $0 ("An empty string is not a valid version.") true;
-}
-
:if ([ $ScriptFromTerminal $0 ] = true && ($Update->"installed-version") = ($Update->"latest-version")) do={
$LogPrintExit2 info $0 ("System is already up to date.") true;
}
@@ -65,6 +61,10 @@ $LogPrintExit2 debug $0 ("Checking for updates...") false;
:local NumLatest [ $VersionToNum ($Update->"latest-version") ];
:local Link ("https://mikrotik.com/download/changelogs/" . $Update->"channel" . "-release-tree");
+:if ($NumLatest < 117505792) do={
+ $LogPrintExit2 info $0 ("The version '" . ($Update->"latest-version") . "' is not a valid version.") true;
+}
+
:if ($NumInstalled < $NumLatest) do={
:if ($SafeUpdatePatch = true && ($NumInstalled & 0xffff0000) = ($NumLatest & 0xffff0000)) do={
$LogPrintExit2 info $0 ("Version " . $Update->"latest-version" . " is a patch release, updating...") false;