diff options
author | Christian Hesse <mail@eworm.de> | 2019-12-04 09:21:07 +0100 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2019-12-04 09:21:07 +0100 |
commit | 9548641b606302f9d66bedabda08ca73be1ed04f (patch) | |
tree | 9dbda828a659ae9889920e3891a52a893ca87406 /packages-update | |
parent | f26222d5a830d9ef8023f43409e95ad67ecf23b4 (diff) |
packages-update: skip the interactive part of non-terminal
Diffstat (limited to 'packages-update')
-rw-r--r-- | packages-update | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/packages-update b/packages-update index e02505c..0e0a87f 100644 --- a/packages-update +++ b/packages-update @@ -5,6 +5,7 @@ # download packages and reboot for installation :global DownloadPackage; +:global ScriptFromTerminal; :local Update [ / system package update get ]; @@ -30,22 +31,24 @@ / system script run $Script; } -:if (!([ /system resource get version ] ~ ($Update->"channel"))) do={ - :put "Update channel changed. Want to downgrade? [y/N]"; - :if ([ :terminal inkey timeout=60 ] = 121) do={ - :log info ("Rebooting for downgrade."); - :delay 1s; - / system package downgrade; +:if ([ $ScriptFromTerminal "packages-update" ] = true) do={ + :if (!([ /system resource get version ] ~ ($Update->"channel"))) do={ + :put "Update channel changed. Want to downgrade? [y/N]"; + :if ([ :terminal inkey timeout=60 ] = 121) do={ + :log info ("Rebooting for downgrade."); + :delay 1s; + / system package downgrade; + } } -} -:put "Do you want to (s)chedule reboot instead of (r)eboot now? [s/R]"; -:if ([ :terminal inkey timeout=60 ] = 115) do={ - / system scheduler add name="reboot-for-update" start-time=03:00:00 interval=1d \ - on-event=(":global RandomDelay; \$RandomDelay 3600; " . \ - "/ system scheduler remove reboot-for-update; / system reboot;"); - :log info ("Scheduled reboot for update between 03:00 and 04:00."); - :error ("Scheduled reboot."); + :put "Do you want to (s)chedule reboot instead of (r)eboot now? [s/R]"; + :if ([ :terminal inkey timeout=60 ] = 115) do={ + / system scheduler add name="reboot-for-update" start-time=03:00:00 interval=1d \ + on-event=(":global RandomDelay; \$RandomDelay 3600; " . \ + "/ system scheduler remove reboot-for-update; / system reboot;"); + :log info ("Scheduled reboot for update between 03:00 and 04:00."); + :error ("Scheduled reboot."); + } } :log info ("Rebooting for update."); |