mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04:19 +00:00
global-functions: introduce and use $RequiredRouterOS
This commit is contained in:
parent
ab267d54b3
commit
faf08b0575
1 changed files with 21 additions and 0 deletions
|
@ -35,6 +35,7 @@
|
||||||
:global MkDir;
|
:global MkDir;
|
||||||
:global ParseKeyValueStore;
|
:global ParseKeyValueStore;
|
||||||
:global RandomDelay;
|
:global RandomDelay;
|
||||||
|
:global RequiredRouterOS;
|
||||||
:global ScriptFromTerminal;
|
:global ScriptFromTerminal;
|
||||||
:global ScriptInstallUpdate;
|
:global ScriptInstallUpdate;
|
||||||
:global ScriptLock;
|
:global ScriptLock;
|
||||||
|
@ -517,6 +518,23 @@
|
||||||
:delay ([ $GetRandomNumber $1 ] . "s");
|
:delay ([ $GetRandomNumber $1 ] . "s");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# check for required RouterOS version
|
||||||
|
:set RequiredRouterOS do={
|
||||||
|
:local Caller [ :tostr $1 ];
|
||||||
|
:local Required [ :tostr $2 ];
|
||||||
|
|
||||||
|
:global IfThenElse;
|
||||||
|
:global LogPrintExit;
|
||||||
|
:global VersionToNum;
|
||||||
|
|
||||||
|
:if ([ $VersionToNum $Required ] > [ $VersionToNum [ / system package update get installed-version ] ]) do={
|
||||||
|
$LogPrintExit warning ("This " . [ $IfThenElse ([ :pick $Caller 0 ] = "\$") "function" "script" ] . \
|
||||||
|
" '" . $Caller . "' (at least specific functionality) requires RouterOS " . $Required . ". Please update!") false;
|
||||||
|
:return false;
|
||||||
|
}
|
||||||
|
:return true;
|
||||||
|
}
|
||||||
|
|
||||||
# check if script is run from terminal
|
# check if script is run from terminal
|
||||||
:set ScriptFromTerminal do={
|
:set ScriptFromTerminal do={
|
||||||
:local Script [ :tostr $1 ];
|
:local Script [ :tostr $1 ];
|
||||||
|
@ -1056,5 +1074,8 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# check for required RouterOS version
|
||||||
|
$RequiredRouterOS "global-functions" "6.43";
|
||||||
|
|
||||||
# signal we are ready
|
# signal we are ready
|
||||||
:set GlobalFunctionsReady true;
|
:set GlobalFunctionsReady true;
|
||||||
|
|
Loading…
Reference in a new issue