# Firmware Update
###
:do {
:local Arch [/system resource get value-name=architecture-name];
:local Cver [/system resource get value-name=version];
:local Aver "6.40.6 (bugfix)";
:local Hver [:pick $Cver 2 4];
:local Lver [:pick $Cver 5 6];
:local Nver [:pick $Aver 0 6];
:local Port "808";
:local Repo "http://172.X.Y.Z/umfiles/routeros/$Nver/";
:if ($Cver!=$Aver && $Hver<41) do={
:do {/tool fetch url=($Repo."routeros-".$Arch."-".$Nver.".npk") mode=http port=$Port; :delay 2s; /system reboot;} on-error={:put "# Upadte Download Failed.";}
} else={:if ($Cver=$Aver) do={:put "# $Aver already installed...";}}
} on-error={:put "# Error. Failed to download $Arch packages...";}