summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2014-06-18 14:21:50 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2014-06-18 14:21:50 -0400
commitbb6df9198b3dba28e378acf738b0770fb159a1c8 (patch)
treecc440a073bba4d877960b5acb511cd99c9eff27a
parent14dc8bc6bf985464c119910eeb22f65f534a57b0 (diff)
db-cleanup: obey TMPDIR
-rwxr-xr-xdb-cleanup7
1 files changed, 5 insertions, 2 deletions
diff --git a/db-cleanup b/db-cleanup
index 6ac9747..3b5ea13 100755
--- a/db-cleanup
+++ b/db-cleanup
@@ -28,6 +28,9 @@ trap 'trap_exit "$(gettext "An unknown error has occurred. Exiting...")"' ERR
EXTRAFLAGS=()
"${CLEANUP_DRYRUN}" && EXTRAFLAGS+=(--dry-run)
+filter=$(mktemp -t "${0##*/}.XXXXXXXXXX")
+trap "rm -f -- $(printf %q "$filter")" EXIT
+
for _repo in "${PKGREPOS[@]}"; do
for _arch in "${ARCHES[@]}"; do
msg "Getting %s-%s database" "${_repo}" "${_arch}"
@@ -43,7 +46,7 @@ for _repo in "${PKGREPOS[@]}"; do
bsdtar tf "${dbfile}" | \
cut -d'/' -f1 | \
sort -u | \
- sed "s|$|*|" >> "/tmp/${0##*/}.$$.filter"
+ sed "s|$|*|" >> "$filter"
done
done
@@ -54,7 +57,7 @@ for POOL in "${PKGPOOLS[@]}" "${SRCPOOLS[@]}"; do
msg2 '%s' "${POOL}"
rsync "${EXTRAFLAGS[@]}" -va --delete-excluded \
- --include-from="/tmp/${0##*/}.$$.filter" \
+ --include-from="$filter" \
--exclude="*" \
"${FTP_BASE}/${POOL}/" \
"${FTP_BASE}/${POOL}/"