diff options
author | Judd Vinet <judd@archlinux.org> | 2006-02-22 08:56:11 +0100 |
---|---|---|
committer | Judd Vinet <judd@archlinux.org> | 2006-02-22 08:56:11 +0100 |
commit | 5128cca4a76c5133f3c98db79b9c66a7b55916c6 (patch) | |
tree | 18ec55c1773f6b39a70356f217cbfc0726eaa6ce | |
parent | a49feb74bba7a0dfe7f5a546fc4a188ded208c61 (diff) | |
download | dbscripts-5128cca4a76c5133f3c98db79b9c66a7b55916c6.tar.gz dbscripts-5128cca4a76c5133f3c98db79b9c66a7b55916c6.tar.xz |
fixed dupe package listings
-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 |