From 9b270d72d14bd840738e4490d0f5f633e90fda47 Mon Sep 17 00:00:00 2001 From: Wainer dos Santos Moschetta Date: Fri, 29 Oct 2021 13:00:03 -0300 Subject: [PATCH] ci/install_libseccomp: use a temporary work directory It is safer to download the tarballs and work on a temporary directory which can be proper cleaned up when the script finishes. Signed-off-by: Wainer dos Santos Moschetta --- ci/install_libseccomp.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ci/install_libseccomp.sh b/ci/install_libseccomp.sh index be75ed6689..c8f802ebd1 100755 --- a/ci/install_libseccomp.sh +++ b/ci/install_libseccomp.sh @@ -20,6 +20,7 @@ source "${tests_repo_dir}/.ci/lib.sh" unset PREFIX DESTDIR arch=$(uname -m) +workdir="$(mktemp -d --tmpdir build-libseccomp.XXXXX)" # Variables for libseccomp # Currently, specify the libseccomp version directly without using `versions.yaml` @@ -58,7 +59,7 @@ die() { } finish() { - rm -rf "${libseccomp_tarball}" "libseccomp-${libseccomp_version}" "${gperf_tarball}" "gperf-${gperf_version}" + rm -rf "${workdir}" } trap finish EXIT @@ -98,9 +99,11 @@ main() { die "Usage: ${0} " fi + pushd "$workdir" # gperf is required for building the libseccomp. build_and_install_gperf build_and_install_libseccomp + popd } main "$@"