Skip to content

Refactor update-binary script

I noticed an issue related to this script but had a hard time debugging what was exactly happening, so I made some adjustments to improve the script:

  • using set -e where possible to ensure failures are noticed
  • using the mkdir -p option to be idempotent
  • using set -u to ensure undeclared variables are not used
  • quoting variables to avoid any issues related to whitespace in paths
  • using the '--' argument to tell commands to stop option parsing when appropriate, so that positional arguments are not read as options
  • using functions for printing info and fatal messages
  • unpacking the OTA zip payload later in the process
  • ensuring that any previous OTA zip payload is removed before unpacking
  • adjusting indentation to be consistent
  • adding additional logging for prepatory steps

Merge request reports