diff options
author | Christian Hesse <mail@eworm.de> | 2020-10-13 18:52:01 +0200 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2020-10-13 18:55:23 +0200 |
commit | 370d7c1a580cd59f2f6bc79b984a30c9fcf3b720 (patch) | |
tree | 06a3f33a8e211eb9f3bed97ea69aac45d1438268 | |
parent | e11e6b465812863fd2049274fd199f6dfa93c1a4 (diff) |
unattended-lte-firmware-upgrade: convert to function
-rw-r--r-- | unattended-lte-firmware-upgrade | 21 |
1 files changed, 12 insertions, 9 deletions
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 . "\";"); } } |