From fbf55292a4fa15cbd06490b66509884f62f78dbc Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Thu, 13 Jul 2023 09:38:20 +0800 Subject: check-routeros-update: match version with date suffix Neighbor version can have a date suffix. This changes to match only on the beginning. Closes: GH-45 Co-authored-by: Christian Hesse --- check-routeros-update.rsc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/check-routeros-update.rsc b/check-routeros-update.rsc index 1405d4e..c46dc7d 100644 --- a/check-routeros-update.rsc +++ b/check-routeros-update.rsc @@ -18,6 +18,7 @@ :global SentRouterosUpdateNotification; :global DeviceInfo; +:global EscapeForRegEx; :global LogPrintExit2; :global ScriptFromTerminal; :global ScriptLock; @@ -80,7 +81,7 @@ $LogPrintExit2 debug $0 ("Checking for updates...") false; } :if ($SafeUpdateNeighbor = true && [ :len [ /ip/neighbor/find where \ - version=($Update->"latest-version" . " (" . $Update->"channel" . ")") ] ] > 0) do={ + version~("^" . [ $EscapeForRegEx ($Update->"latest-version" . " (" . $Update->"channel" . ")") ]) ] ] > 0) do={ $LogPrintExit2 info $0 ("Seen a neighbor running version " . $Update->"latest-version" . ", updating...") false; $SendNotification2 ({ origin=$0; \ subject=([ $SymbolForNotification "sparkles" ] . "RouterOS update: " . $Update->"latest-version"); \ -- cgit v1.2.3-70-g09d2