Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to update modules #43

Merged
merged 6 commits into from
May 23, 2024

Conversation

joelguittet
Copy link
Owner

@joelguittet joelguittet commented May 13, 2024

The purpose of this Pull Request is to add support to update modules (#40)

No examples are available at the moment. To use modules, the module type should be registered to the mender client just after mender_cleint_init is called, as shown on the following skeleton:

/* Register module-readme artifact type */
if (MENDER_OK != mender_client_register_artifact_type("hello-world", &module_hello_world_cb, false, NULL)) {
    mender_log_error("Unable to register 'module-readme' artifact type");
    ret = EXIT_FAILURE;
    goto RELEASE;
}

The callback is used to retrieve module content when a deployment is in progress. Because this mechanism is generic, the mender client doesn't provide much more support and specific application implementation should be done depending of the module.

static mender_err_t
module_hello_world_cb(char *id, char *artifact_name, char *type, cJSON *meta_data, char *filename, size_t size, void *data, size_t index, size_t length) {
    //specific stuff depending of the module, upgrading local files or an external module for example
    return MENDER_OK; //Or MENDER_FAIL in case of error, to abord the download
}

Multiple modules types can be registered. Support of artifact name verification after reboot is also provided to report success/failure after installation (latest argument of the mender_client_register_artifact_type function).

@joelguittet joelguittet added the enhancement New feature or request label May 13, 2024
@joelguittet joelguittet self-assigned this May 13, 2024
@joelguittet joelguittet force-pushed the feature/add-support-update-modules branch 2 times, most recently from 0fb2199 to bf633ff Compare May 13, 2024 22:54
@joelguittet joelguittet force-pushed the feature/add-support-update-modules branch from bf633ff to 7bbf17d Compare May 22, 2024 19:51
@joelguittet joelguittet changed the title Add support update modules Add support to update modules May 22, 2024
@joelguittet joelguittet force-pushed the feature/add-support-update-modules branch from 7bbf17d to 8c6ad52 Compare May 22, 2024 20:14
@joelguittet joelguittet force-pushed the feature/add-support-update-modules branch from 8c6ad52 to 374bafa Compare May 22, 2024 20:23
@joelguittet joelguittet force-pushed the feature/add-support-update-modules branch from 374bafa to d7ecfb2 Compare May 22, 2024 20:52
Copy link

@joelguittet joelguittet merged commit 452d5b0 into master May 23, 2024
5 checks passed
@joelguittet joelguittet deleted the feature/add-support-update-modules branch May 23, 2024 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant