From patchwork Thu Apr 8 07:32:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dominique MARTINET X-Patchwork-Id: 1463671 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=2607:f8b0:4864:20::103b; helo=mail-pj1-x103b.google.com; envelope-from=swupdate+bncbcwivbv7sugrbehdxkbqmgqe2g7di6a@googlegroups.com; receiver=) 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=UxRm1vmK; dkim-atps=neutral Received: from mail-pj1-x103b.google.com (mail-pj1-x103b.google.com [IPv6:2607:f8b0:4864:20::103b]) (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 4FGCdw3j1nz9sRK for ; Thu, 8 Apr 2021 17:32:35 +1000 (AEST) Received: by mail-pj1-x103b.google.com with SMTP id f22sf884958pjq.9 for ; Thu, 08 Apr 2021 00:32:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1617867153; cv=pass; d=google.com; s=arc-20160816; b=M24TgmSSWvd1S2ddzyKWLTMPAiOFvDtCA3V0OThwkNlDofEr3lthpUuXmlGBWP7YVl mYrOydyqbcfYdu+xhanHqgDGugGS7epTHn4FaXh4zNvp69ANmE+P9gTAsUQm1uNxg34i 9Oi8EMfe87nTUuO6ypZ/Iebe1GRZowq8YbY6HwtwzHYXlyGH3a6znRft6pb6dJgsQw0Z nsbheY/oiMhL+xivZurwPsZ62wQGOkr+XvTZy4ALRuDpPV+msKO4i1GYl3KPXP1FOP0K tEAYVofqh2e7/+wg2yMYMCOojJIjHg5QL+0sxyEh2/DZRCbK2V0ct6pyU5lW85n9XwOI orIw== 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:mime-version:message-id:date :subject:cc:to:from:sender:dkim-signature; bh=hSPUx9YI32vwcFEeXOVOCGTMANKzSYXimlRY0UsGx+8=; b=nXkZmocLgoEBqPtzJtOS/IkezSUr3ayBicndUFiIANZKzur4674L2sg+G3/0V+pg5P 58JYZkJkt4vX+A/GpW8XcDbxg/J9whzC8m9oKGnzQagvEaKvhh0DSOrwAs1nFNvYRLTv vo7oRsgPBqpTKXHXZ+jwlvFQdMR8Pv+AThyfdkxz92WlyQn3hyeDY5adkxN2LOKEhChp uFBt0DaO/EXmj9kpcUkMaKRr9qCLzDoJ96B0G1u01eDTe7lTVwlhi0GyPBHHYVj8R8Wh 2R35RZJdMhFkxIc1K+dLkQS/TB0DarvichDvky0opBcuIEtPQ+gQdJpfKNIbX62WPCmc M0pA== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=pass (google.com: domain of dominique.martinet@atmark-techno.com designates 13.115.124.170 as permitted sender) smtp.mailfrom=dominique.martinet@atmark-techno.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:mime-version :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=hSPUx9YI32vwcFEeXOVOCGTMANKzSYXimlRY0UsGx+8=; b=UxRm1vmKELc+GFxnIOgBkMjWWjagoxRe0qrwRid1J8Yp1gByNrmA693xx11NXZJJAo rfKiEXejbYos4WzOAObM+GVQ/gQ6FaAPeqZ0KmaPBkAx/RG0PuRDHpFMwWErWTPkkxtl kF/UfVy8eQn4go4AucBolx2jeLvuLO7+xbvo5THG8ZoIniDnv31hpik5fY6cPkXG/Ajb hS05rr0xumz4LaO3u4kCZtmaHgnW/EQFVqNPzwSdPw6Wm/8z8mOin9lkvyyha+qsF1aH 112Fu1R5kD/D+XSqdfNAAT5vdN+4M+0X3HiRblL/jLe0x21tkpah1+5yqWKPKuxpujjq xRRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:from:to:cc:subject:date:message-id :mime-version: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=hSPUx9YI32vwcFEeXOVOCGTMANKzSYXimlRY0UsGx+8=; b=hxFHOpJBOgHWEFqYNUDnzlvY2U/lky65yodwtdB6qxT+Ri3bJU4QwQfH2mPe/R/NZ9 BAZir6B+lkYLeUrmByKBJypESSwSGXZJEX31GdSC4crs3abUfujakkwq3W2hD0qM6mI0 YH+sOV1ZLh/3wb8wCN11WcfcugICwVSE9NsjwrOvcKusfckexPH3fqaxAluZDZ5gn0I7 idr0rUJPh9HrZT4/YGRYAk97yT390YM+jmpDBqFr6GTQLE/qNcH6LLlLQtTeR4/rBH+S ihiLD8e7yq27oE2HEmAoIrAOo91sgvoJXB0YL0YPhjvU+toT4fk9nI1KCRPscNX8kM0N vMfw== Sender: swupdate@googlegroups.com X-Gm-Message-State: AOAM533cL1bKd7zmy2Gc/xQzcY9KzCstJfAwfQfRPEAjR5L6f9RSV2xi E+JEByPCaiW3JZO/3K8r94w= X-Google-Smtp-Source: ABdhPJzUKfhrrj/mFGUUeSMxXbESkQPFkK5Pg16iQPN/GxaoV/3EMBfd1idcvH3LZ7kSeB29+vEbKw== X-Received: by 2002:a17:902:9b8a:b029:e6:17bb:eff0 with SMTP id y10-20020a1709029b8ab02900e617bbeff0mr6674606plp.54.1617867152847; Thu, 08 Apr 2021 00:32:32 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a17:90a:2f88:: with SMTP id t8ls674570pjd.1.gmail; Thu, 08 Apr 2021 00:32:32 -0700 (PDT) X-Received: by 2002:a17:90a:a389:: with SMTP id x9mr6140234pjp.232.1617867152269; Thu, 08 Apr 2021 00:32:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617867152; cv=none; d=google.com; s=arc-20160816; b=yTc0CUPEtl0LPtqgo/sSfChPOIXnAbE7O7POsh1VkM5ScfA8y4nFM0N+iaSNd2jhHU iZ6dHFPrKAGx7GBWLP4uTfWswpRg0/RrMlKAuqODSzZq28KdEPS4QpJeeyye+ju8oURn Hdhh0z3sPXCe626RMvB7+g7w4/z49N3ZanJxUEVkoMjvUxqE/pTgDl/5ebTyABInWMUY St4bGvWbNJIWTyVNNeFczmQDdWKgAo2tPMA0kD5wiEcxBhfy9bCn+S+fuu2YRDIRmn68 i5Ni9i2SmMgcwPzrDKzWNkkD21rc7Adlz7D62KnnzZTKzRCf2+ElRlGDY3Tmr1MvuaxV atSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from; bh=t+YaVn5CPhKDLPMQ9yzIOTS8XcrOjLXWlSZ/6zwE9IA=; b=meO+tCdJG7howAgMMWiDEf1KbWf9dczZAaZ32skWmSFHImKkQxPwmhtrHK0bKjonRI AAQh5O45+DjOIdoLZU/d1+EBN0KDj6DE2nPwL4/wwZdX/r+jXkQ42d/AOiQXR1XSEKvl rUW8GuB3NhWEzjSR/1gUHxkdTwXLLkCcfq4Yp7pILuWXtj59B9cboB8PXhyVDcxZ8Op7 /8gZXJrmWu3DAGNc7aFZBy6hd+m2XDuPNgJoeDxF5CsymAswYcSfZPTOIm1+p9FBthMR Pj3vbGPF52pE0ZxWofph85sBpiGeTujiZgDdvtUU8cpHaYNrtKdewHfqSxC32BV9xpPi BXog== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of dominique.martinet@atmark-techno.com designates 13.115.124.170 as permitted sender) smtp.mailfrom=dominique.martinet@atmark-techno.com Received: from gw.atmark-techno.com (gw.atmark-techno.com. [13.115.124.170]) by gmr-mx.google.com with ESMTP id x4si462681pjq.0.2021.04.08.00.32.32 for ; Thu, 08 Apr 2021 00:32:32 -0700 (PDT) Received-SPF: pass (google.com: domain of dominique.martinet@atmark-techno.com designates 13.115.124.170 as permitted sender) client-ip=13.115.124.170; Received: from gw.atmark-techno.com (localhost [127.0.0.1]) by gw.atmark-techno.com (Postfix) with ESMTP id 1000780251 for ; Thu, 8 Apr 2021 16:32:31 +0900 (JST) Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) by gw.atmark-techno.com (Postfix) with ESMTPS id C19DF80251 for ; Thu, 8 Apr 2021 16:32:30 +0900 (JST) Received: by mail-pl1-f199.google.com with SMTP id p5so518269pld.9 for ; Thu, 08 Apr 2021 00:32:30 -0700 (PDT) X-Received: by 2002:a65:4303:: with SMTP id j3mr6759750pgq.55.1617867149449; Thu, 08 Apr 2021 00:32:29 -0700 (PDT) X-Received: by 2002:a65:4303:: with SMTP id j3mr6759741pgq.55.1617867149194; Thu, 08 Apr 2021 00:32:29 -0700 (PDT) Received: from pc-0115 (117.209.187.35.bc.googleusercontent.com. [35.187.209.117]) by smtp.gmail.com with ESMTPSA id v135sm24210922pgb.82.2021.04.08.00.32.28 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Apr 2021 00:32:28 -0700 (PDT) Received: from martinet by pc-0115 with local (Exim 4.94) (envelope-from ) id 1lUP9P-00EmhK-AW; Thu, 08 Apr 2021 16:32:27 +0900 From: Dominique Martinet To: swupdate@googlegroups.com Cc: Dominique Martinet Subject: [swupdate] [PATCH 1/2] doc swupdate.rst: clarify execution order for scripts Date: Thu, 8 Apr 2021 16:32:20 +0900 Message-Id: <20210408073221.3523729-1-dominique.martinet@atmark-techno.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Original-Sender: dominique.martinet@atmark-techno.com X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of dominique.martinet@atmark-techno.com designates 13.115.124.170 as permitted sender) smtp.mailfrom=dominique.martinet@atmark-techno.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: , Signed-off-by: Dominique Martinet --- Attempt at clarifying following discussion on the list: https://groups.google.com/g/swupdate/c/Ih6Co_4CCq8/m/FmhCRWZtCQAJ Rewriting someone's words is always difficult, feel free to adjust as you see fit as I might not have kept your original intention through very well. doc/source/swupdate.rst | 45 ++++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/doc/source/swupdate.rst b/doc/source/swupdate.rst index 361f24840007..f53f4dbb18f5 100644 --- a/doc/source/swupdate.rst +++ b/doc/source/swupdate.rst @@ -80,7 +80,13 @@ General Overview - Support for setting / erasing `EFI Boot Guard`_ variables -- Support for preinstall scripts. They run before updating the images +- Support for pre and post update commands run before the update starts + processing data and after the update has finished successfully. + +- Support for lua hooks, executed before any handler runs. + +- Support for preinstall scripts. They run after streamed handlers have + handled their data, and before regular handlers. - Support for postinstall scripts. They run after updating the images. @@ -345,24 +351,27 @@ A run of SWUpdate consists mainly of the following steps: with the table in sw-description. - Parse sw-description to determine which artefacts in the incoming SWU are required. Not required artifacts are simply skipped. - The meta file sw-description is declarative and executive. If "hooks" - are defined in sw-description, they are executed at parse time. Hooks - are executed before any artefact is evaluated and they are the best - way to implement pre install functions. + If an "embedded-script" is defined, it is executed at this point + before parsing files. + If "hooks" are defined, they are executed as each file is parsed, + even if they will be skipped. At the end of the parsing, SWUpdate builds an internal mapping for each artifact to recognize which handler should be called for each of them. -- Reads the cpio archive and proofs the CPIO checksum of each single file - (this can be disabled in the configuration) and computes the sha256 sum if foreseen or if Signed Images - are activated. SWUpdate stops if the archive is not complete verified. -- check that all components described in sw-description are - really in the cpio archive. -- run the partitions handlers, if required. -- runs pre-install scripts, if any. Please note: if artifacts are streamed, a preinstall script cannot be - executed because it depends on the order the artifact (including the script) are packed into the CPIO archive. - In this case, please use the "embedded-script" feature in sw-description to execute functions before any - installation takes place. -- if an artifact is found in SWU and it is marked with "installed-directly", proceed with installation, - else extract it temporarily into TMPDIR. +- runs the pre update command, if set +- runs partition handlers, if required. +- reads through the cpio archive one file at a time and either: + * execute handlers for each file marked as "installed-directly". + checksum is checked while the data is streamed to handler, and copy will + be marked as having failed if checksum was not correct failing the rest + of the install. + * copy other files to a temporary location while checking checksums, + stopping if there was a mismatch. +- iterates through all `scripts` and call the corresponding + handler for pre-install scripts. + Please note: if artifacts are streamed, they will be extracted + before this runs. If earlier execution is required, please use + the "embedded-script" or hooks features to ensure code is run + before installation takes place. - iterates through all `images` and call the corresponding handler for installing on target. - iterates through all `files` and call the corresponding @@ -372,7 +381,7 @@ A run of SWUpdate consists mainly of the following steps: - iterates through all `bootenv` and updates the bootloader environment. - reports the status to the operator through the notification interface (logging, traces) and through the progress interface. -- if a postinstall command is foreseen (for example to reboot the device), call it. +- runs the post update command, if set. The first step that fails, stops the entire procedure and an error is reported.