From 370d7c1a580cd59f2f6bc79b984a30c9fcf3b720 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Tue, 13 Oct 2020 18:52:01 +0200 Subject: unattended-lte-firmware-upgrade: convert to function --- unattended-lte-firmware-upgrade | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'unattended-lte-firmware-upgrade') diff --git a/unattended-lte-firmware-upgrade b/unattended-lte-firmware-upgrade index e84188b..d9bffad 100644 --- a/unattended-lte-firmware-upgrade +++ b/unattended-lte-firmware-upgrade @@ -17,14 +17,17 @@ :if (($Firmware->"installed") != ($Firmware->"latest")) do={ :log info ("Scheduling LTE firmware upgrade for interface " . $IntName . "."); - / system script add name=($IntName . "-firmware-upgrade") source=("# unattended-lte-firmware-upgrade\n" . \ - "/ system scheduler remove " . $IntName . "-firmware-upgrade;\n" . \ - "/ system script remove " . $IntName . "-firmware-upgrade;\n" . \ - "/ interface lte firmware-upgrade " . $IntName . " upgrade=yes;\n" . \ - ":log info (\"LTE firmware upgrade finished, waiting for installation before reset.\");\n" . \ - ":delay 150s;\n" . \ - "/ interface lte at-chat " . $IntName . " input=\"AT+RESET\";"); - / system scheduler add name=($IntName . "-firmware-upgrade") \ - on-event=("/ system script run " . $IntName . "-firmware-upgrade;") interval=1m; + :global LTEFirmwareUpgrade do={ + :global LTEFirmwareUpgrade; + :set LTEFirmwareUpgrade; + / system scheduler remove ($1 . "-firmware-upgrade"); + / interface lte firmware-upgrade $1 upgrade=yes; + :log info ("LTE firmware upgrade finished, waiting for installation before reset."); + :delay 150s; + / 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 . "\";"); } } -- cgit v1.2.3-70-g09d2