unattended-lte-firmware-upgrade: skip interface on missing firmware information

This commit is contained in:
Christian Hesse 2021-02-26 12:21:38 +01:00
parent 9c9c9f4d34
commit 464dd55bbd

View file

@ -15,21 +15,25 @@
:log debug ("Could not get latest LTE firmware version for interface " . $IntName . "."); :log debug ("Could not get latest LTE firmware version for interface " . $IntName . ".");
} }
:if (($Firmware->"installed") != ($Firmware->"latest")) do={ :if ([ :typeof $Firmware ] = "array") do={
:log info ("Scheduling LTE firmware upgrade for interface " . $IntName . "."); :if (($Firmware->"installed") != ($Firmware->"latest")) do={
:global LTEFirmwareUpgrade do={ :log info ("Scheduling LTE firmware upgrade for interface " . $IntName . ".");
:global LTEFirmwareUpgrade; :global LTEFirmwareUpgrade do={
:set LTEFirmwareUpgrade; :global LTEFirmwareUpgrade;
/ system scheduler remove ($1 . "-firmware-upgrade"); :set LTEFirmwareUpgrade;
/ interface lte firmware-upgrade $1 upgrade=yes; / system scheduler remove ($1 . "-firmware-upgrade");
:log info ("LTE firmware upgrade finished, waiting for installation before reset."); / interface lte firmware-upgrade $1 upgrade=yes;
:delay 150s; :log info ("LTE firmware upgrade finished, waiting for installation before reset.");
/ interface lte at-chat $1 input="AT+RESET"; :delay 150s;
:log info ("Reset device, waiting to finish and reconnect."); / interface lte at-chat $1 input="AT+RESET";
:log info ("Reset device, waiting to finish and reconnect.");
}
/ system scheduler add name=($IntName . "-firmware-upgrade") start-time=startup interval=2s \
on-event=(":global LTEFirmwareUpgrade; \$LTEFirmwareUpgrade \"" . $IntName . "\";");
} else={
:log info ("The LTE firmware is up to date on interface " . $IntName . ".");
} }
/ system scheduler add name=($IntName . "-firmware-upgrade") start-time=startup interval=2s \
on-event=(":global LTEFirmwareUpgrade; \$LTEFirmwareUpgrade \"" . $IntName . "\";");
} else={ } else={
:log info ("The LTE firmware is up to date on interface " . $IntName . "."); :log info ("No LTE firmware information available for interface " . $IntName . ".");
} }
} }