mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04:19 +00:00
check-routeros-update: install update only, notification on downgrade
This commit is contained in:
parent
2907dbe18f
commit
22a9a11c73
1 changed files with 14 additions and 5 deletions
|
@ -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");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue