From f9a2afdedafc9639bf658335218bd00274364827 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Wed, 2 Jun 2021 23:51:11 +0200 Subject: global-functions: $ScriptInstallUpdate: reload configuration later --- global-functions | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/global-functions b/global-functions index cf4ad7a..ab95f3f 100644 --- a/global-functions +++ b/global-functions @@ -710,6 +710,7 @@ :local ExpectedConfigVersionBefore $ExpectedConfigVersion; :local ReloadGlobalFunctions false; + :local ReloadGlobalConfig false; :local ScriptInstallUpdateBefore [ :tostr $ScriptInstallUpdate ]; :foreach Script in=[ / system script find where source~"^#!rsc( by RouterOS)\?\n" ] do={ @@ -760,13 +761,7 @@ / system script set owner=($ScriptVal->"name") source=$SourceNew \ dont-require-permissions=$DontRequirePermissions $Script; :if ($ScriptVal->"name" = "global-config") do={ - $LogPrintExit2 info $0 ("Reloading global configuration and overlay.") false; - :do { - / system script { run global-config; run global-config-overlay; } - } on-error={ - $LogPrintExit2 error $0 ("Reloading global configuration and overlay failed!" . \ - " Syntax error or missing overlay\?") false; - } + :set ReloadGlobalConfig true; } :if ($ScriptVal->"name" ~ "^global-functions(\$|\\.d/.)") do={ :set ReloadGlobalFunctions true; @@ -796,6 +791,16 @@ } } + :if ($ReloadGlobalConfig = true) do={ + $LogPrintExit2 info $0 ("Reloading global configuration and overlay.") false; + :do { + / system script { run global-config; run global-config-overlay; } + } on-error={ + $LogPrintExit2 error $0 ("Reloading global configuration and overlay failed!" . \ + " Syntax error or missing overlay\?") false; + } + } + :if ($ExpectedConfigVersionBefore != $ExpectedConfigVersion) do={ :global GlobalConfigChanges; :global GlobalConfigMigration; -- cgit v1.2.3-54-g00ecf