aboutgitcode
diff options
context:
space:
mode:
authorMarco Pagani <marpagan@redhat.com>2024-06-05 12:32:33 +0200
committerStefano Brivio <sbrivio@redhat.com>2024-06-05 13:14:44 +0200
commit0b7d231b5ed187b7dd6d057472ee0fc34e55fe7d (patch)
tree03f62cbd67a69660b1d393e7debedcb70f3ef003
parent12e3933f762c8a950643b7823eb3d23c96a00ad4 (diff)
downloadmbuto-0b7d231b5ed187b7dd6d057472ee0fc34e55fe7d.tar
mbuto-0b7d231b5ed187b7dd6d057472ee0fc34e55fe7d.tar.gz
mbuto-0b7d231b5ed187b7dd6d057472ee0fc34e55fe7d.tar.bz2
mbuto-0b7d231b5ed187b7dd6d057472ee0fc34e55fe7d.tar.lz
mbuto-0b7d231b5ed187b7dd6d057472ee0fc34e55fe7d.tar.xz
mbuto-0b7d231b5ed187b7dd6d057472ee0fc34e55fe7d.tar.zst
mbuto-0b7d231b5ed187b7dd6d057472ee0fc34e55fe7d.zip
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 <marpagan@redhat.com> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rwxr-xr-xmbuto5
1 files changed, 5 insertions, 0 deletions
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