aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2022-07-06 12:54:40 +0200
committerGravatar Christian Hesse <mail@eworm.de>2022-07-06 21:46:52 +0200
commita1606402d1628e7998601c29e6f1043c34a30ebc (patch)
treedf0c7836b30e800ab5aedf552afb0ac98739ed47
parent68ae4fca0d36bfd0720200fb8671951e1985bf8f (diff)
global-config: new setting to disable news and change notifications...change-83
... and also drop the version from global-config and global-config-overlay.
-rw-r--r--README.d/05-edit-global-config-overlay.avifbin6602 -> 5124 bytes
-rw-r--r--doc/backup-cloud.d/notification.svg2
-rw-r--r--doc/backup-upload.d/notification.svg2
-rw-r--r--doc/check-routeros-update.d/notification.svg2
-rw-r--r--global-config5
-rw-r--r--global-config-overlay5
-rw-r--r--global-config.changes1
-rw-r--r--global-functions24
8 files changed, 16 insertions, 25 deletions
diff --git a/README.d/05-edit-global-config-overlay.avif b/README.d/05-edit-global-config-overlay.avif
index e08fde8..f2f0f2d 100644
--- a/README.d/05-edit-global-config-overlay.avif
+++ b/README.d/05-edit-global-config-overlay.avif
Binary files differ
diff --git a/doc/backup-cloud.d/notification.svg b/doc/backup-cloud.d/notification.svg
index 6e48cd4..23d78e5 100644
--- a/doc/backup-cloud.d/notification.svg
+++ b/doc/backup-cloud.d/notification.svg
@@ -195,7 +195,7 @@
</tspan><tspan
x="180"
y="176.08282"
- id="tspan13491"> Current: 78
+ id="tspan13491"> Version: 83
</tspan><tspan
x="180"
y="191.08282"
diff --git a/doc/backup-upload.d/notification.svg b/doc/backup-upload.d/notification.svg
index a157840..b8af90e 100644
--- a/doc/backup-upload.d/notification.svg
+++ b/doc/backup-upload.d/notification.svg
@@ -195,7 +195,7 @@
</tspan><tspan
x="180"
y="175.85"
- id="tspan10793"> Current: 78
+ id="tspan10793"> Version: 83
</tspan><tspan
x="180"
y="190.85"
diff --git a/doc/check-routeros-update.d/notification.svg b/doc/check-routeros-update.d/notification.svg
index 8a5cc67..7a1ecba 100644
--- a/doc/check-routeros-update.d/notification.svg
+++ b/doc/check-routeros-update.d/notification.svg
@@ -211,7 +211,7 @@
</tspan><tspan
x="180"
y="190.85"
- id="tspan13565"> Current: 78</tspan></text>
+ id="tspan13565"> Version: 83</tspan></text>
<text
xml:space="preserve"
id="text6580"
diff --git a/global-config b/global-config
index d36e63b..febef52 100644
--- a/global-config
+++ b/global-config
@@ -6,9 +6,8 @@
# global configuration
# 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'!
-:global GlobalConfigVersion 82;
+# Set this to 'true' to disable news and change notifications.
+:global NoNewsAndChangesNotification false;
# This is used for DNS and backup file.
:global Domain "example.com";
diff --git a/global-config-overlay b/global-config-overlay
index 06d369e..70d8570 100644
--- a/global-config-overlay
+++ b/global-config-overlay
@@ -5,11 +5,6 @@
# global configuration, custom overlay
# 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.
diff --git a/global-config.changes b/global-config.changes
index 1a72527..0356772 100644
--- a/global-config.changes
+++ b/global-config.changes
@@ -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!";
81="Dropped script 'rotate-ntp', as the limitation does no longer exist.";
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
diff --git a/global-functions b/global-functions
index bab2716..94f3763 100644
--- a/global-functions
+++ b/global-functions
@@ -10,7 +10,7 @@
:local 0 "global-functions";
# expected configuration version
-:global ExpectedConfigVersion 82;
+:global ExpectedConfigVersion 83;
# global variables not to be changed by user
:global GlobalFunctionsReady false;
@@ -188,7 +188,6 @@
# get readable device info
:set DeviceInfo do={
:global ExpectedConfigVersion;
- :global GlobalConfigVersion;
:global Identity;
:global IfThenElse;
@@ -211,7 +210,7 @@
(" " . $RouterBoard->"revision") ] . \
"\nSerial number: " . $RouterBoard->"serial-number") ] . \
[ $IfThenElse ([ :len ($License->"level") ] > 0) \
- ("\nLicense: " . $License->"level") ] . \
+ ("\nLicense: " . $License->"level") ] . \
"\nRouterOS:" . \
"\n Channel: " . $Update->"channel" . \
"\n Installed: " . $Update->"installed-version" . \
@@ -220,11 +219,9 @@
("\n Available: " . $Update->"latest-version") ] . \
[ $IfThenElse ($RouterBoard->"routerboard" = true && \
$RouterBoard->"current-firmware" != $RouterBoard->"upgrade-firmware") \
- ("\n Firmware: " . $RouterBoard->"current-firmware") ] . \
+ ("\n Firmware: " . $RouterBoard->"current-firmware") ] . \
"\nRouterOS-Scripts:" . \
- "\n Current: " . $GlobalConfigVersion . \
- [ $IfThenElse ($GlobalConfigVersion != $ExpectedConfigVersion) \
- ("\n Expected: " . $ExpectedConfigVersion) ]);
+ "\n Version: " . $ExpectedConfigVersion);
}
# download package from upgrade server
@@ -753,9 +750,9 @@
:local NewComment [ :tostr $2 ];
:global ExpectedConfigVersion;
- :global GlobalConfigVersion;
:global Identity;
:global IDonate;
+ :global NoNewsAndChangesNotification;
:global NotificationsWithSymbols;
:global ScriptUpdatesBaseUrl;
:global ScriptUpdatesFetch;
@@ -926,16 +923,15 @@
}
:if ($SentConfigChangesNotification != $ExpectedConfigVersion && \
- $GlobalConfigVersion < $ExpectedConfigVersion) do={
- :local NotificationMessage ("Current configuration on " . $Identity . \
- " is out of date. Please update global-config-overlay, then increase " . \
- "\$GlobalConfigVersion (currently " . $GlobalConfigVersion . \
- ") to " . $ExpectedConfigVersion . " and re-run global-config.");
+ $NoNewsAndChangesNotification != true) do={
+ :local NotificationMessage ("The configuration version on " . $Identity . " increased " . \
+ "to " . $ExpectedConfigVersion . ", current configuration may need modification. " . \
+ "Please review and update global-config-overlay, then re-run global-config.");
$LogPrintExit2 info $0 ($NotificationMessage) false;
:if ([ :len $GlobalConfigChanges ] > 0) do={
: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 ]);
:set NotificationMessage ($NotificationMessage . "\n " . \
[ $IfThenElse ($NotificationsWithSymbols = true) ("\E2\97\8F") "*" ] . " " . $Change);