aboutsummaryrefslogtreecommitdiffstats
path: root/global-functions
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2023-01-20 11:04:52 +0100
committerGravatar Christian Hesse <mail@eworm.de>2023-01-20 11:26:53 +0100
commit2694f8d2b1d15d16fa5f062612dd7fcf2d392ea8 (patch)
treed4e1aabed6c2277fd62dd2926e0d5880779e5595 /global-functions
parent9033e169210e620b1d2bef1c9ade2b70e82424e6 (diff)
global-functions: $RequiredRouterOS: check for valid version string
Diffstat (limited to 'global-functions')
-rw-r--r--global-functions6
1 files changed, 6 insertions, 0 deletions
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" ] . \