mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-07-13 19:44:28 +02:00
check-routeros-update: support installing patch updates automatically
This commit is contained in:
parent
d8b2055fbc
commit
2907dbe18f
2 changed files with 16 additions and 0 deletions
|
@ -8,12 +8,14 @@
|
||||||
|
|
||||||
:global Identity;
|
:global Identity;
|
||||||
:global SafeUpdateUrl;
|
:global SafeUpdateUrl;
|
||||||
|
:global SafeUpdatePatch;
|
||||||
:global SentRouterosUpdateNotification;
|
:global SentRouterosUpdateNotification;
|
||||||
|
|
||||||
:global DeviceInfo;
|
:global DeviceInfo;
|
||||||
:global LogPrintExit;
|
:global LogPrintExit;
|
||||||
:global ScriptFromTerminal;
|
:global ScriptFromTerminal;
|
||||||
:global SendNotification;
|
:global SendNotification;
|
||||||
|
:global VersionToNum;
|
||||||
|
|
||||||
:local DoUpdate do={
|
:local DoUpdate do={
|
||||||
:if ([ / system script print count-only where name="packages-update" ] > 0) do={
|
:if ([ / system script print count-only where name="packages-update" ] > 0) do={
|
||||||
|
@ -43,6 +45,18 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
:if ($Update->"installed-version" != $Update->"latest-version") do={
|
:if ($Update->"installed-version" != $Update->"latest-version") do={
|
||||||
|
:local NumInstalled [ $VersionToNum ($Update->"installed-version") ];
|
||||||
|
:local NumLatest [ $VersionToNum ($Update->"latest-version") ];
|
||||||
|
|
||||||
|
:if ($SafeUpdatePatch = true && $NumInstalled < $NumLatest && \
|
||||||
|
($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" . \
|
||||||
|
", updating on " . $Identity . "...") "" "true";
|
||||||
|
$DoUpdate;
|
||||||
|
}
|
||||||
|
|
||||||
:if ([ :len $SafeUpdateUrl ] > 0) do={
|
:if ([ :len $SafeUpdateUrl ] > 0) do={
|
||||||
:local Result;
|
:local Result;
|
||||||
:do {
|
:do {
|
||||||
|
|
|
@ -46,6 +46,8 @@
|
||||||
# The configured channel (bugfix, current, release-candidate) is appended.
|
# The configured channel (bugfix, current, release-candidate) is appended.
|
||||||
:global SafeUpdateUrl "";
|
:global SafeUpdateUrl "";
|
||||||
#:global SafeUpdateUrl "https://example.com/ros/safe-update/";
|
#:global SafeUpdateUrl "https://example.com/ros/safe-update/";
|
||||||
|
# Allow to install patch updates automatically.
|
||||||
|
:global SafeUpdatePatch false;
|
||||||
|
|
||||||
# These thresholds control when to send health notification
|
# These thresholds control when to send health notification
|
||||||
# on temperature and voltage.
|
# on temperature and voltage.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue