aboutsummaryrefslogtreecommitdiffstats
path: root/packages-update.rsc
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2024-01-26 08:54:08 +0100
committerGravatar Christian Hesse <mail@eworm.de>2024-01-30 00:02:08 +0100
commit98f26989f5f625ad918aed900b7888fa69c78248 (patch)
treed2bf7b30e3606174320d656aedb615003b160d5e /packages-update.rsc
parentabfc8e9191b23731c2ff8977cf7a46c9ca34a62b (diff)
packages-update: schedule from local function
Diffstat (limited to 'packages-update.rsc')
-rw-r--r--packages-update.rsc20
1 files changed, 12 insertions, 8 deletions
diff --git a/packages-update.rsc b/packages-update.rsc
index 68574bd..b67346d 100644
--- a/packages-update.rsc
+++ b/packages-update.rsc
@@ -18,6 +18,17 @@
:global ScriptLock;
:global VersionToNum;
+:local Schedule do={
+ :global RebootForUpdate do={
+ :global RandomDelay;
+ $RandomDelay 3600;
+ /system/reboot;
+ }
+ /system/scheduler/add name="_RebootForUpdate" start-time=03:00:00 interval=1d \
+ on-event=("/system/scheduler/remove \"_RebootForUpdate\"; " . \
+ ":global RebootForUpdate; \$RebootForUpdate;");
+}
+
$ScriptLock $0;
:local Update [ /system/package/update/get ];
@@ -95,14 +106,7 @@ $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="_RebootForUpdate" start-time=03:00:00 interval=1d \
- on-event=("/system/scheduler/remove \"_RebootForUpdate\"; " . \
- ":global RebootForUpdate; \$RebootForUpdate;");
+ $Schedule;
$LogPrintExit2 info $0 ("Scheduled reboot for update between 03:00 and 04:00.") true;
}
}