
http://urpmi.org/easyurpmi/index.php
I'm trying to figure out how to do this with local sources taken into consideration, too:
CODE
#!/bin/bash
# rpmfix - searches your system for missing files and reinstalls rpms they belong to
# Copyright (C) 2003 Steve Scrimpshire
# email: omarserenity@gmail.com
# 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 2
# of the License, or (at your option) any later version.
# http://www.gnu.org/copyleft/gpl.html#SEC1
# 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, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
rm -f notonmirrors
rm -f missing_files.list
rpm -Va --nodeps --nomd5 --noscripts | grep missing | grep -v "/dev/" | tee missing_files.list
TEST=$(rpm -qf $(awk '{print $NF}' missing_files.list) | uniq)
urpmi.update -a
for name in $TEST
do
echo $name
GET=$(urpmq --sources $name 2>/dev/null)
if [ $GET ]
then
if [[ $name != XFree* ]]
then
wget $GET
else
echo "I won't fix $name because I always have problems doing that!"
fi
else
echo "$name does not exist on the mirrors!"
echo "$name" >> notonmirrors
fi
done
DIR=$(ls)
for file in $DIR
do
if [[ $file == *.rpm ]]
then
rpm -ivh --replacefiles --replacepkgs $file
rm -f $file
fi
done
exit 0
# rpmfix - searches your system for missing files and reinstalls rpms they belong to
# Copyright (C) 2003 Steve Scrimpshire
# email: omarserenity@gmail.com
# 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 2
# of the License, or (at your option) any later version.
# http://www.gnu.org/copyleft/gpl.html#SEC1
# 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, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
rm -f notonmirrors
rm -f missing_files.list
rpm -Va --nodeps --nomd5 --noscripts | grep missing | grep -v "/dev/" | tee missing_files.list
TEST=$(rpm -qf $(awk '{print $NF}' missing_files.list) | uniq)
urpmi.update -a
for name in $TEST
do
echo $name
GET=$(urpmq --sources $name 2>/dev/null)
if [ $GET ]
then
if [[ $name != XFree* ]]
then
wget $GET
else
echo "I won't fix $name because I always have problems doing that!"
fi
else
echo "$name does not exist on the mirrors!"
echo "$name" >> notonmirrors
fi
done
DIR=$(ls)
for file in $DIR
do
if [[ $file == *.rpm ]]
then
rpm -ivh --replacefiles --replacepkgs $file
rm -f $file
fi
done
exit 0
I created a special directory to put this script in and after it runs, you may or may not see a new file in that directory called notonmirrors, which will contain the names of pkgs that have missing files, but urpmq could not find them on the mirrors, so you will have to fix them manually. I have it ignore XFree pkgs, because there is always some files for fonts that are missing and no matter how many times you reinstall it, they are still missing.
