Message ID | 1560867883-3726-2-git-send-email-philippe.reynes@softathome.com |
---|---|
State | Changes Requested |
Headers | show |
Series | [1/2,V2] scripts: a file is no longer required | expand |
Hi Philippe, On 18/06/19 16:24, Philippe Reynes wrote: > 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 remove all 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, 6 insertions(+), 7 deletions(-) > > diff --git a/corelib/installer.c b/corelib/installer.c > index 2dda40a..fb7b41c 100644 > --- a/corelib/installer.c > +++ b/corelib/installer.c > @@ -100,9 +100,9 @@ static int extract_scripts(int fd, struct imglist *head, int fromfile) > > LIST_FOREACH(script, head, next) { > if (script->provided == 0) { > - ERROR("Required script %s not found in image", > + TRACE("script %s not found in image", > script->fname); > - return -1; > + continue; But this simply ignores the error - what about if there is a script in sw-description but the file is not provided in the SWU ? Error must be raised as it is done now. I would replace here checking if a filename is provided, like: > if (strlen(script->fname) && (script->provided == 0)) { > } > > snprintf(script->extract_file, sizeof(script->extract_file), "%s%s", > @@ -198,6 +198,7 @@ static int run_prepost_scripts(struct imglist *list, script_fn type) > LIST_FOREACH(img, list, next) { > if (!img->is_script) > continue; > + printf("type = %s\n", img->type); printf ? Was debugging ? > hnd = find_handler(img); > if (hnd) { > ret = hnd->installer(img, &type); > 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."); This is ok IMHO. > > script = (struct img_type *)calloc(1, sizeof(struct img_type)); > if (!script) { > Best regards, Stefano Babic
diff --git a/corelib/installer.c b/corelib/installer.c index 2dda40a..fb7b41c 100644 --- a/corelib/installer.c +++ b/corelib/installer.c @@ -100,9 +100,9 @@ static int extract_scripts(int fd, struct imglist *head, int fromfile) LIST_FOREACH(script, head, next) { if (script->provided == 0) { - ERROR("Required script %s not found in image", + TRACE("script %s not found in image", script->fname); - return -1; + continue; } snprintf(script->extract_file, sizeof(script->extract_file), "%s%s", @@ -198,6 +198,7 @@ static int run_prepost_scripts(struct imglist *list, script_fn type) LIST_FOREACH(img, list, next) { if (!img->is_script) continue; + printf("type = %s\n", img->type); hnd = find_handler(img); if (hnd) { ret = hnd->installer(img, &type); 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) {
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 remove all 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, 6 insertions(+), 7 deletions(-)