mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2024-05-11 05:55:19 +00:00
packages-update: skip the interactive part of non-terminal
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
# download packages and reboot for installation
|
# download packages and reboot for installation
|
||||||
|
|
||||||
:global DownloadPackage;
|
:global DownloadPackage;
|
||||||
|
:global ScriptFromTerminal;
|
||||||
|
|
||||||
:local Update [ / system package update get ];
|
:local Update [ / system package update get ];
|
||||||
|
|
||||||
@@ -30,22 +31,24 @@
|
|||||||
/ system script run $Script;
|
/ system script run $Script;
|
||||||
}
|
}
|
||||||
|
|
||||||
:if (!([ /system resource get version ] ~ ($Update->"channel"))) do={
|
:if ([ $ScriptFromTerminal "packages-update" ] = true) do={
|
||||||
:put "Update channel changed. Want to downgrade? [y/N]";
|
:if (!([ /system resource get version ] ~ ($Update->"channel"))) do={
|
||||||
:if ([ :terminal inkey timeout=60 ] = 121) do={
|
:put "Update channel changed. Want to downgrade? [y/N]";
|
||||||
:log info ("Rebooting for downgrade.");
|
:if ([ :terminal inkey timeout=60 ] = 121) do={
|
||||||
:delay 1s;
|
:log info ("Rebooting for downgrade.");
|
||||||
/ system package downgrade;
|
:delay 1s;
|
||||||
|
/ system package downgrade;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
:put "Do you want to (s)chedule reboot instead of (r)eboot now? [s/R]";
|
:put "Do you want to (s)chedule reboot instead of (r)eboot now? [s/R]";
|
||||||
:if ([ :terminal inkey timeout=60 ] = 115) do={
|
:if ([ :terminal inkey timeout=60 ] = 115) do={
|
||||||
/ system scheduler add name="reboot-for-update" start-time=03:00:00 interval=1d \
|
/ system scheduler add name="reboot-for-update" start-time=03:00:00 interval=1d \
|
||||||
on-event=(":global RandomDelay; \$RandomDelay 3600; " . \
|
on-event=(":global RandomDelay; \$RandomDelay 3600; " . \
|
||||||
"/ system scheduler remove reboot-for-update; / system reboot;");
|
"/ system scheduler remove reboot-for-update; / system reboot;");
|
||||||
:log info ("Scheduled reboot for update between 03:00 and 04:00.");
|
:log info ("Scheduled reboot for update between 03:00 and 04:00.");
|
||||||
:error ("Scheduled reboot.");
|
:error ("Scheduled reboot.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
:log info ("Rebooting for update.");
|
:log info ("Rebooting for update.");
|
||||||
|
Reference in New Issue
Block a user