gen_initramfs.sh: remove intermediate cpio_list on errors
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>
diff --git a/usr/gen_initramfs.sh b/usr/gen_initramfs.sh
index 4e6715f..8ae8316 100755
--- a/usr/gen_initramfs.sh
+++ b/usr/gen_initramfs.sh
@@ -193,6 +193,8 @@
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 @@
fi
fi
usr/gen_init_cpio $timestamp $cpio_list > $output
-rm $cpio_list