#! /bin/bash

# Copyright 2004, 2007  Alexandre Oliva  <aoliva@redhat.com>
# version pi

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.

# This script checks for multiply-installed packages in the RPM
# database and reinstalls them.  Exceptions are gpg-pubkey and kernel,
# that are always excluded from the list.  egrep regular expressions
# can be passed in the command line and will exclude further packages.
# The expressions must match the full package name for a package to be
# excluded.  For example:

#  root# .../rpmdup-install mypkg mypkg-devel mypkg-plugin-.\*

# This will NOT exclude mypkg-extras.

. $0.list

echo checking for rpms already in /var/spool/up2date...
ls /var/spool/up2date/*.rpm

up2date --get $duplist
for f in $duplist; do
  rpm -Uv --replacepkgs /var/spool/up2date/$f
  echo keeping /var/spool/up2date/$f
done
