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.
This commit is contained in:
Christian Hesse 2022-07-18 23:46:49 +02:00
parent b67b9ec1c1
commit ce03f44769

View file

@ -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;