aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--check-routeros-update12
-rw-r--r--doc/check-routeros-update.md3
-rw-r--r--global-config4
-rw-r--r--global-config-overlay2
-rw-r--r--global-config.changes1
-rw-r--r--global-functions2
6 files changed, 19 insertions, 5 deletions
diff --git a/check-routeros-update b/check-routeros-update
index 13262f3..e020153 100644
--- a/check-routeros-update
+++ b/check-routeros-update
@@ -7,8 +7,9 @@
# https://git.eworm.de/cgit/routeros-scripts/about/doc/check-routeros-update.md
:global Identity;
-:global SafeUpdateUrl;
+:global SafeUpdateNeighbor;
:global SafeUpdatePatch;
+:global SafeUpdateUrl;
:global SentRouterosUpdateNotification;
:global DeviceInfo;
@@ -57,6 +58,15 @@
$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={
:local Result;
:do {
diff --git a/doc/check-routeros-update.md b/doc/check-routeros-update.md
index 6016a1f..bd25ab1 100644
--- a/doc/check-routeros-update.md
+++ b/doc/check-routeros-update.md
@@ -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
`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`,
`stable` or `testing`) is appended
-* `SafeUpdatePatch`: install patch updates automatically
Usage and invocation
--------------------
diff --git a/global-config b/global-config
index fc8d010..01e62c1 100644
--- a/global-config
+++ b/global-config
@@ -8,7 +8,7 @@
# Make sure all configuration properties are up to date and this
# value is in sync with value in script 'global-functions'!
-:global GlobalConfigVersion 35;
+:global GlobalConfigVersion 36;
# This is used for DNS and backup file.
:global Domain "example.com";
@@ -62,6 +62,8 @@
#:global SafeUpdateUrl "https://example.com/ros/safe-update/";
# Allow to install patch updates automatically.
:global SafeUpdatePatch false;
+# Allow to install updates automatically if seen in neighbor list.
+:global SafeUpdateNeighbor false;
# These thresholds control when to send health notification
# on temperature and voltage.
diff --git a/global-config-overlay b/global-config-overlay
index 250f697..2777519 100644
--- a/global-config-overlay
+++ b/global-config-overlay
@@ -9,7 +9,7 @@
# Make sure all configuration properties are up to date and this
# value is in sync with value in script 'global-functions'!
# Comment or remove to disable change notifications.
-:global GlobalConfigVersion 35;
+:global GlobalConfigVersion 36;
# Copy configuration from global-config here and modify it.
diff --git a/global-config.changes b/global-config.changes
index 8082344..85529eb 100644
--- a/global-config.changes
+++ b/global-config.changes
@@ -39,4 +39,5 @@
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.";
35="Implemented visual feedback for 'mode-button' with configurable LED.";
+ 36="Added support for installing updates automatically if seen in neighbor list.";
};
diff --git a/global-functions b/global-functions
index f4b3ca6..030a9f2 100644
--- a/global-functions
+++ b/global-functions
@@ -8,7 +8,7 @@
# https://git.eworm.de/cgit/routeros-scripts/about/
# expected configuration version
-:global ExpectedConfigVersion 35;
+:global ExpectedConfigVersion 36;
# global variables not to be changed by user
:global GlobalFunctionsReady false;