Skip to content

Commit

Permalink
Pass system version to bundle install hooks
Browse files Browse the repository at this point in the history
Pass installed system version to bundle install-check hook script.

Fixes: #531
Signed-off-by: Christopher Obbard <[email protected]>
  • Loading branch information
obbardc committed Mar 21, 2024
1 parent ec9ab08 commit b4d2558
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/install.c
Original file line number Diff line number Diff line change
Expand Up @@ -763,17 +763,29 @@ static gboolean run_bundle_hook(RaucManifest *manifest, gchar* bundledir, const
gboolean res = FALSE;
gchar *outline = NULL;
g_autofree gchar *hookreturnmsg = NULL;
RaucSlot *s = NULL;
g_autofree gchar *system_version = NULL;

g_assert_nonnull(manifest->hook_name);

hook_name = g_build_filename(bundledir, manifest->hook_name, NULL);

g_message("Running bundle hook %s", hook_cmd);

/* Pass the version of the currently running slot to the hook script */
s = find_config_slot_by_device(r_context()->config, r_context()->bootslot);
if (s) {
load_slot_status(s);
if (s->status)
system_version = g_strdup(s->status->bundle_version);
}
g_message("bootslot=%s, system_version=%s", r_context()->bootslot, system_version ?: "");

launcher = g_subprocess_launcher_new(G_SUBPROCESS_FLAGS_STDERR_PIPE);

g_subprocess_launcher_setenv(launcher, "RAUC_SYSTEM_COMPATIBLE", r_context()->config->system_compatible, TRUE);
g_subprocess_launcher_setenv(launcher, "RAUC_SYSTEM_VARIANT", r_context()->config->system_variant ?: "", TRUE);
g_subprocess_launcher_setenv(launcher, "RAUC_SYSTEM_VERSION", system_version ?: "", TRUE);

g_subprocess_launcher_setenv(launcher, "RAUC_MF_COMPATIBLE", manifest->update_compatible, TRUE);
g_subprocess_launcher_setenv(launcher, "RAUC_MF_VERSION", manifest->update_version ?: "", TRUE);
Expand Down

0 comments on commit b4d2558

Please sign in to comment.