mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-07-24 21:04:28 +02:00
introduce firmware-upgrade-reboot
(cherry picked from commit 3c358980cb
)
This commit is contained in:
parent
c95e816148
commit
32cc55f7d2
9 changed files with 75 additions and 3 deletions
32
firmware-upgrade-reboot
Normal file
32
firmware-upgrade-reboot
Normal file
|
@ -0,0 +1,32 @@
|
|||
#!rsc by RouterOS
|
||||
# RouterOS script: firmware-upgrade-reboot
|
||||
# Copyright (c) 2022 Christian Hesse <mail@eworm.de>
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
|
||||
#
|
||||
# install firmware upgrade, and reboot
|
||||
# https://git.eworm.de/cgit/routeros-scripts/about/doc/firmware-upgrade-reboot.md
|
||||
|
||||
:local 0 "firmware-upgrade-reboot";
|
||||
:global GlobalFunctionsReady;
|
||||
:while ($GlobalFunctionsReady != true) do={ :delay 500ms; }
|
||||
|
||||
:global LogPrintExit2;
|
||||
|
||||
:local RouterBoard [ / system routerboard get ];
|
||||
:if ($RouterBoard->"current-firmware" = $RouterBoard->"upgrade-firmware") do={
|
||||
$LogPrintExit2 info $0 ("Firmware is already up to date.") true;
|
||||
}
|
||||
|
||||
:if ([ / system routerboard settings get auto-upgrade ] = false) do={
|
||||
$LogPrintExit2 info $0 ("Firmware version " . $RouterBoard->"upgrade-firmware" . \
|
||||
" is available, upgrading.") false;
|
||||
/ system routerboard upgrade;
|
||||
}
|
||||
|
||||
:while ([ :len [ / log find where topics=({"system";"info";"critical"}) \
|
||||
message="Firmware upgraded successfully, please reboot for changes to take effect!" ] ] = 0) do={
|
||||
:delay 1s;
|
||||
}
|
||||
|
||||
$LogPrintExit2 info $0 ("Firmware upgrade successful, rebooting.") false;
|
||||
/ system reboot;
|
Loading…
Add table
Add a link
Reference in a new issue