aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2019-08-30 13:41:20 +0200
committerGravatar Christian Hesse <mail@eworm.de>2019-08-30 14:10:58 +0200
commit166bbffe1d45e6b5f5cbf8791d952d431ddde902 (patch)
tree4db75b40406180f04e5aaea2787b5c8bd41fe767
parentc7563d4ffd2c2f2579b320867172708d342158c0 (diff)
script-updates: add donation hint in configuration warning notificationchange-8
-rw-r--r--global-config9
-rw-r--r--global-config.changes1
-rw-r--r--global-functions2
-rw-r--r--script-updates34
4 files changed, 33 insertions, 13 deletions
diff --git a/global-config b/global-config
index 2559181..85a4232 100644
--- a/global-config
+++ b/global-config
@@ -6,7 +6,7 @@
# Make sure all configuration properties are up to date and this
# value is in sync with value in script 'global-functions'!
-:global GlobalConfigVersion 7;
+:global GlobalConfigVersion 8;
# This is used for DNS and backup file.
:global Domain "example.com";
@@ -107,7 +107,14 @@
:global ScriptUpdatesIgnore {
"global-config"
}
+# Enable this to silence all configuration warnings.
:global ScriptUpdatesConfigChangesIgnore false;
+# 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
+# business please consider a donation:
+# https://git.eworm.de/cgit/routeros-scripts/about/#donate
+# Enable this to silence donation hint.
+:global IDonate false;
# Use this for certificate auto-renew
:global CertRenewUrl "";
diff --git a/global-config.changes b/global-config.changes
index 6123855..4951996 100644
--- a/global-config.changes
+++ b/global-config.changes
@@ -10,4 +10,5 @@
5="split off new script 'cloud-backup' from 'email-backup'";
6="introduced script 'upload-backup' with new configuration parameters";
7="introduced script 'check-health' with new configuration parameters";
+ 8="added donation hint and option to silence it";
};
diff --git a/global-functions b/global-functions
index c5e63c4..1b73b0a 100644
--- a/global-functions
+++ b/global-functions
@@ -5,7 +5,7 @@
# global functions
# expected configuration version
-:global ExpectedConfigVersion 7;
+:global ExpectedConfigVersion 8;
# global variables not to be changed by user
:global SentConfigChangesNotification "-";
diff --git a/script-updates b/script-updates
index d6d05f5..de8bf40 100644
--- a/script-updates
+++ b/script-updates
@@ -7,6 +7,7 @@
:global ExpectedConfigVersion;
:global GlobalConfigVersion;
:global Identity;
+:global IDonate;
:global SentConfigChangesNotification;
:global ScriptUpdatesFetch;
:global ScriptUpdatesBaseUrl;
@@ -81,7 +82,10 @@
$GlobalConfigVersion < $ExpectedConfigVersion) do={
:global GlobalConfigChanges;
:local ChangeLogCode;
- :local Changes;
+ :local NotificationMessage ("Current configuration on " . $Identity . \
+ " is out of date. Please update global-config, then increase " . \
+ "variable GlobalConfigVersion (currently " . $GlobalConfigVersion . \
+ ") to " . $ExpectedConfigVersion . " and re-run global-config.");
:log debug ("Fetching changelog.");
:do {
@@ -91,20 +95,28 @@
:if ($Result->"status" = "finished") do={
:set ChangeLogCode ($Result->"data");
}
+ :set NotificationMessage ($NotificationMessage . "\n\nChanges:");
+ [ :parse $ChangeLogCode ];
+ :for I from=($GlobalConfigVersion + 1) to=$ExpectedConfigVersion do={
+ :set NotificationMessage ($NotificationMessage . \
+ "\n * " . $GlobalConfigChanges->[ :tostr $I ]);
+ }
+ :set GlobalConfigChanges;
} on-error={
:log info ("Failed fetching changes!");
+ :set NotificationMessage ($NotificationMessage . \
+ "\n\nChanges are not available.");
}
- [ :parse $ChangeLogCode ];
- :for I from=($GlobalConfigVersion + 1) to=$ExpectedConfigVersion do={
- :set Changes ( $Changes . "\n * " . $GlobalConfigChanges->[ :tostr $I ] );
+
+ :if ($IDonate != true) do={
+ :set NotificationMessage ($NotificationMessage . \
+ "\n\n==== donation hint ====\n" . \
+ "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 business please consider a donation:\n" . \
+ "https://git.eworm.de/cgit/routeros-scripts/about/#donate");
}
- :set GlobalConfigChanges;
- $SendNotification "Configuration warning!" \
- ("Current configuration on " . $Identity . " is out of date. " . \
- "Please update global-config, then increase variable " . \
- "GlobalConfigVersion (currently " . $GlobalConfigVersion . \
- ") to " . $ExpectedConfigVersion . " and re-run global-config.\n\n" . \
- "Changes:" . $Changes);
+ $SendNotification "Configuration warning!" $NotificationMessage;
:set SentConfigChangesNotification $ExpectedConfigVersion;
}