mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2026-01-21 00:19:32 +00:00
firmware-upgrade-reboot: early exit with :exit
This commit is contained in:
parent
47cd3e0d6d
commit
3bad246473
1 changed files with 4 additions and 8 deletions
|
|
@ -8,7 +8,6 @@
|
||||||
# install firmware upgrade, and reboot
|
# install firmware upgrade, and reboot
|
||||||
# https://rsc.eworm.de/doc/firmware-upgrade-reboot.md
|
# https://rsc.eworm.de/doc/firmware-upgrade-reboot.md
|
||||||
|
|
||||||
:local ExitOK false;
|
|
||||||
:onerror Err {
|
:onerror Err {
|
||||||
:global GlobalConfigReady; :global GlobalFunctionsReady;
|
:global GlobalConfigReady; :global GlobalFunctionsReady;
|
||||||
:retry { :if ($GlobalConfigReady != true || $GlobalFunctionsReady != true) \
|
:retry { :if ($GlobalConfigReady != true || $GlobalFunctionsReady != true) \
|
||||||
|
|
@ -20,21 +19,18 @@
|
||||||
:global VersionToNum;
|
:global VersionToNum;
|
||||||
|
|
||||||
:if ([ $ScriptLock $ScriptName ] = false) do={
|
:if ([ $ScriptLock $ScriptName ] = false) do={
|
||||||
:set ExitOK true;
|
:exit;
|
||||||
:error false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
:local RouterBoard [ /system/routerboard/get ];
|
:local RouterBoard [ /system/routerboard/get ];
|
||||||
:if ($RouterBoard->"current-firmware" = $RouterBoard->"upgrade-firmware") do={
|
:if ($RouterBoard->"current-firmware" = $RouterBoard->"upgrade-firmware") do={
|
||||||
$LogPrint info $ScriptName ("Current and upgrade firmware match with version " . \
|
$LogPrint info $ScriptName ("Current and upgrade firmware match with version " . \
|
||||||
$RouterBoard->"current-firmware" . ".");
|
$RouterBoard->"current-firmware" . ".");
|
||||||
:set ExitOK true;
|
:exit;
|
||||||
:error true;
|
|
||||||
}
|
}
|
||||||
:if ([ $VersionToNum ($RouterBoard->"current-firmware") ] > [ $VersionToNum ($RouterBoard->"upgrade-firmware") ]) do={
|
:if ([ $VersionToNum ($RouterBoard->"current-firmware") ] > [ $VersionToNum ($RouterBoard->"upgrade-firmware") ]) do={
|
||||||
$LogPrint info $ScriptName ("Different firmware version is available, but it is a downgrade. Ignoring.");
|
$LogPrint info $ScriptName ("Different firmware version is available, but it is a downgrade. Ignoring.");
|
||||||
:set ExitOK true;
|
:exit;
|
||||||
:error true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
:if ([ /system/routerboard/settings/get auto-upgrade ] = false) do={
|
:if ([ /system/routerboard/settings/get auto-upgrade ] = false) do={
|
||||||
|
|
@ -56,5 +52,5 @@
|
||||||
$LogPrint info $ScriptName ("Firmware upgrade successful, rebooting.");
|
$LogPrint info $ScriptName ("Firmware upgrade successful, rebooting.");
|
||||||
/system/reboot;
|
/system/reboot;
|
||||||
} do={
|
} do={
|
||||||
:global ExitError; $ExitError $ExitOK [ :jobname ] $Err;
|
:global ExitError; $ExitError false [ :jobname ] $Err;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue