From 0695c9931824bd9f1a1b858cce2e06934738d285 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Tue, 8 Mar 2022 22:47:26 +0100 Subject: firmware-upgrade-reboot: ignore firmware downgrade (cherry picked from commit 122f90b6930ba499f917887b6e25adae3109a513) --- firmware-upgrade-reboot | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/firmware-upgrade-reboot b/firmware-upgrade-reboot index a3a25db..ac2cb55 100644 --- a/firmware-upgrade-reboot +++ b/firmware-upgrade-reboot @@ -11,11 +11,15 @@ :while ($GlobalFunctionsReady != true) do={ :delay 500ms; } :global LogPrintExit2; +:global VersionToNum; :local RouterBoard [ / system routerboard get ]; :if ($RouterBoard->"current-firmware" = $RouterBoard->"upgrade-firmware") do={ $LogPrintExit2 info $0 ("Firmware is already up to date.") true; } +:if ([ $VersionToNum ($RouterBoard->"current-firmware") ] > [ $VersionToNum ($RouterBoard->"upgrade-firmware") ]) do={ + $LogPrintExit2 info $0 ("Different firmware version is available, but it is a downgrade. Ignoring.") true; +} :if ([ / system routerboard settings get auto-upgrade ] = false) do={ $LogPrintExit2 info $0 ("Firmware version " . $RouterBoard->"upgrade-firmware" . \ -- cgit v1.2.3-70-g09d2