mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-06-23 01:58:40 +02:00
check-routeros-update: support installing updates automatically if seen in neighbor list
This commit is contained in:
parent
7f356d76bf
commit
98c132105d
6 changed files with 19 additions and 5 deletions
|
@ -7,8 +7,9 @@
|
||||||
# https://git.eworm.de/cgit/routeros-scripts/about/doc/check-routeros-update.md
|
# https://git.eworm.de/cgit/routeros-scripts/about/doc/check-routeros-update.md
|
||||||
|
|
||||||
:global Identity;
|
:global Identity;
|
||||||
:global SafeUpdateUrl;
|
:global SafeUpdateNeighbor;
|
||||||
:global SafeUpdatePatch;
|
:global SafeUpdatePatch;
|
||||||
|
:global SafeUpdateUrl;
|
||||||
:global SentRouterosUpdateNotification;
|
:global SentRouterosUpdateNotification;
|
||||||
|
|
||||||
:global DeviceInfo;
|
:global DeviceInfo;
|
||||||
|
@ -57,6 +58,15 @@
|
||||||
$DoUpdate;
|
$DoUpdate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:if ($SafeUpdateNeighbor = true && [ :len [ / ip neighbor find where \
|
||||||
|
version=($Update->"latest-version" . " (" . $Update->"channel" . ")") ] ] > 0) do={
|
||||||
|
$LogPrintExit info ("Seen a neighbor running version " . $Update->"latest-version" . ", updating...") false;
|
||||||
|
$SendNotification ([ $SymbolForNotification "sparkles" ] . "RouterOS update") \
|
||||||
|
("Seen a neighbor running version " . $Update->"latest-version" . " from " . $Update->"channel" . \
|
||||||
|
", updating on " . $Identity . "...") "" "true";
|
||||||
|
$DoUpdate;
|
||||||
|
}
|
||||||
|
|
||||||
:if ([ :len $SafeUpdateUrl ] > 0) do={
|
:if ([ :len $SafeUpdateUrl ] > 0) do={
|
||||||
:local Result;
|
:local Result;
|
||||||
:do {
|
:do {
|
||||||
|
|
|
@ -34,9 +34,10 @@ Configuration is required only if you want to control update process with
|
||||||
safe versions from a web server. The configuration goes to
|
safe versions from a web server. The configuration goes to
|
||||||
`global-config-overlay`, this is the parameter:
|
`global-config-overlay`, this is the parameter:
|
||||||
|
|
||||||
|
* `SafeUpdateNeighbor`: install updates automatically if seen in neighbor list
|
||||||
|
* `SafeUpdatePatch`: install patch updates automatically
|
||||||
* `SafeUpdateUrl`: url to check for safe update, the channel (`long-term`,
|
* `SafeUpdateUrl`: url to check for safe update, the channel (`long-term`,
|
||||||
`stable` or `testing`) is appended
|
`stable` or `testing`) is appended
|
||||||
* `SafeUpdatePatch`: install patch updates automatically
|
|
||||||
|
|
||||||
Usage and invocation
|
Usage and invocation
|
||||||
--------------------
|
--------------------
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
# Make sure all configuration properties are up to date and this
|
# Make sure all configuration properties are up to date and this
|
||||||
# value is in sync with value in script 'global-functions'!
|
# value is in sync with value in script 'global-functions'!
|
||||||
:global GlobalConfigVersion 35;
|
:global GlobalConfigVersion 36;
|
||||||
|
|
||||||
# This is used for DNS and backup file.
|
# This is used for DNS and backup file.
|
||||||
:global Domain "example.com";
|
:global Domain "example.com";
|
||||||
|
@ -62,6 +62,8 @@
|
||||||
#:global SafeUpdateUrl "https://example.com/ros/safe-update/";
|
#:global SafeUpdateUrl "https://example.com/ros/safe-update/";
|
||||||
# Allow to install patch updates automatically.
|
# Allow to install patch updates automatically.
|
||||||
:global SafeUpdatePatch false;
|
:global SafeUpdatePatch false;
|
||||||
|
# Allow to install updates automatically if seen in neighbor list.
|
||||||
|
:global SafeUpdateNeighbor 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.
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
# Make sure all configuration properties are up to date and this
|
# Make sure all configuration properties are up to date and this
|
||||||
# value is in sync with value in script 'global-functions'!
|
# value is in sync with value in script 'global-functions'!
|
||||||
# Comment or remove to disable change notifications.
|
# Comment or remove to disable change notifications.
|
||||||
:global GlobalConfigVersion 35;
|
:global GlobalConfigVersion 36;
|
||||||
|
|
||||||
# Copy configuration from global-config here and modify it.
|
# Copy configuration from global-config here and modify it.
|
||||||
|
|
||||||
|
|
|
@ -39,4 +39,5 @@
|
||||||
33="Added configurable deviation on health temperature recovery threshold against notification flooding.";
|
33="Added configurable deviation on health temperature recovery threshold against notification flooding.";
|
||||||
34="Introduced script 'ospf-to-leds' to visualize OSPF instance state via LEDs.";
|
34="Introduced script 'ospf-to-leds' to visualize OSPF instance state via LEDs.";
|
||||||
35="Implemented visual feedback for 'mode-button' with configurable LED.";
|
35="Implemented visual feedback for 'mode-button' with configurable LED.";
|
||||||
|
36="Added support for installing updates automatically if seen in neighbor list.";
|
||||||
};
|
};
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
# https://git.eworm.de/cgit/routeros-scripts/about/
|
# https://git.eworm.de/cgit/routeros-scripts/about/
|
||||||
|
|
||||||
# expected configuration version
|
# expected configuration version
|
||||||
:global ExpectedConfigVersion 35;
|
:global ExpectedConfigVersion 36;
|
||||||
|
|
||||||
# global variables not to be changed by user
|
# global variables not to be changed by user
|
||||||
:global GlobalFunctionsReady false;
|
:global GlobalFunctionsReady false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue