aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2021-05-27 22:31:50 +0200
committerGravatar Christian Hesse <mail@eworm.de>2021-06-08 21:07:24 +0200
commit57b0f1b2dd237848f0cdcd19b43b9b0bb16cd15e (patch)
treec902e5edd2cab7506a712c8fae285a3faa6a1c47
parenta1c8716a9523ffff61d1151cf7384cdeb11f27a7 (diff)
global-functions: support loading modules
If script's name starts with "global-functions.d/" it is handled as module: * loaded at startup * triggers reload on update
-rw-r--r--global-functions7
1 files changed, 6 insertions, 1 deletions
diff --git a/global-functions b/global-functions
index 56b9135..9f5be02 100644
--- a/global-functions
+++ b/global-functions
@@ -767,7 +767,7 @@
" Syntax error or missing overlay\?") false;
}
}
- :if ($ScriptVal->"name" = "global-functions") do={
+ :if ($ScriptVal->"name" ~ "^global-functions(\$|\\.d/.)") do={
$LogPrintExit2 info $0 ("Reloading global functions.") false;
:do {
/ system script run global-functions;
@@ -1261,6 +1261,11 @@
}
}
+# load modules
+:foreach Script in=[ / system script find where name ~ "^global-functions\\.d/." ] do={
+ / system script run $Script;
+}
+
# check for required RouterOS version
$RequiredRouterOS "global-functions" "6.47";