mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2024-05-11 05:55:19 +00:00
global-functions: $ScriptInstallUpdate: reload functions just once
This commit is contained in:
@ -709,6 +709,7 @@
|
||||
}
|
||||
|
||||
:local ExpectedConfigVersionBefore $ExpectedConfigVersion;
|
||||
:local ReloadGlobalFunctions false;
|
||||
:local ScriptInstallUpdateBefore [ :tostr $ScriptInstallUpdate ];
|
||||
|
||||
:foreach Script in=[ / system script find where source~"^#!rsc( by RouterOS)\?\n" ] do={
|
||||
@ -768,12 +769,7 @@
|
||||
}
|
||||
}
|
||||
:if ($ScriptVal->"name" ~ "^global-functions(\$|\\.d/.)") do={
|
||||
$LogPrintExit2 info $0 ("Reloading global functions.") false;
|
||||
:do {
|
||||
/ system script run global-functions;
|
||||
} on-error={
|
||||
$LogPrintExit2 error $0 ("Reloading global functions failed!") false;
|
||||
}
|
||||
:set ReloadGlobalFunctions true;
|
||||
}
|
||||
} else={
|
||||
$LogPrintExit2 warning $0 ("Syntax validation for script " . $ScriptVal->"name" . \
|
||||
@ -791,6 +787,15 @@
|
||||
}
|
||||
}
|
||||
|
||||
:if ($ReloadGlobalFunctions = true) do={
|
||||
$LogPrintExit2 info $0 ("Reloading global functions.") false;
|
||||
:do {
|
||||
/ system script run global-functions;
|
||||
} on-error={
|
||||
$LogPrintExit2 error $0 ("Reloading global functions failed!") false;
|
||||
}
|
||||
}
|
||||
|
||||
:if ($ExpectedConfigVersionBefore != $ExpectedConfigVersion) do={
|
||||
:global GlobalConfigChanges;
|
||||
:global GlobalConfigMigration;
|
||||
|
Reference in New Issue
Block a user