diff options
Diffstat (limited to 'genpkglist')
-rwxr-xr-x | genpkglist | 36 |
1 files changed, 30 insertions, 6 deletions
@@ -1,5 +1,5 @@ #!/bin/bash -# $Id: genpkglist,v 1.12 2005/01/03 08:09:21 judd Exp $ +# $Id: genpkglist,v 1.13 2006/02/22 07:56:11 judd Exp $ # # genpkglist @@ -29,11 +29,35 @@ for category in `find * -maxdepth 0 -type d | grep -v CVS`; do cd .. done -DUPES=`ls -1 /home/ftp/$1/os/i686 | rev | cut -d- -f 3- | rev | sort | uniq -c | egrep -v '^ 1' | awk '{print $2}'` +cd /home/ftp/$1/os/i686 +unset DUPES DUPEFILES last +for pkg in *.pkg.tar.gz; do + pkgname=${pkg%-*-*} + if [ "$last" = "$pkgname" ]; then + DUPES="$DUPES $pkgname" + DUPEFILES="$DUPEFILES $pkg" + fi + last=$pkgname +done -if [ -n "$DUPES" ]; then - echo "Possible Dupes for $1 (please remove old versions)." - echo "Date Filename" - for dupe in $DUPES; do ls -l /home/ftp/$1/os/i686/${dupe}* | awk '{print $6" "$7" "$8" "$9}'; done +showdupes() { + done= + for i in *.pkg.tar.gz; do + pkgname=${i%-*-*} + if [ "$pkgname" = "$1" ]; then + ls -l $i | awk '{print $6" "$7" "$8" "$9}' + done=1 + else + [ "$done" = "1" ] && return + fi + done +} + +if [ "$DUPES" ]; then + echo "Possible Dupes for $1 (please remove old versions)" + echo "Date Filename" + for dupe in $((for d in `echo $DUPES`; do echo $d; done) | sort -u); do + showdupes $dupe + done fi |