From 2694f8d2b1d15d16fa5f062612dd7fcf2d392ea8 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Fri, 20 Jan 2023 11:04:52 +0100 Subject: global-functions: $RequiredRouterOS: check for valid version string --- global-functions | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'global-functions') diff --git a/global-functions b/global-functions index da6e112..bfb7b01 100644 --- a/global-functions +++ b/global-functions @@ -656,6 +656,12 @@ :global IfThenElse; :global LogPrintExit2; :global VersionToNum; + + :if (!($Required ~ "^\\d+\\.\\d+((beta|rc|\\.)\\d+|)\$")) do={ + $LogPrintExit2 error $0 ("No valid RouterOS version: " . $Required) false; + :return false; + } + :if ([ $VersionToNum $Required ] > [ $VersionToNum [ /system/package/update/get installed-version ] ]) do={ :if ($Warn = "true") do={ $LogPrintExit2 warning $0 ("This " . [ $IfThenElse ([ :pick $Caller 0 ] = ("\$")) "function" "script" ] . \ -- cgit v1.2.3-70-g09d2