mirror of
https://github.com/kata-containers/kata-containers.git
synced 2026-07-27 09:02:26 +00:00
build(qemu): use mktemp -d and trap for safe clone directory
Replace rm -rf qemu + clone-into-relative-path with mktemp -d so the build never touches a pre-existing qemu/ directory in the bind-mounted host working directory. The trap ensures cleanup on any exit path. Assisted-by: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Zvonko Kaiser <zkaiser@nvidia.com>
This commit is contained in:
@@ -26,11 +26,10 @@ HYPERVISOR_NAME="${HYPERVISOR_NAME:-}"
|
||||
PREFIX="${PREFIX:-}"
|
||||
PKGVERSION=${PKGVERSION:-}
|
||||
|
||||
# This script always runs inside a dedicated build container (see
|
||||
# static-build/qemu/Dockerfile), so rm -rf of a relative path is safe.
|
||||
rm -rf qemu
|
||||
git clone --depth=1 "${QEMU_REPO}" qemu
|
||||
pushd qemu
|
||||
workdir="$(mktemp -d)"
|
||||
trap 'rm -rf "${workdir}"' EXIT
|
||||
git clone --depth=1 "${QEMU_REPO}" "${workdir}/qemu"
|
||||
pushd "${workdir}/qemu"
|
||||
git fetch --depth=1 origin "${QEMU_VERSION_NUM}"
|
||||
git checkout FETCH_HEAD
|
||||
scripts/git-submodule.sh update meson capstone
|
||||
|
||||
Reference in New Issue
Block a user