#!/bin/bash currentrepo=$1 echo $currentrepo if [ x$currentrepo = "x" ] then echo "./repo_cleanup.sh $repo [core,core-testing,extra,extra-testing]" exit 1 fi REPO=/data/pkg_repo/x86_64/$currentrepo pacman -Sl $repo |cut -d" " -f 2- |tr " " - > /tmp/$currentrepo-list cd $REPO >/dev/null ls *-x86_64.pkg.tar.xz|sed -e "s/-x86_64.pkg.*$//" > /tmp/pkglist-$currentrepo cd - > /dev/null if [ ! -e /tmp/$currentrepo_dups ] then mkdir /tmp/$currentrepo_dups/ fi echo $REPO while read LINE do # echo $LINE grep -q $LINE /tmp/$currentrepo-list if [ $? = 1 ] then echo "removing file $LINE" # mv $REPO/$LINE-x86_64.pkg.tar.xz /tmp/$currentrepo_dups/ fi done < /tmp/pkglist-$currentrepo