diff mbox series

[4/7] Acquire namespace for vars from config file

Message ID 20231009153152.416365-5-stefano.babic@swupdate.org
State Accepted
Delegated to: Stefano Babic
Headers show
Series Introduce SWUpdate environment | expand

Commit Message

Stefano Babic Oct. 9, 2023, 3:31 p.m. UTC
Allow to set the "namespace" used by libubootenv to store application
varables from the configuration file, adding the attribute
"namespace-vars".

Signed-off-by: Stefano Babic <stefano.babic@swupdate.org>
---
 core/swupdate.c                     | 2 ++
 examples/configuration/swupdate.cfg | 4 ++++
 2 files changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/core/swupdate.c b/core/swupdate.c
index 6b536b83..07e5ef70 100644
--- a/core/swupdate.c
+++ b/core/swupdate.c
@@ -314,6 +314,8 @@  static int read_globals_settings(void *elem, void *data)
 				"postupdatecmd", sw->postupdatecmd);
 	GET_FIELD_STRING(LIBCFG_PARSER, elem,
 				"preupdatecmd", sw->preupdatecmd);
+	GET_FIELD_STRING(LIBCFG_PARSER, elem,
+				"namespace-vars", sw->namespace_for_vars);
 	get_field(LIBCFG_PARSER, elem, "verbose", &sw->verbose);
 	get_field(LIBCFG_PARSER, elem, "loglevel", &sw->loglevel);
 	get_field(LIBCFG_PARSER, elem, "syslog", &sw->syslog_enabled);
diff --git a/examples/configuration/swupdate.cfg b/examples/configuration/swupdate.cfg
index 46bf1f4c..c9053ddf 100644
--- a/examples/configuration/swupdate.cfg
+++ b/examples/configuration/swupdate.cfg
@@ -48,6 +48,10 @@ 
 #			  Possible values are ebg, grub, uboot, and none for
 #			  EFI Boot Guard, U-Boot, GRUB, and the Environment in RAM bootloader,
 #			  respectively, given the respective bootloader support is compiled-in.
+#
+# namespace-vars	: namespace used by libubootenv for application/SWUpdate persistent
+#			  variables. This can be overridden in sw-description.
+#			  It is one set in libubootenv configuration file.
 globals :
 {