global-config: new setting to disable news and change notifications...

... and also drop the version from global-config and
global-config-overlay.
This commit is contained in:
Christian Hesse 2022-07-06 12:54:40 +02:00
parent 68ae4fca0d
commit a1606402d1
8 changed files with 16 additions and 25 deletions

View file

@ -195,7 +195,7 @@
</tspan><tspan </tspan><tspan
x="180" x="180"
y="176.08282" y="176.08282"
id="tspan13491"> Current: 78 id="tspan13491"> Version: 83
</tspan><tspan </tspan><tspan
x="180" x="180"
y="191.08282" y="191.08282"

Before

Width:  |  Height:  |  Size: 9.3 KiB

After

Width:  |  Height:  |  Size: 9.3 KiB

View file

@ -195,7 +195,7 @@
</tspan><tspan </tspan><tspan
x="180" x="180"
y="175.85" y="175.85"
id="tspan10793"> Current: 78 id="tspan10793"> Version: 83
</tspan><tspan </tspan><tspan
x="180" x="180"
y="190.85" y="190.85"

Before

Width:  |  Height:  |  Size: 9.2 KiB

After

Width:  |  Height:  |  Size: 9.2 KiB

View file

@ -211,7 +211,7 @@
</tspan><tspan </tspan><tspan
x="180" x="180"
y="190.85" y="190.85"
id="tspan13565"> Current: 78</tspan></text> id="tspan13565"> Version: 83</tspan></text>
<text <text
xml:space="preserve" xml:space="preserve"
id="text6580" id="text6580"

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View file

@ -6,9 +6,8 @@
# global configuration # global configuration
# https://git.eworm.de/cgit/routeros-scripts/about/ # https://git.eworm.de/cgit/routeros-scripts/about/
# Make sure all configuration properties are up to date and this # Set this to 'true' to disable news and change notifications.
# value is in sync with value in script 'global-functions'! :global NoNewsAndChangesNotification false;
:global GlobalConfigVersion 82;
# This is used for DNS and backup file. # This is used for DNS and backup file.
:global Domain "example.com"; :global Domain "example.com";

View file

@ -5,11 +5,6 @@
# global configuration, custom overlay # global configuration, custom overlay
# https://git.eworm.de/cgit/routeros-scripts/about/ # https://git.eworm.de/cgit/routeros-scripts/about/
# 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 82;
# Copy configuration from global-config, paste and modify it here. # Copy configuration from global-config, paste and modify it here.

View file

@ -91,6 +91,7 @@
80="The 'routeros-v7' branch will now freeze, and vanish any time in future. You already switched to 'main' branch, well done!"; 80="The 'routeros-v7' branch will now freeze, and vanish any time in future. You already switched to 'main' branch, well done!";
81="Dropped script 'rotate-ntp', as the limitation does no longer exist."; 81="Dropped script 'rotate-ntp', as the limitation does no longer exist.";
82="Renamed the comment parameter 'hostname' to just 'name' for 'netwatch-notify'."; 82="Renamed the comment parameter 'hostname' to just 'name' for 'netwatch-notify'.";
83="Introduced new setting to disable news and change notifications, dropped version from configuration.";
}; };
# Migration steps to be applied on script updates # Migration steps to be applied on script updates

View file

@ -10,7 +10,7 @@
:local 0 "global-functions"; :local 0 "global-functions";
# expected configuration version # expected configuration version
:global ExpectedConfigVersion 82; :global ExpectedConfigVersion 83;
# global variables not to be changed by user # global variables not to be changed by user
:global GlobalFunctionsReady false; :global GlobalFunctionsReady false;
@ -188,7 +188,6 @@
# get readable device info # get readable device info
:set DeviceInfo do={ :set DeviceInfo do={
:global ExpectedConfigVersion; :global ExpectedConfigVersion;
:global GlobalConfigVersion;
:global Identity; :global Identity;
:global IfThenElse; :global IfThenElse;
@ -222,9 +221,7 @@
$RouterBoard->"current-firmware" != $RouterBoard->"upgrade-firmware") \ $RouterBoard->"current-firmware" != $RouterBoard->"upgrade-firmware") \
("\n Firmware: " . $RouterBoard->"current-firmware") ] . \ ("\n Firmware: " . $RouterBoard->"current-firmware") ] . \
"\nRouterOS-Scripts:" . \ "\nRouterOS-Scripts:" . \
"\n Current: " . $GlobalConfigVersion . \ "\n Version: " . $ExpectedConfigVersion);
[ $IfThenElse ($GlobalConfigVersion != $ExpectedConfigVersion) \
("\n Expected: " . $ExpectedConfigVersion) ]);
} }
# download package from upgrade server # download package from upgrade server
@ -753,9 +750,9 @@
:local NewComment [ :tostr $2 ]; :local NewComment [ :tostr $2 ];
:global ExpectedConfigVersion; :global ExpectedConfigVersion;
:global GlobalConfigVersion;
:global Identity; :global Identity;
:global IDonate; :global IDonate;
:global NoNewsAndChangesNotification;
:global NotificationsWithSymbols; :global NotificationsWithSymbols;
:global ScriptUpdatesBaseUrl; :global ScriptUpdatesBaseUrl;
:global ScriptUpdatesFetch; :global ScriptUpdatesFetch;
@ -926,16 +923,15 @@
} }
:if ($SentConfigChangesNotification != $ExpectedConfigVersion && \ :if ($SentConfigChangesNotification != $ExpectedConfigVersion && \
$GlobalConfigVersion < $ExpectedConfigVersion) do={ $NoNewsAndChangesNotification != true) do={
:local NotificationMessage ("Current configuration on " . $Identity . \ :local NotificationMessage ("The configuration version on " . $Identity . " increased " . \
" is out of date. Please update global-config-overlay, then increase " . \ "to " . $ExpectedConfigVersion . ", current configuration may need modification. " . \
"\$GlobalConfigVersion (currently " . $GlobalConfigVersion . \ "Please review and update global-config-overlay, then re-run global-config.");
") to " . $ExpectedConfigVersion . " and re-run global-config.");
$LogPrintExit2 info $0 ($NotificationMessage) false; $LogPrintExit2 info $0 ($NotificationMessage) false;
:if ([ :len $GlobalConfigChanges ] > 0) do={ :if ([ :len $GlobalConfigChanges ] > 0) do={
:set NotificationMessage ($NotificationMessage . "\n\nChanges:"); :set NotificationMessage ($NotificationMessage . "\n\nChanges:");
:for I from=($GlobalConfigVersion + 1) to=$ExpectedConfigVersion do={ :for I from=($ExpectedConfigVersionBefore + 1) to=$ExpectedConfigVersion do={
:local Change ($GlobalConfigChanges->[ :tostr $I ]); :local Change ($GlobalConfigChanges->[ :tostr $I ]);
:set NotificationMessage ($NotificationMessage . "\n " . \ :set NotificationMessage ($NotificationMessage . "\n " . \
[ $IfThenElse ($NotificationsWithSymbols = true) ("\E2\97\8F") "*" ] . " " . $Change); [ $IfThenElse ($NotificationsWithSymbols = true) ("\E2\97\8F") "*" ] . " " . $Change);