diff mbox series

Add a first-in, first-install order

Message ID 1510090093-27773-1-git-send-email-sbabic@denx.de
State Accepted
Headers show
Series Add a first-in, first-install order | expand

Commit Message

Stefano Babic Nov. 7, 2017, 9:28 p.m. UTC
Currently, files are installed before images and each entry
in sw-description is installed in reverse order. In some applications,
the installation relies on the order, for example if files are installed on a fresh
burned image.

To provide this use case, install "images" before "files" and ensures that they
are installed in the same order they are put into the sw-description file.

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

Patch

diff --git a/parser/parser.c b/parser/parser.c
index 591970c..fe70b3b 100644
--- a/parser/parser.c
+++ b/parser/parser.c
@@ -389,7 +389,7 @@  static int parse_images(parsertype p, void *cfg, struct swupdate_cfg *swcfg, lua
 
 	count = get_array_length(p, setting);
 
-	for(i = 0; i < count; ++i) {
+	for(i = (count - 1); i >= 0; --i) {
 		elem = get_elem_from_idx(p, setting, i);
 
 		if (!elem)
@@ -489,7 +489,8 @@  static int parse_files(parsertype p, void *cfg, struct swupdate_cfg *swcfg, lua_
 		return 0;
 
 	count = get_array_length(p, setting);
-	for(i = 0; i < count; ++i) {
+
+	for(i = (count - 1); i >= 0; --i) {
 		elem = get_elem_from_idx(p, setting, i);
 
 		if (!elem)
@@ -572,10 +573,10 @@  static int parser(parsertype p, void *cfg, struct swupdate_cfg *swcfg)
 
 	/* Now parse the single elements */
 	ret = parse_hw_compatibility(p, cfg, swcfg) ||
+		parse_files(p, cfg, swcfg, L) ||
 		parse_images(p, cfg, swcfg, L) ||
 		parse_scripts(p, cfg, swcfg) ||
-		parse_bootloader(p, cfg, swcfg) ||
-		parse_files(p, cfg, swcfg, L);
+		parse_bootloader(p, cfg, swcfg);
 
 	/*
 	 * Move the partitions at the beginning to be processed