[3/4] parser: added output attribute
diff mbox series

Message ID 20190828052014.2466-3-sbabic@denx.de
State Accepted
Headers show
Series
  • [1/4] cpio: export get_cpiohdr function
Related show

Commit Message

Stefano Babic Aug. 28, 2019, 5:20 a.m. UTC
Define the filename to be used together with -o parameter inside
sw-description. In this way, it is possible to store on demand different
SWUs (software, configuration, etc.).

Signed-off-by: Stefano Babic <sbabic@denx.de>
---
 parser/parser.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Patch
diff mbox series

diff --git a/parser/parser.c b/parser/parser.c
index b2a6ebd..e8c13a3 100644
--- a/parser/parser.c
+++ b/parser/parser.c
@@ -155,6 +155,15 @@  static bool get_common_fields(parsertype p, void *cfg, struct swupdate_cfg *swcf
 			  swcfg->bootloader_transaction_marker == true ? "true" : "false");
 	}
 
+	if ((setting = find_node(p, cfg, "output", swcfg)) != NULL) {
+		if (!strlen(swcfg->output)) {
+			TRACE("Output file set but not enabled with -o, ignored");
+		} else {
+			GET_FIELD_STRING(p, setting, NULL, swcfg->output);
+			TRACE("Incoming SWU stored : %s", swcfg->output);
+		}
+	}
+
 	return true;
 }