diff --git a/ci/release/template/scripts/lib.sh b/ci/release/template/scripts/lib.sh index a6e59fb27..fa7ad8bda 100644 --- a/ci/release/template/scripts/lib.sh +++ b/ci/release/template/scripts/lib.sh @@ -46,24 +46,13 @@ if [ "${LIB_TEMP-}" ]; then fi LIB_TEMP=1 -ensure_tmpdir() { - if [ -n "${_TMPDIR-}" ]; then - return - fi - +if [ -z "${_TMPDIR-}" ]; then _TMPDIR=$(mktemp -d) export _TMPDIR - trap temp_exittrap EXIT -} - -temp_exittrap() { - if [ -n "${_TMPDIR-}" ]; then - rm -r "$_TMPDIR" - fi -} + trap 'rm -Rf "$_TMPDIR"' EXIT +fi temppath() { - ensure_tmpdir while true; do temppath=$_TMPDIR/$(