diff mbox series

[1/3,V5] scripts: a file is no longer required

Message ID 1561643244-23158-2-git-send-email-philippe.reynes@softathome.com
State Accepted
Headers show
Series [1/3,V5] scripts: a file is no longer required | expand

Commit Message

Philippe REYNES June 27, 2019, 1:47 p.m. UTC
A file was required for scripts. We may also have
a script with a handler that only used data provided
in the properties. So we update the test that
block script without file (and filename).

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
---
 corelib/installer.c | 5 +++++
 parser/parser.c     | 8 +++-----
 2 files changed, 8 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/corelib/installer.c b/corelib/installer.c
index 2dda40a..498fcc8 100644
--- a/corelib/installer.c
+++ b/corelib/installer.c
@@ -99,6 +99,11 @@  static int extract_scripts(int fd, struct imglist *head, int fromfile)
 	const char* tmpdir_scripts = get_tmpdirscripts();
 
 	LIST_FOREACH(script, head, next) {
+		if (!script->fname[0] && (script->provided == 0)) {
+			TRACE("No script provided for script of type %s",
+				script->type);
+			continue;
+		}
 		if (script->provided == 0) {
 			ERROR("Required script %s not found in image",
 				script->fname);
diff --git a/parser/parser.c b/parser/parser.c
index acac406..24ba6ba 100644
--- a/parser/parser.c
+++ b/parser/parser.c
@@ -365,12 +365,10 @@  static int parse_scripts(parsertype p, void *cfg, struct swupdate_cfg *swcfg, lu
 			continue;
 
 		/*
-		 * Check for mandatory field
+		 * Check for filename field
 		 */
-		if(!(exist_field_string(p, elem, "filename"))) {
-			TRACE("Script entry without filename field, skipping..");
-			continue;
-		}
+		if(!(exist_field_string(p, elem, "filename")))
+			TRACE("Script entry without filename field.");
 
 		script = (struct img_type *)calloc(1, sizeof(struct img_type));
 		if (!script) {