All of lore.kernel.org
 help / color / mirror / Atom feed
From: Masahiro Yamada <masahiroy@kernel.org>
To: linux-kbuild@vger.kernel.org
Cc: Masahiro Yamada <masahiroy@kernel.org>, linux-kernel@vger.kernel.org
Subject: [PATCH v2 13/13] gen_initramfs.sh: remove intermediate cpio_list on errors
Date: Sun,  5 Jan 2020 00:02:38 +0900	[thread overview]
Message-ID: <20200104150238.19834-14-masahiroy@kernel.org> (raw)
In-Reply-To: <20200104150238.19834-1-masahiroy@kernel.org>

This script sets the -e option, so it exits on any error, in which
case it exits without cleaning up the intermediate cpio_list.

Make sure to delete it on exit.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

Changes in v2: None

 usr/gen_initramfs.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/usr/gen_initramfs.sh b/usr/gen_initramfs.sh
index 4e6715f8ff7f..8ae831657e5d 100755
--- a/usr/gen_initramfs.sh
+++ b/usr/gen_initramfs.sh
@@ -193,6 +193,8 @@ dep_list=
 cpio_list=$(mktemp ${TMPDIR:-/tmp}/cpiolist.XXXXXX)
 output="/dev/stdout"
 
+trap "rm -f $cpio_list" EXIT
+
 while [ $# -gt 0 ]; do
 	arg="$1"
 	shift
@@ -243,4 +245,3 @@ if test -n "$KBUILD_BUILD_TIMESTAMP"; then
 	fi
 fi
 usr/gen_init_cpio $timestamp $cpio_list > $output
-rm $cpio_list
-- 
2.17.1


  parent reply	other threads:[~2020-01-04 15:03 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-04 15:02 [PATCH v2 00/13] initramfs: a lot of cleanups Masahiro Yamada
2020-01-04 15:02 ` [PATCH v2 01/13] initramfs: replace klibcdirs in Makefile with FORCE Masahiro Yamada
2020-01-06  7:33   ` Greg Thelen
2020-01-06  7:33     ` Greg Thelen
2020-01-07 10:46   ` Masahiro Yamada
2020-01-07 17:13     ` hpa
2020-01-04 15:02 ` [PATCH v2 02/13] gen_initramfs_list.sh: remove unused variable 'default_list' Masahiro Yamada
2020-01-06  7:34   ` Greg Thelen
2020-01-06  7:34     ` Greg Thelen
2020-01-04 15:02 ` [PATCH v2 03/13] gen_initramfs_list.sh: fix the tool name in the comment Masahiro Yamada
2020-01-06  7:34   ` Greg Thelen
2020-01-06  7:34     ` Greg Thelen
2020-01-04 15:02 ` [PATCH v2 04/13] initramfs: rename gen_initramfs_list.sh to gen_initramfs.sh Masahiro Yamada
2020-01-06  7:43   ` Greg Thelen
2020-01-06  7:43     ` Greg Thelen
2020-01-06 10:26     ` Masahiro Yamada
2020-01-07  3:02       ` Ben Hutchings
2020-01-07  3:21       ` hpa
2020-01-04 15:02 ` [PATCH v2 05/13] initramfs: remove redundant dependency on BLK_DEV_INITRD Masahiro Yamada
2020-01-06  7:44   ` Greg Thelen
2020-01-06  7:44     ` Greg Thelen
2020-01-04 15:02 ` [PATCH v2 06/13] initramfs: make compression options not depend on INITRAMFS_SOURCE Masahiro Yamada
2020-01-04 15:02 ` [PATCH v2 07/13] initramfs: make initramfs compression choice non-optional Masahiro Yamada
2020-01-04 15:02 ` [PATCH v2 08/13] initramfs: specify $(src)/gen_initramfs.sh as a prerequisite in Makefile Masahiro Yamada
2020-01-06  7:51   ` Greg Thelen
2020-01-06  7:51     ` Greg Thelen
2020-01-04 15:02 ` [PATCH v2 09/13] initramfs: generate dependency list and cpio at the same time Masahiro Yamada
2020-01-04 15:02 ` [PATCH v2 10/13] initramfs: add default_cpio_list, and delete -d option support Masahiro Yamada
2020-01-04 15:02 ` [PATCH v2 11/13] gen_initramfs.sh: always output cpio even without -o option Masahiro Yamada
2020-01-04 15:02 ` [PATCH v2 12/13] initramfs: refactor the initramfs build rules Masahiro Yamada
2020-01-04 15:02 ` Masahiro Yamada [this message]
2020-01-21 15:59 ` [PATCH v2 00/13] initramfs: a lot of cleanups Masahiro Yamada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200104150238.19834-14-masahiroy@kernel.org \
    --to=masahiroy@kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.