packages-update: give warning on lock in device-mode

RouterOS 7.17beta2 introduced some extra security measures, including
some to prevent downgrade attacks for the installation. Detect early
and exit with message and error.

https://help.mikrotik.com/docs/display/ROS/Device-mode
This commit is contained in:
Christian Hesse 2024-09-30 16:10:55 +02:00
parent 1776b8f50b
commit f2576cf558

View file

@ -18,6 +18,7 @@
:global Grep;
:global LogPrint;
:global ParseKeyValueStore;
:global RequiredRouterOS;
:global ScriptFromTerminal;
:global ScriptLock;
:global VersionToNum;
@ -99,6 +100,13 @@
:local DoDowngrade false;
:if ($NumInstalled > $NumLatest) do={
:if ([ $RequiredRouterOS $ScriptName "7.17beta2" false ] = true && \
([ /system/device-mode/get ]->"downgrade") != true) do={
$LogPrint error $ScriptName \
("The device mode has locked downgrades! You will need physical access!");
:error false;
}
:if ([ $ScriptFromTerminal $ScriptName ] = true) do={
:put "Latest version is older than installed one. Want to downgrade? [y/N]";
:if (([ /terminal/inkey timeout=60 ] % 32) = 25) do={