aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2023-02-16 12:03:46 +0100
committerGravatar Christian Hesse <mail@eworm.de>2023-02-16 12:03:46 +0100
commit49e89070a140a7c991d6e17f0ec1a4f1eb06fa88 (patch)
treefe7b2cc4325e769f6a84699d07faf492bc01bf57
parent7c2ac135e308941311b4e7defaa503ec8db108c3 (diff)
packages-update: put reboot into a function
Make the logic even simpler... Let's put the reboot code into a function. That is volatile, so device does not reboot if it is rebooted already.
-rw-r--r--packages-update8
1 files changed, 6 insertions, 2 deletions
diff --git a/packages-update b/packages-update
index 1c1fda8..5162103 100644
--- a/packages-update
+++ b/packages-update
@@ -81,10 +81,14 @@ $ScriptLock $0;
:if ([ $ScriptFromTerminal $0 ] = true) do={
:put "Do you want to (s)chedule reboot or (r)eboot now? [s/R]";
:if (([ /terminal/inkey timeout=60 ] % 32) = 19) do={
+ :global RebootForUpdate do={
+ :global RandomDelay;
+ $RandomDelay 3600;
+ /system/reboot;
+ }
/system/scheduler/add name="reboot-for-update" start-time=03:00:00 interval=1d \
on-event=("/system/scheduler/remove reboot-for-update; " . \
- ":if ([ /system/package/update/get installed-version ] != \"" . $Update->"latest-version" . "\") " . \
- "do={ :global RandomDelay; \$RandomDelay 3600; /system/reboot; }");
+ ":global RebootForUpdate; \$RebootForUpdate;");
$LogPrintExit2 info $0 ("Scheduled reboot for update between 03:00 and 04:00.") true;
}
}