From patchwork Fri Aug 28 14:26:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Condarelli X-Patchwork-Id: 1353288 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:4864:20::338; helo=mail-wm1-x338.google.com; envelope-from=swupdate+bncbcq5tuvs2ugrblfiut5akgqeo7kj53y@googlegroups.com; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.a=rsa-sha256 header.s=20161025 header.b=geel0bJF; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=B/ZN3MNV; dkim-atps=neutral Received: from mail-wm1-x338.google.com (mail-wm1-x338.google.com [IPv6:2a00:1450:4864:20::338]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BdMP12q4xz9sTK for ; Sat, 29 Aug 2020 00:27:01 +1000 (AEST) Received: by mail-wm1-x338.google.com with SMTP id c198sf478089wme.5 for ; Fri, 28 Aug 2020 07:27:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1598624813; cv=pass; d=google.com; s=arc-20160816; b=Tul2nEp+43ruJEoag6lYLMGJHJ8m4A4dzjcjPJShWoK/mffetf7gJPIfvwDnXGDxrO ZYmduu30obiyf/LH/R1UU2Z89SN/29gylF2esXWXcOoZ7ahXr7JMWHoxy7PJoArQY6ZN 42u2CEx/Tge05iDlOzGlpcr2DZfv7QtQvG53JU3WaEmOzCteGXiAP2iMzHZHAZEEx47d XIMwrsK95spw6KEBvPTitlwO4xPF9/bVbvZie03AXCA5AmYF1ECBfl3KDvxWgxfqa5M4 6SDHe/fhjyeXmFKUAhheGsGEt8QY7FiKIesOeXo977nKs9UfwIUHSZHC20J0XI6CauDi cRqA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:to:subject:message-id:date:from :mime-version:sender:dkim-signature:dkim-signature; bh=z7wuq2YBPQwxAdXXCx6l11adRYAxgASSE1/EViXghVA=; b=0JVFCDbqhF6Bu3AkT6ZzG00FnfGVE75hYu0gxz/HoARCP7gxmkpwhGLOONJEWyp0Y/ COnDu0Hwn4UsxkLnHwR1tsQOODOXTsiaOdc4wDwbnqB+4jME7nloRan6GsT0bEIeLday mvmTlOk83ClBx3sZJVOhoIuELZLG3xH0Vut/eNSwUYZijdjORqWSofSVT9OgI0mXAtMB uTwxph4zPdS2WRMJw3rDdN/TBwzuVEyM9WrFZ1BdM2w4N9AHXqu3HPjpa9kBnLlSit51 Zben+CQclaSeEtMp+VZAhJZ9W81+2JeaKzlmHqtDu2UWMRuMNsU1uGPxtLVDLKCsdRYU 08TA== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=U6hrSL6U; spf=pass (google.com: domain of ziobyte@gmail.com designates 2a00:1450:4864:20::635 as permitted sender) smtp.mailfrom=ziobyte@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:mime-version:from:date:message-id:subject:to :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=z7wuq2YBPQwxAdXXCx6l11adRYAxgASSE1/EViXghVA=; b=geel0bJF7Ugw8oLJBNhmS2CH+rG75EslN+xKNqQcPaGOm7v0Tz90bHuSgorUIq2uOM fcBBcTUHpKo585MD1fasIpOvtnoAS706JDf+IZ5LdvnO/ZTkDtSbn1vmZz0hLhL8quDd nLGrcigZMvdJA1cByZci6Gm4yZDbVvPVA2xHbXKIkNEdFFqJvXV2uGByR4ACzAucYSzs 6DMhbeGKMmdjZfpMzHmMCDluJ/45Pydx0mrjmTL6XSG8ZzLDG63qOQ2uY3R30zBcwIS4 l6w9xegyFfrVry+tRr3Jez6dobgfKxX23sLcmejNTfpzghp0MOBXvn8WDcVElpTiqydw Jezg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-subscribe:list-unsubscribe; bh=z7wuq2YBPQwxAdXXCx6l11adRYAxgASSE1/EViXghVA=; b=B/ZN3MNVNgb7sIFjEzpdy2VXdpbv0k8jcV2Me5XNzrJtvnoIWH2RTsBH74Jaod/IuY Vy+6uL0+CLPxyiqgQJbVQnD6u96U4mfHk5PH+llKVN0R92NjNYVLVN3rVAXdDPeEDT0g Zy9mK8KcGJZfpu6CtfBhOHcNsNb2slsN6Vosbiv+UtOEWCrpa3uRPCk1E3kdv0fKcbKo 2f7CJvPnDAtnqc858QopCruoyWOC1NTxsvmuz4AseOlSqS2MQP5mmW0BleMLu9n1nTgq 19JWj4+PQb+m557z6M6swgMor2BhQu9fxXeNtjGRTMC5wC/36o36KZLIagJFZihX4xrt 4gFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:from:date:message-id:subject :to:x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:x-spam-checked-in-group:list-post:list-help :list-archive:list-subscribe:list-unsubscribe; bh=z7wuq2YBPQwxAdXXCx6l11adRYAxgASSE1/EViXghVA=; b=sVQsi09eZRDN/99xNOhlA763jVuZ5XYE2JHXAA/D7P+Cw0VP1k0o20ZsqAGUcE4oPL GBUUGXPWo7yVNVwE4SEXXeC4J0Ip/wUhoOrosUScw5R5zUvpMusugKLPpjYQZs2fPYGA QEZ8r5weO1uZny8uB1DrHDO3Hi5FYf2kgUgKmj4as4b9eoi9H+Wr/C152FDWIzLoBAbf kST0mBNQ3WnHsH5gNGXuZXR4QOQpZQr2seiH7ce9BcxkoBUESY5mgtDyTiwjv02qP3g6 CmTvgBbK4+SMMcGR/jCG3xI62t8hXUhXwMmi9nWehf91SM0qVYqJs35K0H9Od21AP84X ms9g== Sender: swupdate@googlegroups.com X-Gm-Message-State: AOAM530lWAKsdbvj/JAKJl62kw8LW4WZEdl8Yn1ad9GGAkVqmEEmdbCT KM8sWGwxiEO2PFm5/qLojBw= X-Google-Smtp-Source: ABdhPJxt13YpBGc4KPmPMPL9jTTBnXs/5U4QHfufeK5+yEr//DuG48L+ztFFpvwuynV5n/IJrU5AxQ== X-Received: by 2002:a7b:cb8f:: with SMTP id m15mr1903070wmi.107.1598624813190; Fri, 28 Aug 2020 07:26:53 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a1c:1b8a:: with SMTP id b132ls708763wmb.2.gmail; Fri, 28 Aug 2020 07:26:52 -0700 (PDT) X-Received: by 2002:a1c:b342:: with SMTP id c63mr1926093wmf.85.1598624812382; Fri, 28 Aug 2020 07:26:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598624812; cv=none; d=google.com; s=arc-20160816; b=eH8Ro5q7PlV0TlsLIcGZrIJbzhrkMX0imUAgnUZbRNyz/R5AUk4gEIlsxfXUdujyc7 5ttohO8SixWqIOqq5ywKeMyAL9KXHEjx28JjfhmqCeqKhxu1VKnFate+kNAbQZMjuV4V 7qXsvZrakM+OoAhBFmeXQMh0NHZETR4YfvS0ox5J4sOkdfq7cXMv4Rciik3pJFA/BXll UhfdzV3lqZ8NOIPEpYXpcOAeOe+V/ebPpAm/szcWkkXyKQO7V/+ujS/ZOvqGzIjQaMop XOQ9it7jXLWDTUlQPHGPKDPTDorf5vKYNFKemd7UzZCaE1NPD0IJeIx6XrKEDdkpTE+s OBog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:subject:message-id:date:from:mime-version:dkim-signature; bh=Eu9+zs2voFFbgO8PYzDbQbETS49d5GIQjlOlNTopOdU=; b=KQNzr/Zj7U7ZD+RCvQ6XMvtsvwa87P+ee8Jr9ecsUTKs+Ycr6eJAAR1wFpPf6kjioO neGj2FszXHSzJ53IoSiyrgBqRROPv3aUzzmO3zKdFoishpBtJLtBzr2Jl8WEajiI76KH mZaeOahTC+iIEKFlsk2hNpxpEqPAaMA93u6zGKWQMr1FCfsvo4PbvvjOKWNYLvFMfktj /oW48lJzlUqHofYJ213o0r/znDrDacs+py5gri5UY7AOaypynsLnUcTYl5mqtUNTp4/i qUk7xiWOO86Lq34t+3IuB+uv+fyewnzPOgmHVXozMQmkFMgMA/Zhmo7BMyvQVriRme34 HwLw== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=U6hrSL6U; spf=pass (google.com: domain of ziobyte@gmail.com designates 2a00:1450:4864:20::635 as permitted sender) smtp.mailfrom=ziobyte@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com. [2a00:1450:4864:20::635]) by gmr-mx.google.com with ESMTPS id h11si62491wrc.2.2020.08.28.07.26.52 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 28 Aug 2020 07:26:52 -0700 (PDT) Received-SPF: pass (google.com: domain of ziobyte@gmail.com designates 2a00:1450:4864:20::635 as permitted sender) client-ip=2a00:1450:4864:20::635; Received: by mail-ej1-x635.google.com with SMTP id a21so1793462ejp.0 for ; Fri, 28 Aug 2020 07:26:52 -0700 (PDT) X-Received: by 2002:a17:906:5206:: with SMTP id g6mr2176630ejm.292.1598624811994; Fri, 28 Aug 2020 07:26:51 -0700 (PDT) MIME-Version: 1.0 From: Mauro Condarelli Date: Fri, 28 Aug 2020 16:26:41 +0200 Message-ID: Subject: [swupdate] Move artifact version check to inner parsing loop To: swupdate X-Original-Sender: ZioByte@gmail.com X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=U6hrSL6U; spf=pass (google.com: domain of ziobyte@gmail.com designates 2a00:1450:4864:20::635 as permitted sender) smtp.mailfrom=ziobyte@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Hi, this is the first patch of a series (see below) meant to enhance Hook handling. Commit message reads: Move artifact version check to inner parsing loop. > > Artifact version, when install-if-differet/install-if-higher is > specified, > is now done before call to parsing hook (if any). > > To do this: > - functions is_image_installed() and is_image_higher() moved from > core/parser.c > to parser/parser.c > - calls to these functions, together with loops in > remove_installed_image_list() > and remove_higher_image_list() were completely removed from > core/parser.c > - boolean `required` in `struct img_type` was replaced with `enum > skip_t skip` > - field `img_type.skip` is assigned a value detailing reason for skip > (if any) > - field `img_type.skip` is inserted into table passed to Lua hook (if > any) end > retrieved after Lua call so hook function can override setting. > - if `img_type.skip` is non-zero the image is considered "skippable" > and the > whole `img_type` structure is removed from handling list. > > Signed-off-by: Mauro Condarelli > Next patches will: 1. make `embedded-script` Lua environment "permanent" (i.e.: not constrained to parsing). 2. add `pre-install-hook` and `post-install-hook` to artifacts. 3. ensure these hooks are called at the appropriate moment regardless of `installed-directly` setting. 4. add a series of standard hooks (to be defined in `embedded-script`) to be called at specific points; e.g.: startup, before-parsing, after-parsing, before-installation, after-installation, before-bootvars, after-bootvars, on-error. 5. all above hooks will be defined in `embedded-script`and they will share a single environment, so that variables set in one hook will be available to all hooks called after that. As always comments and criticism are most welcome. Regards Mauro Signed-off-by: Mauro Condarelli From 8279090b0268d7efac63b5cb9bf8d08ebf68c529 Mon Sep 17 00:00:00 2001 From: Mauro Condarelli Date: Fri, 28 Aug 2020 15:36:20 +0200 Subject: [PATCH] Move artifact version check to inner parsing loop. Artifact version, when install-if-differet/install-if-higher is specified, is now done before call to parsing hook (if any). To do this: - functions is_image_installed() and is_image_higher() moved from core/parser.c to parser/parser.c - calls to these functions, together with loops in remove_installed_image_list() and remove_higher_image_list() were completely removed from core/parser.c - boolean `required` in `struct img_type` was replaced with `enum skip_t skip` - field `img_type.skip` is assigned a value detailing reason for skip (if any) - field `img_type.skip` is inserted into table passed to Lua hook (if any) end retrieved after Lua call so hook function can override setting. - if `img_type.skip` is non-zero the image is considered "skippable" and the whole `img_type` structure is removed from handling list. Signed-off-by: Mauro Condarelli --- core/parser.c | 98 ----------------------------------------- core/stream_interface.c | 2 +- corelib/lua_interface.c | 5 ++- include/swupdate.h | 9 +++- parser/parser.c | 91 +++++++++++++++++++++++++++++++++----- 5 files changed, 93 insertions(+), 112 deletions(-) diff --git a/core/parser.c b/core/parser.c index 7f281cf..bc13d26 100644 --- a/core/parser.c +++ b/core/parser.c @@ -130,100 +130,6 @@ static int check_handler_list(struct imglist *list, return 0; } -static int is_image_installed(struct swver *sw_ver_list, - struct img_type *img) -{ - struct sw_version *swver; - - if (!sw_ver_list) - return false; - - if (!strlen(img->id.name) || !strlen(img->id.version) || - !img->id.install_if_different) - return false; - - LIST_FOREACH(swver, sw_ver_list, next) { - /* - * Check if name and version are identical - */ - if (!strncmp(img->id.name, swver->name, sizeof(img->id.name)) && - !compare_versions(img->id.version, swver->version)) { - TRACE("%s(%s) already installed, skipping...", - img->id.name, - img->id.version); - - return true; - } - } - - return false; -} - -static int is_image_higher(struct swver *sw_ver_list, - struct img_type *img) -{ - struct sw_version *swver; - - if (!sw_ver_list) - return false; - - if (!strlen(img->id.name) || !strlen(img->id.version) || - !img->id.install_if_higher) - return false; - - LIST_FOREACH(swver, sw_ver_list, next) { - const char* current_version = swver->version; - const char* proposed_version = img->id.version; - - /* - * Check if name are identical and the new version is lower - * or equal. - */ - if (!strncmp(img->id.name, swver->name, sizeof(img->id.name)) && - (compare_versions(proposed_version, current_version) < 0)) { - TRACE("%s(%s) has a higher version installed, skipping...", - img->id.name, - img->id.version); - - return true; - } - } - - return false; -} - -/* - * Remove the image if the same version is already installed - */ -static void remove_installed_image_list(struct imglist *img_list, - struct swver *sw_ver_list) -{ - struct img_type *img, *tmp; - - LIST_FOREACH_SAFE(img, img_list, next, tmp) { - if (is_image_installed(sw_ver_list, img)) { - LIST_REMOVE(img, next); - free_image(img); - } - } -} - -/* - * Remove the image if a higher version is already installed - */ -static void remove_higher_image_list(struct imglist *img_list, - struct swver *sw_ver_list) -{ - struct img_type *img, *tmp; - - LIST_FOREACH_SAFE(img, img_list, next, tmp) { - if (is_image_higher(sw_ver_list, img)) { - LIST_REMOVE(img, next); - free_image(img); - } - } -} - int parse(struct swupdate_cfg *sw, const char *descfile) { int ret = -1; @@ -326,10 +232,6 @@ int parse(struct swupdate_cfg *sw, const char *descfile) } } - remove_installed_image_list(&sw->images, &sw->installed_sw_list); - - remove_higher_image_list(&sw->images, &sw->installed_sw_list); - /* * Compute the total number of installer * to initialize the progress bar diff --git a/core/stream_interface.c b/core/stream_interface.c index 99e5c62..228c78a 100644 --- a/core/stream_interface.c +++ b/core/stream_interface.c @@ -281,7 +281,7 @@ static int extract_files(int fd, struct swupdate_cfg *software) */ LIST_FOREACH(img, &software->images, next) { - if (! img->required) + if ( img->skip) continue; if (! img->fname[0]) continue; diff --git a/corelib/lua_interface.c b/corelib/lua_interface.c index eb05429..2025942 100644 --- a/corelib/lua_interface.c +++ b/corelib/lua_interface.c @@ -336,6 +336,8 @@ static void lua_number_to_img(struct img_type *img, const char *key, img->size = (long long)val; if (!strcmp(key, "checksum")) img->checksum = (unsigned int)val; + if (!strcmp(key, "skip")) + img->skip = (unsigned int)val; } #ifdef CONFIG_HANDLER_IN_LUA @@ -492,6 +494,7 @@ static void update_table(lua_State* L, struct img_type *img) LUA_PUSH_IMG_NUMBER(img, "offset", seek); LUA_PUSH_IMG_NUMBER(img, "size", size); LUA_PUSH_IMG_NUMBER(img, "checksum", checksum); + LUA_PUSH_IMG_NUMBER(img, "skip", skip); switch (img->compressed) { case COMPRESSED_ZLIB: @@ -540,7 +543,7 @@ static void update_table(lua_State* L, struct img_type *img) #endif lua_getfield(L, -1, "_private"); - LUA_PUSH_IMG_NUMBER(img, "offset", offset); + LUA_PUSH_IMG_NUMBER(img, "offset", offset); lua_pop(L, 1); char *hashstring = alloca(2 * SHA256_HASH_LENGTH + 1); diff --git a/include/swupdate.h b/include/swupdate.h index 8854d2f..29b756d 100644 --- a/include/swupdate.h +++ b/include/swupdate.h @@ -41,6 +41,13 @@ enum { INSTALL_FROM_STREAM }; +typedef enum { + SKIP_NONE=0, + SKIP_SAME, + SKIP_HIGHER, + SKIP_SCRIPT +} skip_t; + enum { COMPRESSED_FALSE, COMPRESSED_TRUE, @@ -70,7 +77,7 @@ struct img_type { char extract_file[MAX_IMAGE_FNAME]; char filesystem[MAX_IMAGE_FNAME]; unsigned long long seek; - int required; + skip_t skip; int provided; int compressed; int preserve_attributes; /* whether to preserve attributes in archives */ diff --git a/parser/parser.c b/parser/parser.c index dce5180..8f8b25c 100644 --- a/parser/parser.c +++ b/parser/parser.c @@ -248,6 +248,68 @@ static int parse_hw_compatibility(parsertype __attribute__ ((__unused__))p, } #endif +static int is_image_installed(struct swver *sw_ver_list, + struct img_type *img) +{ + struct sw_version *swver; + + if (!sw_ver_list) + return false; + + if (!strlen(img->id.name) || !strlen(img->id.version) || + !img->id.install_if_different) + return false; + + LIST_FOREACH(swver, sw_ver_list, next) { + /* + * Check if name and version are identical + */ + if (!strncmp(img->id.name, swver->name, sizeof(img->id.name)) && + !compare_versions(img->id.version, swver->version)) { + TRACE("%s(%s) already installed, skipping...", + img->id.name, + img->id.version); + + return true; + } + } + + return false; +} + +static int is_image_higher(struct swver *sw_ver_list, + struct img_type *img) +{ + struct sw_version *swver; + + if (!sw_ver_list) + return false; + + if (!strlen(img->id.name) || !strlen(img->id.version) || + !img->id.install_if_higher) + return false; + + LIST_FOREACH(swver, sw_ver_list, next) { + const char* current_version = swver->version; + const char* proposed_version = img->id.version; + + /* + * Check if name are identical and the new version is lower + * or equal. + */ + if (!strncmp(img->id.name, swver->name, sizeof(img->id.name)) && + (compare_versions(proposed_version, current_version) < 0)) { + TRACE("%s(%s) has a higher version installed, skipping...", + img->id.name, + img->id.version); + + return true; + } + } + + return false; +} + static int run_embscript(parsertype p, void *elem, struct img_type *img, lua_State *L, const char *embscript) { @@ -260,7 +322,7 @@ static int run_embscript(parsertype p, void *elem, struct img_type *img, return lua_parser_fn(L, embfcn, img); } -static int parse_common_attributes(parsertype p, void *elem, struct img_type *image) +static int parse_common_attributes(parsertype p, void *elem, struct img_type *image, struct swupdate_cfg *cfg) { char seek_str[MAX_SEEK_STRING_SIZE]; const char* compressed; @@ -310,6 +372,14 @@ static int parse_common_attributes(parsertype p, void *elem, struct img_type *im get_field(p, elem, "encrypted", &image->is_encrypted); GET_FIELD_STRING(p, elem, "ivt", image->ivt_ascii); + if (is_image_installed(&cfg->installed_sw_list, image)) { + image->skip = SKIP_SAME; + } else if (is_image_higher(&cfg->installed_sw_list, image)) { + image->skip = SKIP_HIGHER; + } else { + image->skip = SKIP_NONE; + } + return 0; } @@ -340,7 +410,7 @@ static int parse_partitions(parsertype p, void *cfg, struct swupdate_cfg *swcfg) ERROR("No memory: malloc failed"); return -ENOMEM; } - if (parse_common_attributes(p, elem, partition) < 0) { + if (parse_common_attributes(p, elem, partition, swcfg) < 0) { free_image(partition); return -1; } @@ -407,7 +477,7 @@ static int parse_scripts(parsertype p, void *cfg, struct swupdate_cfg *swcfg, lu return -ENOMEM; } - if (parse_common_attributes(p, elem, script) < 0) { + if (parse_common_attributes(p, elem, script, swcfg) < 0) { free_image(script); return -1; } @@ -430,7 +500,7 @@ static int parse_scripts(parsertype p, void *cfg, struct swupdate_cfg *swcfg, lu skip ? "Skip" : "Found", script->fname); - if (skip) { + if (skip || script->skip != SKIP_NONE) { free_image(script); continue; } @@ -500,7 +570,7 @@ static int parse_bootloader(parsertype p, void *cfg, struct swupdate_cfg *swcfg, return -ENOMEM; } - if (parse_common_attributes(p, elem, script) < 0) { + if (parse_common_attributes(p, elem, script, swcfg) < 0) { free_image(script); return -1; } @@ -508,7 +578,7 @@ static int parse_bootloader(parsertype p, void *cfg, struct swupdate_cfg *swcfg, script->is_script = 1; skip = run_embscript(p, elem, script, L, swcfg->embscript); - if (skip != 0) { + if (skip != 0 || script->skip != SKIP_NONE) { free_image(script); if (skip < 0) return -1; @@ -557,7 +627,7 @@ static int parse_images(parsertype p, void *cfg, struct swupdate_cfg *swcfg, lua return -ENOMEM; } - if (parse_common_attributes(p, elem, image) < 0) { + if (parse_common_attributes(p, elem, image, swcfg) < 0) { free_image(image); return -1; } @@ -595,8 +665,7 @@ static int parse_images(parsertype p, void *cfg, struct swupdate_cfg *swcfg, lua image->id.install_if_higher)) ? " Version must be checked" : "" ); - - if (skip) { + if (skip || image->skip != SKIP_NONE) { free_image(image); continue; } @@ -640,7 +709,7 @@ static int parse_files(parsertype p, void *cfg, struct swupdate_cfg *swcfg, lua_ return -ENOMEM; } - if (parse_common_attributes(p, elem, file) < 0) { + if (parse_common_attributes(p, elem, file, swcfg) < 0) { free_image(file); return -1; } @@ -670,7 +739,7 @@ static int parse_files(parsertype p, void *cfg, struct swupdate_cfg *swcfg, lua_ (strlen(file->id.name) && file->id.install_if_different) ? "; Version must be checked" : ""); - if (skip) { + if (skip || file->skip != SKIP_NONE) { free_image(file); continue; } -- 2.25.1