image_builder: Force mount_dir to be created in $TMPDIR

Immutable systems, as such Red Hat Core OS and Fedora Core OS, will not
allow mount_dir to be created in a location that's not read-write.

Let's ensure we use $TMPDIR (with /tmp as fallback) as base for mount_dir,
as it's a safe writable choice for any distro supported by kata.

Fixes: #437

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
This commit is contained in:
Fabiano Fidêncio 2020-03-23 17:08:28 +01:00
parent 4f49b160c0
commit 9665563145

View File

@ -374,7 +374,7 @@ create_rootfs_image() {
fi
info "Mounting root partition"
readonly mount_dir=$(mktemp -d osbuilder-mount-dir.XXXX)
readonly mount_dir=$(mktemp -p ${TMPDIR:-/tmp} -d osbuilder-mount-dir.XXXX)
mount "${device}p1" "${mount_dir}"
OK "root partition mounted"