global-config: dropped $ScriptUpdatesIgnore, use ignore flag in comment

This commit is contained in:
Christian Hesse 2020-07-14 16:32:17 +02:00
parent d1b6ca3d0b
commit f4d6e07dbb
6 changed files with 23 additions and 17 deletions

View file

@ -17,8 +17,9 @@ procedure please follow [the long way in detail](README.md#the-long-way-in-detai
:foreach Script in={ "global-config"; "global-config-overlay"; "global-functions" } do={ :foreach Script in={ "global-config"; "global-config-overlay"; "global-functions" } do={
/ system script add name=$Script source=([ / tool fetch check-certificate=yes-without-crl ("https://git.eworm.de/cgit/routeros-scripts/plain/" . $Script) output=user as-value]->"data"); / system script add name=$Script source=([ / tool fetch check-certificate=yes-without-crl ("https://git.eworm.de/cgit/routeros-scripts/plain/" . $Script) output=user as-value]->"data");
} }
/ system script set comment="ignore" global-config-overlay;
/ system script { run global-config; run global-config-overlay; run global-functions; } / system script { run global-config; run global-config-overlay; run global-functions; }
/ system scheduler add name="global-scripts" start-time=startup on-event="/ system script { run global-config; run global-config-overlay; run global-functions; }" / system scheduler add name="global-scripts" start-time=startup on-event="/ system script { run global-config; run global-config-overlay; run global-functions; }";
$CertificateNameByCN "ISRG Root X1"; $CertificateNameByCN "ISRG Root X1";
$CertificateNameByCN "Let's Encrypt Authority X3"; $CertificateNameByCN "Let's Encrypt Authority X3";
$CertificateNameByCN "DST Root CA X3"; $CertificateNameByCN "DST Root CA X3";

View file

@ -92,6 +92,10 @@ Now let's download the main scripts and add them in configuration on the fly.
[admin@MikroTik] > :foreach Script in={ "global-config"; "global-config-overlay"; "global-functions" } do={ / system script add name=$Script source=([ / tool fetch check-certificate=yes-without-crl ("https://git.eworm.de/cgit/routeros-scripts/plain/" . $Script) output=user as-value]->"data"); } [admin@MikroTik] > :foreach Script in={ "global-config"; "global-config-overlay"; "global-functions" } do={ / system script add name=$Script source=([ / tool fetch check-certificate=yes-without-crl ("https://git.eworm.de/cgit/routeros-scripts/plain/" . $Script) output=user as-value]->"data"); }
Mark `global-config-overlay` not to be overwritten by future updates.
[admin@MikroTik] > / system script set comment="ignore" global-config-overlay
The configuration needs to be tweaked for your needs. Make sure not to send The configuration needs to be tweaked for your needs. Make sure not to send
your mails to `mail@example.com`! Edit `global-config-overlay`, copy your mails to `mail@example.com`! Edit `global-config-overlay`, copy
configuration from `global-config`. configuration from `global-config`.

View file

@ -8,7 +8,7 @@
# Make sure all configuration properties are up to date and this # Make sure all configuration properties are up to date and this
# value is in sync with value in script 'global-functions'! # value is in sync with value in script 'global-functions'!
:global GlobalConfigVersion 21; :global GlobalConfigVersion 22;
# This is used for DNS and backup file. # This is used for DNS and backup file.
:global Domain "example.com"; :global Domain "example.com";
@ -111,9 +111,7 @@
#:global ScriptUpdatesBaseUrl "https://raw.githubusercontent.com/eworm-de/routeros-scripts/master/"; #:global ScriptUpdatesBaseUrl "https://raw.githubusercontent.com/eworm-de/routeros-scripts/master/";
#:global ScriptUpdatesBaseUrl "https://gitlab.com/eworm-de/routeros-scripts/raw/master/"; #:global ScriptUpdatesBaseUrl "https://gitlab.com/eworm-de/routeros-scripts/raw/master/";
:global ScriptUpdatesUrlSuffix ""; :global ScriptUpdatesUrlSuffix "";
:global ScriptUpdatesIgnore {
"global-config"
}
# This project is developed in private spare time and usage is free of charge # This project is developed in private spare time and usage is free of charge
# for you. If you like the scripts and think this is of value for you or your # for you. If you like the scripts and think this is of value for you or your
# business please consider a donation: # business please consider a donation:

View file

@ -9,13 +9,7 @@
# Make sure all configuration properties are up to date and this # Make sure all configuration properties are up to date and this
# value is in sync with value in script 'global-functions'! # value is in sync with value in script 'global-functions'!
# Comment or remove to disable change notifications. # Comment or remove to disable change notifications.
:global GlobalConfigVersion 21; :global GlobalConfigVersion 22;
# The global-config script is updated by $ScriptInstallUpdate,
# global-config-overlay becomes an overlay for your changes.
:global ScriptUpdatesIgnore {
"global-config-overlay"
}
# Copy configuration from global-config here and modify it. # Copy configuration from global-config here and modify it.

View file

@ -25,4 +25,5 @@
19="Commenting scripts with 'ignore', 'base-url=...' and 'url-suffix=...' is honored on update"; 19="Commenting scripts with 'ignore', 'base-url=...' and 'url-suffix=...' is honored on update";
20="Added support for hooks to 'netwatch-notify'"; 20="Added support for hooks to 'netwatch-notify'";
21="Added support for installing patch updates automatically by 'check-routeros-update'"; 21="Added support for installing patch updates automatically by 'check-routeros-update'";
22="Dropped '\$ScriptUpdatesIgnore' from global configuration, auto-migrating to ignore flag in comment"
}; };

View file

@ -8,7 +8,7 @@
# https://git.eworm.de/cgit/routeros-scripts/about/ # https://git.eworm.de/cgit/routeros-scripts/about/
# expected configuration version # expected configuration version
:global ExpectedConfigVersion 21; :global ExpectedConfigVersion 22;
# global variables not to be changed by user # global variables not to be changed by user
:global GlobalFunctionsReady false; :global GlobalFunctionsReady false;
@ -529,11 +529,19 @@
} }
:if ([ :len $SourceNew ] = 0 && $ScriptUpdatesFetch = true) do={ :if ([ :len $SourceNew ] = 0 && $ScriptUpdatesFetch = true) do={
:foreach IgnoreLoop in=$ScriptUpdatesIgnore do={
:if ($IgnoreLoop = $ScriptVal->"name") do={ :set Ignore 1; }
}
:local Comment [ $ParseKeyValueStore ($ScriptVal->"comment") ]; :local Comment [ $ParseKeyValueStore ($ScriptVal->"comment") ];
:if ($Comment->"ignore" = true) do={ :set Ignore 1; } :if ($Comment->"ignore" = true) do={
:set Ignore 1;
} else={
# TODO: remove at later time
:foreach IgnoreLoop in=$ScriptUpdatesIgnore do={
:if ($IgnoreLoop = $ScriptVal->"name") do={
:set Ignore 1;
$LogPrintExit info ("Migrating script " . $ScriptVal->"name" . " to ignore flag in comment.") false;
/ system script set comment="ignore" ($ScriptVal->"name");
}
}
}
:if ($Ignore = 0) do={ :if ($Ignore = 0) do={
$LogPrintExit debug ("Fetching script from url: " . $ScriptVal->"name") false; $LogPrintExit debug ("Fetching script from url: " . $ScriptVal->"name") false;