-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request rauc#1505 from jluebbe/meta-data-in-handler
expose manifest meta-data in handler environment
- Loading branch information
Showing
10 changed files
with
147 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#pragma once | ||
|
||
#include <glib.h> | ||
|
||
#include "manifest.h" | ||
|
||
/** | ||
* Add the meta-data contents from a manifest as newly allocated strings to a | ||
* GPtrArray, formatted for use as shell variables. | ||
* | ||
* This is useful for the 'rauc info' command and hooks/handlers. | ||
* | ||
* @param ptrarray GPtrArray to add to | ||
* @param manifest RaucManifest to use as input | ||
*/ | ||
void r_shell_from_manifest_meta(GPtrArray *shell_vars, const RaucManifest *manifest); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#include "shell.h" | ||
|
||
#include "utils.h" | ||
|
||
void r_shell_from_manifest_meta(GPtrArray *shell_vars, const RaucManifest *manifest) | ||
{ | ||
g_return_if_fail(shell_vars); | ||
g_return_if_fail(manifest); | ||
|
||
if (!manifest->meta) | ||
return; | ||
|
||
GHashTableIter iter; | ||
g_hash_table_iter_init(&iter, manifest->meta); | ||
GHashTable *kvs; | ||
const gchar *group; | ||
while (g_hash_table_iter_next(&iter, (gpointer*)&group, (gpointer*)&kvs)) { | ||
g_autofree gchar *env_group = r_prepare_env_key(group, NULL); | ||
|
||
if (!env_group) | ||
continue; | ||
|
||
GHashTableIter kvs_iter; | ||
g_hash_table_iter_init(&kvs_iter, kvs); | ||
const gchar *key, *value; | ||
while (g_hash_table_iter_next(&kvs_iter, (gpointer*)&key, (gpointer*)&value)) { | ||
g_autofree gchar *env_key = r_prepare_env_key(key, NULL); | ||
|
||
if (!env_key) | ||
continue; | ||
|
||
r_ptr_array_add_printf(shell_vars, "RAUC_META_%s_%s=%s", env_group, env_key, value); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# testsuite system configuration | ||
|
||
[system] | ||
compatible=Test Config | ||
bootloader=grub | ||
grubenv=grubenv.test | ||
variant-name=Default Variant | ||
data-directory=data-dir | ||
|
||
[handlers] | ||
system-info=bin/systeminfo.sh | ||
pre-install=bin/preinstall.sh | ||
post-install=bin/postinstall.sh | ||
|
||
[keyring] | ||
path=openssl-ca/dev-ca.pem | ||
check-crl=true | ||
|
||
[slot.rootfs.0] | ||
device=images/rootfs-0 | ||
type=raw | ||
bootname=system0 | ||
|
||
[slot.rootfs.1] | ||
device=images/rootfs-1 | ||
type=raw | ||
bootname=system1 | ||
|
||
[slot.appfs.0] | ||
device=images/appfs-0 | ||
type=raw | ||
parent=rootfs.0 | ||
|
||
[slot.appfs.1] | ||
device=images/appfs-1 | ||
type=raw | ||
parent=rootfs.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters