summaryrefslogtreecommitdiff
path: root/db-cleanup
diff options
context:
space:
mode:
Diffstat (limited to 'db-cleanup')
-rwxr-xr-xdb-cleanup11
1 files changed, 7 insertions, 4 deletions
diff --git a/db-cleanup b/db-cleanup
index 2051130..67fb051 100755
--- a/db-cleanup
+++ b/db-cleanup
@@ -28,9 +28,12 @@ trap 'trap_exit "$(gettext "An unknown error has occurred. Exiting...")"' ERR
EXTRAFLAGS=()
"${CLEANUP_DRYRUN}" && EXTRAFLAGS+=(--dry-run)
+filter=$(mktemp -t "${0##*/}.XXXXXXXXXX")
+trap "rm $(printf %q "$filter")" EXIT
+
for _repo in "${PKGREPOS[@]}"; do
for _arch in "${ARCHES[@]}"; do
- msg "Getting ${_repo}-${_arch} database"
+ msg "Getting %s database" "${_repo}-${_arch}"
dbfile="${FTP_BASE}/${_repo}/os/${_arch}/${_repo}${DBEXT}"
@@ -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 "${POOL}"
rsync "${EXTRAFLAGS[@]}" -va --delete-excluded \
- --include-from="/tmp/${0##*/}.$$.filter" \
+ --include-from="$filter" \
--exclude="*" \
"${FTP_BASE}/${POOL}/" \
"${FTP_BASE}/${POOL}/"
@@ -63,4 +66,4 @@ done
msg "Removing dead symlinks:"
actions=(-print)
"${CLEANUP_DRYRUN}" || actions+=(-delete)
-find -L "${FTP_BASE}/" -type l -print -delete
+find -L "${FTP_BASE}/" -type l "${actions[@]}"