This is never ever called for multiple packages at once, and if it was,
it would be named clean_pkgs. Meanwhile, it was implied that this could
take a variable target, but that was never-used code. Make it useful
because we might (will) use it.

Signed-off-by: Eli Schwartz <eschwa...@archlinux.org>
---
 cron-jobs/ftpdir-cleanup | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/cron-jobs/ftpdir-cleanup b/cron-jobs/ftpdir-cleanup
index 9df5f99a..74b771cd 100755
--- a/cron-jobs/ftpdir-cleanup
+++ b/cron-jobs/ftpdir-cleanup
@@ -4,21 +4,19 @@
 . "$(dirname "$(readlink -e "$0")")/../db-functions"
 
 clean_pkg() {
-       local pkg
-       local target
+       local pkg=${1}
+       local targetdir=${2:-${CLEANUP_DESTDIR}}
 
        if [[ $CLEANUP_DRYRUN != true ]]; then
-               for pkg in "$@"; do
-                       if [[ -h $pkg ]]; then
-                               rm -f "$pkg" "$pkg.sig"
-                       else
-                               mv_acl "$pkg" "$CLEANUP_DESTDIR/${pkg##*/}"
-                               if [[ -e $pkg.sig ]]; then
-                                       mv_acl "$pkg.sig" 
"$CLEANUP_DESTDIR/${pkg##*/}.sig"
-                               fi
-                               touch "${CLEANUP_DESTDIR}/${pkg##*/}"
+               if [[ -h ${pkg} ]]; then
+                       rm -f "${pkg}" "${pkg}.sig"
+               else
+                       mv_acl "${pkg}" "${targetdir}/${pkg##*/}"
+                       if [[ -e ${pkg}.sig ]]; then
+                               mv_acl "${pkg}.sig" 
"${targetdir}/${pkg##*/}.sig"
                        fi
-               done
+                       touch "${targetdir}/${pkg##*/}"
+               fi
        fi
 }
 
-- 
2.19.2

Reply via email to