Skip to content

Commit

Permalink
ftpdir-cleanup: remove arch-independent packages
Browse files Browse the repository at this point in the history
Removes architecture independent packages which are
not symlinked in any of the architecture repositories.
  • Loading branch information
Abhishek Dasgupta committed Mar 20, 2009
1 parent 67e1129 commit 0959e89
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion misc-scripts/ftpdir-cleanup
Expand Up @@ -10,6 +10,7 @@ arch=$2

##### Arch specific stuff. TODO make this configurable #####
ftppath="/srv/ftp/$reponame/os/$arch/"
ftppath_base="/srv/ftp/$reponame/os"
############################################################

if [ ! -d "$ftppath" ]; then
Expand Down Expand Up @@ -78,11 +79,18 @@ for pkg in *$PKGEXT; do
EXTRAFILES="$EXTRAFILES $pkg"
done

cd "$ftppath_base/any"
for pkg in *$PKGEXT; do
if [ ! -h $ftppath_base/i686/$pkg && ! -h $ftppath_base/x86_64/$pkg ]; then
ARCHINDEPFILES="$ARCHINDEPFILES $pkg"
fi
done

cd "$ftppath"
rm -rf ${TMPDIR}

#Make sure we've done *something* before outputting anything
if [ -z "$DELETEFILES$MISSINGFILES$EXTRAFILES" ]; then
if [ -z "$DELETEFILES$MISSINGFILES$EXTRAFILES$ARCHINDEPFILES" ]; then
exit 0
fi

Expand Down Expand Up @@ -113,6 +121,15 @@ if [ -n "$EXTRAFILES" ]; then
done
fi

if [ -n "$ARCHINDEPFILES" ]; then
echo " The following architecture independent packages"
echo " are not symlinked in the architecture repositories."
echo " They will be moved to /srv/package/cleanup"
for f in $ARCHINDEPFILES; do
echo " $f"
done
fi

if [ -n "${DELETEFILES}" ]; then
mv ${DELETEFILES} /srv/package-cleanup/
echo ""
Expand All @@ -122,3 +139,10 @@ if [ -n "${EXTRAFILES}" ]; then
mv ${EXTRAFILES} /srv/package-cleanup/
echo ""
fi

cd "$ftppath_base/any"
if [ -n "${ARCHINDEPFILES}" ]; then
mv ${ARCHINDEPFILES} /srv/package-cleanup/
echo ""
fi

0 comments on commit 0959e89

Please sign in to comment.