Merge pull request #6916 from edolstra/tmp-slash

Installer: Don't assume TMPDIR ends in a slash
This commit is contained in:
Eelco Dolstra 2022-08-22 12:47:33 +02:00 committed by GitHub
commit 33aca20616
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -348,8 +348,12 @@ _sudo() {
fi
}
# Ensure that $TMPDIR exists if defined.
if [[ -n "${TMPDIR:-}" ]] && [[ ! -d "${TMPDIR:-}" ]]; then
mkdir -m 0700 -p "${TMPDIR:-}"
fi
readonly SCRATCH=$(mktemp -d "${TMPDIR:-/tmp/}tmp.XXXXXXXXXX")
readonly SCRATCH=$(mktemp -d)
finish_cleanup() {
rm -rf "$SCRATCH"
}