From 0b7d231b5ed187b7dd6d057472ee0fc34e55fe7d Mon Sep 17 00:00:00 2001 From: Marco Pagani Date: Wed, 5 Jun 2024 12:32:33 +0200 Subject: mbuto: fix regression when output path is not specified Commit 12e3933 ("Remove unnecessary cpio_init function") removed the cpio_init() function since it was called only with the discard option. However, in doing so, it introduced a regression bug, causing mbuto to crash at line 1066 with the error "No such file or directory" if the initramfs output path is not specified. The error happens because cpio_init() was responsible for creating a temporary file if the output path was not specified. This patch restores the code to create a temporary image if the output path is not specified and adds it to the build() function. Fixes: 12e3933f762c ("Remove unnecessary cpio_init function") Signed-off-by: Marco Pagani Signed-off-by: Stefano Brivio --- mbuto | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mbuto b/mbuto index 247b63d..d138b8d 100755 --- a/mbuto +++ b/mbuto @@ -965,6 +965,11 @@ pkg_add() { # build() - Build a new image, sourcing contents build() { + if [ -z "${OUT}" ]; then + OUT="$("${MKTEMP}")" + notice "Creating image: ${OUT}" + fi + kmod_init for __d in ${DIRS}; do -- cgit v1.2.3