Compare commits

...

4 commits

Author SHA1 Message Date
Christian Hesse b286cb6803 netwatch-notify: do not update with record in cache
Using `:resolve` we have just one address, but chances are several
records do exist. These end up in cache, so we are happy to find them
there - no need to update then.
2024-02-19 11:03:17 +01:00
Christian Hesse 872abbea7d doc/unattended-lte-firmware-upgrade: more devices supported... 2024-02-08 21:02:06 +01:00
Christian Hesse 860acffbdb unattended-lte-firmware-upgrade: add error handling 2024-02-08 21:02:06 +01:00
Christian Hesse e83154c9c3 check-lte-firmware-upgrade: give more detailed infos on modem 2024-02-08 20:54:02 +01:00
4 changed files with 18 additions and 10 deletions

View file

@ -29,8 +29,8 @@ $ScriptLock $0;
:global Identity;
:global SentLteFirmwareUpgradeNotification;
:global CharacterReplace;
:global FormatLine;
:global IfThenElse;
:global LogPrintExit2;
:global ScriptFromTerminal;
:global SendNotification2;
@ -84,7 +84,9 @@ $ScriptLock $0;
subject=([ $SymbolForNotification "sparkles" ] . "LTE firmware upgrade"); \
message=("A new firmware version " . ($Firmware->"latest") . " is available for " . \
"LTE interface " . $IntName . " on " . $Identity . ".\n\n" . \
[ $FormatLine "Interface" [ $CharacterReplace ($Info->"manufacturer" . " " . $Info->"model") ("\"") "" ] ] . "\n" . \
[ $IfThenElse ([ :len ($Info->"manufacturer") ] > 0) ([ $FormatLine "Manufacturer" ($Info->"manufacturer") ] . "\n") ] . \
[ $IfThenElse ([ :len ($Info->"model") ] > 0) ([ $FormatLine "Model" ($Info->"model") ] . "\n") ] . \
[ $IfThenElse ([ :len ($Info->"revision") ] > 0) ([ $FormatLine "Revision" ($Info->"revision") ] . "\n") ] . \
"Firmware version:\n" . \
[ $FormatLine " Installed" ($Firmware->"installed") ] . "\n" . \
[ $FormatLine " Available" ($Firmware->"latest") ]); silent=true });

View file

@ -12,6 +12,7 @@ This script upgrades LTE firmware on compatible devices:
* R11e-LTE-US
* R11e-4G
* R11e-LTE6
* ... and more - probably what ever Mikrotik builds into their devices
A temporary scheduler is created to be independent from terminal. Thus
starting the upgrade process over the broadband connection is supported.

View file

@ -79,7 +79,8 @@ $ScriptLock $0;
:if ([ $IsDNSResolving ] = true) do={
:do {
:local Resolve [ :resolve ($HostInfo->"resolve") ];
:if ($Resolve != $HostVal->"host") do={
:if ($Resolve != $HostVal->"host" and \
[ :len [ /ip/dns/cache/find where name=($HostInfo->"resolve") data=[ :tostr ($HostVal->"host") ] ] ] = 0) do={
$LogPrintExit2 info $0 ("Name '" . $HostInfo->"resolve" . [ $IfThenElse \
($HostInfo->"resolve" != $HostInfo->"name") ("' for " . $Type . " '" . \
$HostInfo->"name") "" ] . "' resolves to different address " . $Resolve . \

View file

@ -24,13 +24,17 @@
:set LTEFirmwareUpgrade;
/system/scheduler/remove ($1 . "-firmware-upgrade");
/interface/lte/firmware-upgrade $1 upgrade=yes;
:log info ("LTE firmware upgrade on '" . $1 . "' finished, waiting for reset.");
:delay 240s;
:local Firmware [ /interface/lte/firmware-upgrade $1 once as-value ];
:if (($Firmware->"installed") != ($Firmware->"latest")) do={
:log warning ("LTE firmware versions still differ. Resetting again...");
/interface/lte/at-chat $1 input="AT+RESET";
:do {
/interface/lte/firmware-upgrade $1 upgrade=yes;
:log info ("LTE firmware upgrade on '" . $1 . "' finished, waiting for reset.");
:delay 240s;
:local Firmware [ /interface/lte/firmware-upgrade $1 once as-value ];
:if (($Firmware->"installed") != ($Firmware->"latest")) do={
:log warning ("LTE firmware versions still differ. Resetting again...");
/interface/lte/at-chat $1 input="AT+RESET";
}
} on-error={
:log error ("LTE firmware upgrade on '" . $1 . "' failed.");
}
}