commit: d264d488bf1dcb52c562b37afdc11b9cc11a5b03
Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Sun May 5 05:19:47 2019 +0000
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Sun May 5 05:19:47 2019 +0000
URL: https://gitweb.gentoo.org/proj/qa-scripts.git/commit/?id=d264d488
keyrings: fix cleanup bug
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
keyrings.inc.bash | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/keyrings.inc.bash b/keyrings.inc.bash
index 2b5ad9a..a3879d5 100644
--- a/keyrings.inc.bash
+++ b/keyrings.inc.bash
@@ -69,8 +69,11 @@ clean_tmp() {
[ -n "$GPG_TMPDIR" ] && [ -d "$GPG_TMPDIR" ] && rm -rf "$GPG_TMPDIR"
}
setup_tmp() {
- GPG_TMPDIR=$(mktemp -d)
- trap clean_tmp EXIT
+ if [ -z "${GPG_TMPDIR}" ]; then
+ GPG_TMPDIR=$(mktemp -d)
+ export GPG_TMPDIR
+ trap clean_tmp EXIT
+ fi
}
export_keys() {
@@ -104,6 +107,8 @@ export_keys() {
mv -f "${TMP}" "${DST}"
mv -f "${TMP}.packets.txt" "${DST}.packets.txt"
fi
+ # Cleanup anyway
+ rm -f "${TMP}.packets.txt" "${TMP}"
}
# populate common variables