diff --git a/README.md b/README.md index 7eb646d..d252deb 100644 --- a/README.md +++ b/README.md @@ -203,8 +203,8 @@ Available Scripts Available modules ----------------- -* [Manage ports in bridge](doc/global-functions.d/bridge-port-to.md) -* [Manage VLANs on bridge ports](doc/global-functions.d/bridge-port-vlan.md) +* [Manage ports in bridge](doc/mod/bridge-port-to.md) +* [Manage VLANs on bridge ports](doc/mod/bridge-port-vlan.md) Contact ------- diff --git a/doc/global-functions.d/bridge-port-to.md b/doc/mod/bridge-port-to.md similarity index 97% rename from doc/global-functions.d/bridge-port-to.md rename to doc/mod/bridge-port-to.md index e0eba1e..89ee5d0 100644 --- a/doc/global-functions.d/bridge-port-to.md +++ b/doc/mod/bridge-port-to.md @@ -17,7 +17,7 @@ Requirements and installation Just install the module: - $ScriptInstallUpdate global-functions.d/bridge-port-to; + $ScriptInstallUpdate mod/bridge-port-to; Configuration ------------- diff --git a/doc/global-functions.d/bridge-port-vlan.md b/doc/mod/bridge-port-vlan.md similarity index 97% rename from doc/global-functions.d/bridge-port-vlan.md rename to doc/mod/bridge-port-vlan.md index 9df46b0..8b88777 100644 --- a/doc/global-functions.d/bridge-port-vlan.md +++ b/doc/mod/bridge-port-vlan.md @@ -16,7 +16,7 @@ Requirements and installation Just install the module: - $ScriptInstallUpdate global-functions.d/bridge-port-vlan; + $ScriptInstallUpdate mod/bridge-port-vlan; Configuration ------------- diff --git a/global-config b/global-config index 3905c8e..2ad80d7 100644 --- a/global-config +++ b/global-config @@ -8,7 +8,7 @@ # Make sure all configuration properties are up to date and this # value is in sync with value in script 'global-functions'! -:global GlobalConfigVersion 66; +:global GlobalConfigVersion 67; # This is used for DNS and backup file. :global Domain "example.com"; @@ -26,7 +26,7 @@ # You can send Telegram notifications. Register a bot # and add the token and chat ids here, then install the module: -# $ScriptInstallUpdate global-functions.d/notification-telegram +# $ScriptInstallUpdate mod/notification-telegram :global TelegramTokenId ""; :global TelegramChatId ""; #:global TelegramTokenId "123456:ABCDEF-GHI"; @@ -36,7 +36,7 @@ # You can send Matrix notifications. Configure these settings and # install the module: -# $ScriptInstallUpdate global-functions.d/notification-matrix +# $ScriptInstallUpdate mod/notification-matrix :global MatrixHomeServer ""; :global MatrixAccessToken ""; :global MatrixRoom ""; @@ -166,7 +166,7 @@ # Use this for defaults with $ScriptRunOnce # Install module with: -# $ScriptInstallUpdate global-functions.d/scriptrunonce +# $ScriptInstallUpdate mod/scriptrunonce :global ScriptRunOnceBaseUrl ""; :global ScriptRunOnceUrlSuffix ""; diff --git a/global-config-overlay b/global-config-overlay index 1570461..07280cd 100644 --- a/global-config-overlay +++ b/global-config-overlay @@ -8,7 +8,7 @@ # Make sure all configuration properties are up to date and this # value is in sync with value in script 'global-functions'! # Comment or remove to disable news and change notifications. -:global GlobalConfigVersion 66; +:global GlobalConfigVersion 67; # Copy configuration from global-config here and modify it. diff --git a/global-config.changes b/global-config.changes index 2561506..2f30563 100644 --- a/global-config.changes +++ b/global-config.changes @@ -70,6 +70,7 @@ 64="Implemented '\$InspectVar' in module to inspect variables."; 65="Added module to manage VLANs on bridge ports."; 66="Moved script 'bridge-port-to-default' to new module."; + 67="Moved modules to directory with shorter name."; }; # Migration steps to be applied on script updates @@ -77,7 +78,8 @@ 41=":global SendNotification; \$SendNotification (\"Migration mechanism\") (\"Congratulations!\nSuccessfully tested the new migration mechanism.\");"; 47="/ certificate remove [ find where fingerprint=\"731d3d9cfaa061487a1d71445a42f67df0afca2a6c2d2f98ff7b3ce112b1f568\" or fingerprint=\"25847d668eb4f04fdd40b12b6b0740c567da7d024308eb6c2c96fe41d9de218d\" ];"; 52=":global CertificateDownload; :if ([ :len [ / certificate find where fingerprint=\"67add1166b020ae61b8f5fc96813c04c2aa589960796865572a3c7e737613dfd\" or fingerprint=\"96bcec06264976f37460779acf28c5a7cfe8a3c0aae11a8ffcee05c0bddf08c6\" ] ] < 2) do={ \$CertificateDownload \"R3\"; }; / certificate remove [ find where fingerprint=\"0687260331a72403d909f105e69bcf0d32e1bd2493ffc6d9206d11bcd6770739\" ];"; - 54=":global ScriptInstallUpdate; :global TelegramTokenId; :global TelegramChatId; :if ([ :len \$TelegramTokenId ] > 0 && [ :len \$TelegramChatId ] > 0) do={ \$ScriptInstallUpdate global-functions.d/notification-telegram; }"; + 54=":global ScriptInstallUpdate; :global TelegramTokenId; :global TelegramChatId; :if ([ :len \$TelegramTokenId ] > 0 && [ :len \$TelegramChatId ] > 0) do={ \$ScriptInstallUpdate mod/notification-telegram; }"; 61="/ system script remove [ find where name~\"^(early-errors|global-wait|mode-button-(event|scheduler)|script-updates)\\\$\" source~\"^#!rsc by RouterOS\\n\" ];"; - 66=":global ScriptInstallUpdate; :if ([ :len [ / system script find where name=\"bridge-port-to-default\" ] ] > 0) do={ / system script remove [ find where name~\"^bridge-port-to(-default|ggle)\\\$\" ]; \$ScriptInstallUpdate global-functions.d/bridge-port-to; }"; + 66=":global ScriptInstallUpdate; :if ([ :len [ / system script find where name=\"bridge-port-to-default\" ] ] > 0) do={ / system script remove [ find where name~\"^bridge-port-to(-default|ggle)\\\$\" ]; \$ScriptInstallUpdate mod/bridge-port-to; }"; + 67=":global ScriptInstallUpdate; :global CharacterReplace; :foreach Script in=[ / system script find where name~\"^global-functions.d/\" ] do={ / system script set name=[ \$CharacterReplace [ / system script get \$Script name ] \"global-functions.d/\" \"mod/\" ] \$Script; }; \$ScriptInstallUpdate;"; }; diff --git a/global-functions b/global-functions index 813e4b4..85fdf40 100644 --- a/global-functions +++ b/global-functions @@ -8,7 +8,7 @@ # https://git.eworm.de/cgit/routeros-scripts/about/ # expected configuration version -:global ExpectedConfigVersion 66; +:global ExpectedConfigVersion 67; # global variables not to be changed by user :global GlobalFunctionsReady false; @@ -755,7 +755,7 @@ :if ($ScriptVal->"name" = "global-config") do={ :set ReloadGlobalConfig true; } - :if ($ScriptVal->"name" ~ ("^global-functions(\$|\\.d/.)")) do={ + :if ($ScriptVal->"name" = "global-functions" || $ScriptVal->"name" ~ ("^mod/.")) do={ :set ReloadGlobalFunctions true; } } else={ @@ -1242,7 +1242,7 @@ } # load modules -:foreach Script in=[ / system script find where name ~ "^global-functions\\.d/." ] do={ +:foreach Script in=[ / system script find where name ~ "^mod/." ] do={ / system script run $Script; } diff --git a/global-functions.d/bridge-port-to b/mod/bridge-port-to similarity index 94% rename from global-functions.d/bridge-port-to rename to mod/bridge-port-to index 437cba7..40b216c 100644 --- a/global-functions.d/bridge-port-to +++ b/mod/bridge-port-to @@ -1,10 +1,10 @@ #!rsc by RouterOS -# RouterOS script: global-functions.d/bridge-port-to +# RouterOS script: mod/bridge-port-to # Copyright (c) 2013-2021 Christian Hesse # https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md # # reset bridge ports to default bridge -# https://git.eworm.de/cgit/routeros-scripts/about/doc/global-functions.d/bridge-port-to.md +# https://git.eworm.de/cgit/routeros-scripts/about/doc/mod/bridge-port-to.md :global BridgePortTo; diff --git a/global-functions.d/bridge-port-vlan b/mod/bridge-port-vlan similarity index 94% rename from global-functions.d/bridge-port-vlan rename to mod/bridge-port-vlan index 754579a..bfe00e9 100644 --- a/global-functions.d/bridge-port-vlan +++ b/mod/bridge-port-vlan @@ -1,10 +1,10 @@ #!rsc by RouterOS -# RouterOS script: global-functions.d/bridge-port-vlan +# RouterOS script: mod/bridge-port-vlan # Copyright (c) 2013-2021 Christian Hesse # https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md # # manage VLANs on bridge ports -# https://git.eworm.de/cgit/routeros-scripts/about/doc/global-functions.d/bridge-port-vlan.md +# https://git.eworm.de/cgit/routeros-scripts/about/doc/mod/bridge-port-vlan.md :global BridgePortVlan; diff --git a/global-functions.d/inspectvar b/mod/inspectvar similarity index 94% rename from global-functions.d/inspectvar rename to mod/inspectvar index 15da04a..4e10fd6 100644 --- a/global-functions.d/inspectvar +++ b/mod/inspectvar @@ -1,5 +1,5 @@ #!rsc by RouterOS -# RouterOS script: global-functions.d/inspectvar +# RouterOS script: mod/inspectvar # Copyright (c) 2020-2021 Christian Hesse # https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md diff --git a/global-functions.d/ipcalc b/mod/ipcalc similarity index 96% rename from global-functions.d/ipcalc rename to mod/ipcalc index f146fbe..64a03a9 100644 --- a/global-functions.d/ipcalc +++ b/mod/ipcalc @@ -1,5 +1,5 @@ #!rsc by RouterOS -# RouterOS script: global-functions.d/ipcalc +# RouterOS script: mod/ipcalc # Copyright (c) 2020-2021 Christian Hesse # https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md diff --git a/global-functions.d/notification-matrix b/mod/notification-matrix similarity index 98% rename from global-functions.d/notification-matrix rename to mod/notification-matrix index a2f7af0..a78539f 100644 --- a/global-functions.d/notification-matrix +++ b/mod/notification-matrix @@ -1,5 +1,5 @@ #!rsc by RouterOS -# RouterOS script: global-functions.d/notification-matrix +# RouterOS script: mod/notification-matrix # Copyright (c) 2013-2021 Michael Gisbers # Christian Hesse # https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md diff --git a/global-functions.d/notification-telegram b/mod/notification-telegram similarity index 99% rename from global-functions.d/notification-telegram rename to mod/notification-telegram index faf02d7..d575103 100644 --- a/global-functions.d/notification-telegram +++ b/mod/notification-telegram @@ -1,5 +1,5 @@ #!rsc by RouterOS -# RouterOS script: global-functions.d/notification-telegram +# RouterOS script: mod/notification-telegram # Copyright (c) 2013-2021 Christian Hesse # https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md diff --git a/global-functions.d/scriptrunonce b/mod/scriptrunonce similarity index 96% rename from global-functions.d/scriptrunonce rename to mod/scriptrunonce index ce9425b..0b519c3 100644 --- a/global-functions.d/scriptrunonce +++ b/mod/scriptrunonce @@ -1,5 +1,5 @@ #!rsc by RouterOS -# RouterOS script: global-functions.d/scriptrunonece +# RouterOS script: mod/scriptrunonece # Copyright (c) 2020-2021 Christian Hesse # https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md