I have a list of rpm packages... and want to check if the version is equal to or greater than the package in the package list. This is what I have so far... but I would like to add more intelligence to it.
while read line
do
COUNT=`rpm -qa --qf "%{n}-%{v}-%{r} (%{arch})\n" | grep -c "$line"`
if [ $COUNT -ge 1 ]
then
logMessage "Step #7b - (PASS) $line = $COUNT."
else
logError "Step #7b - $line = $COUNT."
fi
done < rpm_pkgs.txt
rpm_pkgs looks like this:
binutils-2.15.92.0.2-25 (x86_64)
compat-libstdc++-33-3.2.3-47.3 (x86_64)
compat-libstdc++-33-3.2.3-47.3 (i386)
elfutils-libelf-0.97.1-5 (x86_64)
expat-1.95.7-4 (x86_64)
glibc-2.3.4-2.41 (x86_64)
glibc-2.3.4-2.41 (i686)
glibc-common-2.3.4-2.41 (x86_64)
libaio-0.3.105-2 (i386)
libgcc-3.4.6-10 (x86_64)
etc.
Can someone help with creating an awk statement to check to see if the version on the server is equal to or greater than the version in the rpm_pkgs.txt file?
Thanks!