Message ID | 20210305053935.1786812-4-dominique.martinet@atmark-techno.com |
---|---|
State | Changes Requested |
Headers | show
Return-Path: <swupdate+bncBCWIVBV7SUGRBLUIQ6BAMGQE5JK6DAQ@googlegroups.com> 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::73b; helo=mail-qk1-x73b.google.com; envelope-from=swupdate+bncbcwivbv7sugrbluiq6bamgqe5jk6daq@googlegroups.com; receiver=<UNKNOWN>) 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=jpeTT0pT; dkim-atps=neutral Received: from mail-qk1-x73b.google.com (mail-qk1-x73b.google.com [IPv6:2607:f8b0:4864:20::73b]) (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 4DsGlj03Sgz9sVt for <incoming@patchwork.ozlabs.org>; Fri, 5 Mar 2021 16:40:00 +1100 (AEDT) Received: by mail-qk1-x73b.google.com with SMTP id o8sf834400qkl.3 for <incoming@patchwork.ozlabs.org>; Thu, 04 Mar 2021 21:40:00 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1614922798; cv=pass; d=google.com; s=arc-20160816; b=j76oGPCXYiata+PyE3b0oElONAEWvkJG/MtE65MDdAck4dGtFso/SNI+ZRF1o4OLi9 5vg8YZVEEFFZOs8nNKA16i4VVXTmbIRgisuVcKQY+TQHUYuzDhmbVRN/C1XhPMfT6Q6I mbKJVNQgR0ZcB2JxYQjH9Cpfo1aK9zDD8SV1g3A1gK1/18BZciyfJXeergALSTri39oY RM0gJE070yFOAx/30121w4wkiue55bkkSUR48JeSXiJJ2uHkY+SlpsPgIzl4AURIpu24 R6zsLYIkTjZE7PfLadE0mPFrnQMlaRsFU0KJfC/QyoV9Qk6M+qFC3L3PXTWe1Rw6bTvp FFXw== 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:references:in-reply-to :message-id:date:subject:cc:to:from:sender:dkim-signature; bh=qyFFIsqGgI5xeRMWve41wn1qtMysjP2oDcxc2sTU6jE=; b=ulSWQcnM6VfRyu/9Pz4OYt1WJNp8EDwsc4jAdtFdxOplz9xNDLkjN02xbBUiV4FdWV GS1kUM+otWSoUfcGFAqnfGgKKgUbwOe0ylWHIdVL4peaakIXsyS8qnqivrbMTQyiu2t7 Y6JfYX56rDf1MrcHQhz4/87yQg0pFbK/24l0yUAZNQ/7rog1SS4/OHVhSD3AjGe4MPRe hLwcSAIpiVlTSydLBaoVmJqbbbD5cNpZteg35q1LUg4RjDO4hQxEadC55XeXY/sJxOPj cCQHGbf78awtg0KFqxnkz378KVdC6fh1lIJVFSyF+FPOL5C2ITMCxzAyOlAV8eJ96LZK LEGg== 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:in-reply-to:references :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=qyFFIsqGgI5xeRMWve41wn1qtMysjP2oDcxc2sTU6jE=; b=jpeTT0pTXiKfvJpztr3K8dlNIdPLvSESKzHVvNliNtdPxvSzHea1SJBh0odOGWMNm0 yhnydzVif0pRjwr5pX/kCrw/M8XBhSDUV5hWejw57nKCJJN56fm250CHM+5QFOXuE5GD mUVHlnVqL2KjpF28GikrU+WJlhYRqGW3uxKTXpf37Jin7WgARdD/Sbx59//ZPTlD7LJ0 uW7yAbFyBM2Hx5s26ZyoindFt2SmYaFL1oelRI+DFsFRyaYBbCUisf9fPsCpitswRfV4 otjOYRYvbIcMJTGn67/wSpfei/bmL48Pgb8Z193xzTUqV9l6ZdAY24KmN/vGjpW540qN KpoQ== 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 :in-reply-to:references: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=qyFFIsqGgI5xeRMWve41wn1qtMysjP2oDcxc2sTU6jE=; b=B2P6muKW7uqm668I8iqe8kEq3ZsG8d6YIJqYInzb0m2LrK8Q31zSWYpvUwZ4j2E0Fc pJiVuj5DiKnE5n8KxTtk0VzvaktL5tJf6uZF9n2XMMao0t4LHzX+gU0aVgyzEFDdqNSJ rGXRxlEjEdvQJBTScT6+XxSKabiRvj/gk/KdbVQcoGWpm11VVqxncyqzXjZJd07PfiT9 tpI4S6IJ4pXytJvpSEpikJCkuaDUyadDqCwDzY5FYY8paRMOZdcliF4Ut+hw7T2IaKb5 n3j0BspPV32bcroHu+DDZldUzZw7CeQGcBe5bMR+/VhG1XKzw51+9aQNQuf/BFiQ1Y+2 ek1g== Sender: swupdate@googlegroups.com X-Gm-Message-State: AOAM531Yc3LomTT9PKOecCpHt/I9XwjkhHGY+oOm4sKxVD1EokBzQdSh +8FzXTlGCBYcv7WY+d/kYcY= X-Google-Smtp-Source: ABdhPJw0gjgO01GoCPavEmrZ5Ac68i9bawQtuPtc9WuPLXtp/TvqSuvybUXvavZ/xk4AiWZ889Fa7g== X-Received: by 2002:ac8:60d:: with SMTP id d13mr7710685qth.142.1614922798546; Thu, 04 Mar 2021 21:39:58 -0800 (PST) X-BeenThere: swupdate@googlegroups.com Received: by 2002:ac8:6d0e:: with SMTP id o14ls3152351qtt.4.gmail; Thu, 04 Mar 2021 21:39:58 -0800 (PST) X-Received: by 2002:ac8:76c5:: with SMTP id q5mr6103533qtr.376.1614922798227; Thu, 04 Mar 2021 21:39:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614922798; cv=none; d=google.com; s=arc-20160816; b=UThm3TRUFzIOyXkCaAoWVEjrWjqBQ7MnWtasEFcyTepw3NnKsPWQr0ea61qe4fgtgC dJwemChYIjfdVdZKeQq5TQsOBHVB8uo4Vi9jnES+qnRcLEmg65fClFxGahsE7wDRjXXI LQeHW5hSs/K4MywgJX3ujWT8wsByf7F/WvR7x/uZVjHG9uWDKm+nafhNK9A0TC4jDx1G uJlpyGdEyvDbLgr2yTQGrxxyMEpxaSMJJ6+2y3MAM5I+h+coYD/FhSF6St/eU7kWREtQ gWJG8bPaTjH3zcqbNE1l4Mnsbw4tmDo5JlxqiXBFXANVK9wD58jExLB7gEU0qpCFhY4j Nx7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=qYF6zk/mGoxS/EynPQE0s1I+hEoXieAX84Z2bgRhORk=; b=ACU1cD3ZRUpiaL9b+b7REeVYzCvEv72Ji8U4W+FhN5LFN94eqzy4LkakGMn+8T73Pg cNH+0aQ8UTS6g9IJ/+T37fNNLkQyPHUPtCdyY5HrNVj0Z2spfyKb6LpNZD7kgxki/bm0 GDz7WC05XKXMf2KQFwOc0L2SfhhWf50UbpCBdaaB/5g2TnVso3tfyqZXSiyEf2LxRrSg rRdalGl6txaUtOdP65QLliAIK8KoN8Uj/SxfF7JF33SIlfe0zNFbwaSEg/elxW88092J SN3yt4n1I+EDgqe1WvfgLAr0DbLQIJCXE1sjKvlLy/CFAN53xkKuQ+yAIgbZmb6WDBqQ Fk7w== 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 e18si134027qkn.6.2021.03.04.21.39.57 for <swupdate@googlegroups.com>; Thu, 04 Mar 2021 21:39:58 -0800 (PST) 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 A4BFE80069 for <swupdate@googlegroups.com>; Fri, 5 Mar 2021 14:39:56 +0900 (JST) Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) by gw.atmark-techno.com (Postfix) with ESMTPS id 63E7D80069 for <swupdate@googlegroups.com>; Fri, 5 Mar 2021 14:39:56 +0900 (JST) Received: by mail-pl1-f200.google.com with SMTP id l19so816407plc.14 for <swupdate@googlegroups.com>; Thu, 04 Mar 2021 21:39:56 -0800 (PST) X-Received: by 2002:a63:1906:: with SMTP id z6mr7087220pgl.292.1614922795209; Thu, 04 Mar 2021 21:39:55 -0800 (PST) X-Received: by 2002:a63:1906:: with SMTP id z6mr7087211pgl.292.1614922794989; Thu, 04 Mar 2021 21:39:54 -0800 (PST) Received: from pc-0115 (162.198.187.35.bc.googleusercontent.com. [35.187.198.162]) by smtp.gmail.com with ESMTPSA id 134sm1071497pfc.113.2021.03.04.21.39.54 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Mar 2021 21:39:54 -0800 (PST) Received: from martinet by pc-0115 with local (Exim 4.94) (envelope-from <martinet@pc-0115>) id 1lI3Bp-007Uth-72; Fri, 05 Mar 2021 14:39:53 +0900 From: Dominique Martinet <dominique.martinet@atmark-techno.com> To: swupdate@googlegroups.com Cc: Dominique Martinet <dominique.martinet@atmark-techno.com> Subject: [swupdate] [PATCH 3/3] handlers: pipe_handlers: add fail-cmd Date: Fri, 5 Mar 2021 14:39:35 +0900 Message-Id: <20210305053935.1786812-4-dominique.martinet@atmark-techno.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210305053935.1786812-1-dominique.martinet@atmark-techno.com> References: <20210305053935.1786812-1-dominique.martinet@atmark-techno.com> 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 Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: <swupdate.googlegroups.com> X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: <https://groups.google.com/group/swupdate/post>, <mailto:swupdate@googlegroups.com> List-Help: <https://groups.google.com/support/>, <mailto:swupdate+help@googlegroups.com> List-Archive: <https://groups.google.com/group/swupdate List-Subscribe: <https://groups.google.com/group/swupdate/subscribe>, <mailto:swupdate+subscribe@googlegroups.com> List-Unsubscribe: <mailto:googlegroups-manage+605343134186+unsubscribe@googlegroups.com>, <https://groups.google.com/group/swupdate/subscribe> |
Series |
add pipe handler
|
expand
|
diff --git a/doc/source/handlers.rst b/doc/source/handlers.rst index 764e0d0d09a2..3f5e6e229217 100644 --- a/doc/source/handlers.rst +++ b/doc/source/handlers.rst @@ -868,6 +868,10 @@ is piped to the command which runs until the end, so if the checksum fails the harm has still been done and it is not recommended to modify data in place that way. +If the "fail-cmd" property has been set, that command will be run if any error +has been encountered (checksum error, error downloading or writing the file, +or command returning a non-zero status code) + :: diff --git a/handlers/pipe_handler.c b/handlers/pipe_handler.c index 5c6365614b5c..6a945c94f943 100644 --- a/handlers/pipe_handler.c +++ b/handlers/pipe_handler.c @@ -12,6 +12,7 @@ #include "swupdate.h" #include "handler.h" #include "util.h" +#include "pctl.h" struct pipe_priv { pid_t pid; @@ -215,6 +216,14 @@ static int pipe_image(struct img_type *img, if (priv.stderr_index) ERROR("%s", priv.stderr_buf); + /* run fail command if errored and set */ + if (ret) { + cmd = dict_get_value(&img->properties, "fail-cmd"); + if (cmd) { + run_system_cmd(cmd); + } + } + TRACE("finished piping image"); return ret; }
Add a mechanism to run yet another command if the copy failed. This allows cleanup on error or if the checksum was invalid Signed-off-by: Dominique Martinet <dominique.martinet@atmark-techno.com> --- doc/source/handlers.rst | 4 ++++ handlers/pipe_handler.c | 9 +++++++++ 2 files changed, 13 insertions(+)