aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2024-01-26 09:11:17 +0100
committerGravatar Christian Hesse <mail@eworm.de>2024-01-30 00:02:08 +0100
commit62f33d7b19792fded8366d57ff8756c5952da990 (patch)
treec44d0140280072374b3da7080ab2da711873181b
parent98f26989f5f625ad918aed900b7888fa69c78248 (diff)
packages-update: support deferred reboot on auto-updatechange-117
Closes #56
-rw-r--r--doc/packages-update.md12
-rw-r--r--global-config.rsc3
-rw-r--r--global-functions.rsc2
-rw-r--r--news-and-changes.rsc1
-rw-r--r--packages-update.rsc7
5 files changed, 24 insertions, 1 deletions
diff --git a/doc/packages-update.md b/doc/packages-update.md
index 653d233..280c420 100644
--- a/doc/packages-update.md
+++ b/doc/packages-update.md
@@ -34,6 +34,18 @@ Just install the script:
It is automatically run by [check-routeros-update](check-routeros-update.md)
if available.
+Configuration
+-------------
+
+The configuration goes to `global-config-overlay`, this is the only parameter:
+
+* `PackagesUpdateDeferReboot`: defer the reboot for night (between 3 AM
+ and 4 AM)
+
+> ℹ️ **Info**: Copy relevant configuration from
+> [`global-config`](../global-config.rsc) (the one without `-overlay`) to
+> your local `global-config-overlay` and modify it to your specific needs.
+
Usage and invocation
--------------------
diff --git a/global-config.rsc b/global-config.rsc
index 6066fef..983eedb 100644
--- a/global-config.rsc
+++ b/global-config.rsc
@@ -135,6 +135,9 @@
# Set to all upper-case "Yes, please!" to enable.
:global SafeUpdateAll "no";
+# Defer the reboot for night on automatic (non-interactive) update
+:global PackagesUpdateDeferReboot false;
+
# These thresholds control when to send health notification
# on temperature and voltage.
:global CheckHealthTemperature {
diff --git a/global-functions.rsc b/global-functions.rsc
index 9be7893..306a2cc 100644
--- a/global-functions.rsc
+++ b/global-functions.rsc
@@ -12,7 +12,7 @@
:local 0 "global-functions";
# expected configuration version
-:global ExpectedConfigVersion 116;
+:global ExpectedConfigVersion 117;
# global variables not to be changed by user
:global GlobalFunctionsReady false;
diff --git a/news-and-changes.rsc b/news-and-changes.rsc
index 0c81628..5186420 100644
--- a/news-and-changes.rsc
+++ b/news-and-changes.rsc
@@ -36,6 +36,7 @@
116=("... and also please keep in mind that it takes a huge amount of time maintaining these scripts. " . [ $IfThenElse ($IDonate != true) \
("Following the donation hint " . [ $SymbolForNotification "arrow-down" "below" ] . "to keep me motivated is much appreciated. Thanks!") \
("Looks like you did donate already. " . [ $SymbolForNotification "heart" "<3" ] . "Much appreciated, thanks!") ]);
+ 117="Enhanced 'packages-update' to support deferred reboot on automatically installed updates.";
};
# Migration steps to be applied on script updates
diff --git a/packages-update.rsc b/packages-update.rsc
index b67346d..552a682 100644
--- a/packages-update.rsc
+++ b/packages-update.rsc
@@ -18,6 +18,8 @@
:global ScriptLock;
:global VersionToNum;
+:global PackagesUpdateDeferReboot;
+
:local Schedule do={
:global RebootForUpdate do={
:global RandomDelay;
@@ -109,6 +111,11 @@ $ScriptLock $0;
$Schedule;
$LogPrintExit2 info $0 ("Scheduled reboot for update between 03:00 and 04:00.") true;
}
+} else={
+ :if ($PackagesUpdateDeferReboot = true) do={
+ $Schedule;
+ $LogPrintExit2 info $0 ("Scheduled reboot for update between 03:00 and 04:00.") true;
+ }
}
$LogPrintExit2 info $0 ("Rebooting for update.") false;