Re: rpmdb crashed, how to repair? [FC3]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Gene Heskett wrote:

I should learn scripting instead of using ready-made scripts. Some day
maybe.

Jim

;-) I hear that, Jim. Me, at 71 I tend to furget, so I write scripts that don't forget. Yup, been there, done that. Several times... And a month later I may have forgotten the scripts name, and where I stashed it. I've heard that called CRS.


Gene,
I was able to get a script that will show you the version information and also it has the ability to not show rpms which it is normally allowed to show more than one instance. Steve Grub and Villa Herva had the most to do with this script. I did a bit of removal for the mismatched portion and added user feedback echoed test to terminal. I attached this as a text file, but it is actually a script.

A problem with the script that Ville described was the possibility that fookernel and kernelfoo packages would also be excluded as being alright. I checked and this is true. Ville suggested something like
egrep "^ +[0123456789]+ +($dups)$"
be added to the script to prevent the possibility from happening.

Jim

--
The person who can smile when something goes wrong has thought of
someone to blame it on.
#!/bin/sh

# Add any package here that is OK to have duplicates
dups="gpg-pubkey|kernel"
echo "Starting search for multiple rpms versions."
echo 

# Test 1. Look for multiple versions of the same package
# We use # as a separator so that we can remove it later. # is not in any
# package name that I know of and that's the basis of using it.
list=`rpm -qa --queryformat "%{NAME}#%{ARCH}\n" | sort | uniq -c |  tr '#' ' ' \
| egrep -vw "$dups" | awk '$1 > 1 { print $2 } '`

if [ x"$list" != "x" ] ; then
        echo "Duplicates were found:"
        echo $list | xargs rpm -q
        exit 1
else echo "No Duplicates found"
fi

	echo
  	echo "Ending Search for Multiple RPMS."
	exit 0
fi

exit 0

[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux