NervesHubLink.UpdateManager.CachingUpdater (nerves_hub_link v2.9.0)

View Source

This module orchestrates firmware updates by downloading the firmware from the specified URL and storing it in a cache directory before applying it. If a partial download exists, it resumes from where it left off.

This is useful for resuming firmware updates from a previous attempt, allowing for efficient updates even if the connection is lost or the device is rebooted. It also ensures that the firmware is stored locally, reducing the need for repeated downloads.

To use this strategy, you need to configure NervesHubLink with:

config :nerves_hub_link,
  updater: NervesHubLink.UpdateManager.CachingUpdater,

The default directory used for storing the caches is /data/nerves_hub_link/firmware. You can configure the path by using the cache_dir option in your application's configuration. For example:

config :nerves_hub_link, NervesHubLink.UpdateManager.CachingUpdater,
  cache_dir: "/path/to/cache/directory"

Summary

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

send_update?(map, percent)

start_link(update_info, fwup_config, fwup_public_keys, opts \\ [])