aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--global-config4
-rw-r--r--global-functions3
-rw-r--r--script-updates13
3 files changed, 20 insertions, 0 deletions
diff --git a/global-config b/global-config
index 6e32e7f..b77336c 100644
--- a/global-config
+++ b/global-config
@@ -4,6 +4,10 @@
#
# global configuration
+# Make sure all configuration properties are up to date and this
+# value is in sync with value in script 'global-functions'!
+:global GlobalConfigVersion 0;
+
# This is used for DNS and backup file.
:global "domain" "example.com";
:global "hostname-in-zone" true;
diff --git a/global-functions b/global-functions
index 909e381..2c559ae 100644
--- a/global-functions
+++ b/global-functions
@@ -4,6 +4,9 @@
#
# global functions
+# expected configuration version
+:global ExpectedConfigVersion 0;
+
# read input from user
:global Read do={
:return;
diff --git a/script-updates b/script-updates
index 9dae710..5ed0f5b 100644
--- a/script-updates
+++ b/script-updates
@@ -4,11 +4,16 @@
#
# update installed scripts from file or url
+:global GlobalConfigVersion;
+:global ExpectedConfigVersion;
+:global "identity";
:global "script-updates-fetch";
:global "script-updates-baseurl";
:global "script-updates-urlsuffix";
:global "script-updates-ignore";
+:global SendNotification;
+
:foreach script in=[ / system script find ] do={
:local ignore 0;
:local scriptname [ / system script get $script name ];
@@ -71,3 +76,11 @@
:log debug ("No update for script " . $scriptname);
}
}
+
+:if ($GlobalConfigVersion < $ExpectedConfigVersion) do={
+ $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.");
+}