script/setup/install-runc: Add trap statement to clean up tmp files

This PR adds the trap statement in the install runc script to clean
up the temporary files and ensure we are not leaving them.

Signed-off-by: Gabriela Cervantes <gabriela.cervantes.tellez@intel.com>
This commit is contained in:
Gabriela Cervantes 2024-10-02 18:53:12 +00:00
parent 01ca26f209
commit 24fe444eb6

View File

@ -34,13 +34,13 @@ function install_runc() {
: "${RUNC_REPO:=https://github.com/opencontainers/runc.git}" : "${RUNC_REPO:=https://github.com/opencontainers/runc.git}"
TMPROOT=$(mktemp -d) TMPROOT=$(mktemp -d)
trap "rm -fR ${TMPROOT}" EXIT
git clone "${RUNC_REPO}" "${TMPROOT}"/runc git clone "${RUNC_REPO}" "${TMPROOT}"/runc
pushd "${TMPROOT}"/runc pushd "${TMPROOT}"/runc
git checkout "${RUNC_VERSION}" git checkout "${RUNC_VERSION}"
env -u VERSION make BUILDTAGS='seccomp' runc env -u VERSION make BUILDTAGS='seccomp' runc
$SUDO make install $SUDO make install
popd popd
rm -fR "${TMPROOT}"
} }
function install_crun() { function install_crun() {