summaryrefslogtreecommitdiffstats
path: root/cron-jobs
diff options
context:
space:
mode:
authorAaron Griffin <aaronmgriffin@gmail.com>2010-02-16 00:44:46 +0100
committerAaron Griffin <aaronmgriffin@gmail.com>2010-04-28 18:51:34 +0200
commite284d06d6cf63665cbadcb65e3a09bbd18027bd1 (patch)
tree19b18ccb8963b450d99d30d136a8f92937b98969 /cron-jobs
parentc7e3c501f01b6429519e2b8466d6bd8e2f7e22b9 (diff)
downloaddbscripts-e284d06d6cf63665cbadcb65e3a09bbd18027bd1.tar.gz
dbscripts-e284d06d6cf63665cbadcb65e3a09bbd18027bd1.tar.xz
Change ftpdir-cleanup scripts for package pooling
* The per repo script now simply removes files as they should all be symlinks at this time * The cron job script will do the extra job of checking the global pool. If there are no more symlinks, move the pooled package Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
Diffstat (limited to 'cron-jobs')
-rwxr-xr-xcron-jobs/ftpdir-cleanup35
1 files changed, 34 insertions, 1 deletions
diff --git a/cron-jobs/ftpdir-cleanup b/cron-jobs/ftpdir-cleanup
index d66138c..1ccc654 100755
--- a/cron-jobs/ftpdir-cleanup
+++ b/cron-jobs/ftpdir-cleanup
@@ -31,7 +31,40 @@ trap ctrl_c 2
/usr/bin/renice +10 -p $$ > /dev/null
for repo in $repos; do
- $(dirname $0)/../misc-scripts/ftpdir-cleanup $repo $CLEANUP_DESTDIR
+ $(dirname $0)/../misc-scripts/ftpdir-cleanup $repo
done
+to_cleanup=""
+for _arch in ${ARCHES[@]}; do
+ poolpath="$FTP_BASE/packages/os/$_arch/"
+ cd $poolpath
+ for pkg in *$PKGEXT; do
+ [ -f "$pkg" ] || continue # in case we get a file named "*.pkg.tar.gz"
+ LINKS="$(/bin/ls $FTP_BASE/*/os/$_arch/$pkg 2>/dev/null)"
+ if [ -n "$LINKS" ]; then
+ found=0
+ for lnk in $LINKS; do
+ if [ -h "$lnk" ]; then
+ found=1
+ break
+ fi
+ done
+ # No links found, clean it up
+ if [ $found -eq 0 ]; then
+ to_cleanup="$to_cleanup $poolpath/$pkg"
+ fi
+ fi
+ done
+done
+
+if [ -n "$to_cleanup" ]; then
+ echo " The following packages are no longer in any repo"
+ echo " They will be moved to $CLEANUP_DESTDIR"
+ for f in $to_cleanup; do
+ echo " $(basename "$f")"
+ done
+ echo ""
+ mv "$f" "$CLEANUP_DESTDIR"
+fi
+
cleanup