awk to check for rpm packages


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting awk to check for rpm packages
# 1  
Old 05-03-2011
awk to check for rpm packages

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.
Code:
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:
Code:
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!

Last edited by Franklin52; 05-03-2011 at 01:12 PM.. Reason: Please use code tags
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Fedora

Looking for RPM packages

Hi all, Trying to get the following packages for an ARM 71 device running an image of Fedora 18. I need these system livraries for compilation. gtk2-devel-2.22.0-2.fc14.i686.rpm proj-devel-4.7.0-3.fc14.i686.rpm proj-4.7.0-3.fc14.i686.rpm Anyone know where I could find them? Thanks in... (3 Replies)
Discussion started by: fedora18
3 Replies

2. Programming

RPM packages

Hi all, I have also posted in the UNIX for Dummies forum. Wasn't sure which would be best. Trying to get the following packages for an ARM 71 device running an image of Fedora 18. I need these system livraries for compilation. gtk2-devel-2.22.0-2.fc14.i686.rpm... (0 Replies)
Discussion started by: fedora18
0 Replies

3. Red Hat

Unable to add packages through rpm

I was trying to install some packages. We already installed all the dependent packages. But i was unable to install any of the packages..... What might be the reason ?? Please tell me !!! (1 Reply)
Discussion started by: vamshigvk475
1 Replies

4. Red Hat

How to check HDD Rpm?

Hello Can you help how can I check Hard Drive rpm. Thank you Jaydul (4 Replies)
Discussion started by: jaydul
4 Replies

5. Red Hat

Installing rpm packages

Hi guys, I am trying to install some packages for my oracle 11g r2 installation, the below error shows up when I try below: warning: glibc-devel-2.5-24.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186 error: Failed dependencies: glibc-headers is needed by... (8 Replies)
Discussion started by: messi777
8 Replies

6. Shell Programming and Scripting

How to make RPM not write to RPM database if RPM fails to deploy?

How to make RPM not write to RPM database if RPM fails to deploy? IE I create an rpm spec file that contains the following if then exit 1 fi My rpm will fail at deployment, but if I do rpm -qa , I can see the rpm in the rpm db (3 Replies)
Discussion started by: 3junior
3 Replies

7. Red Hat

Signing RPM packages using GPG

I am having difficulty getting rpm to trust the gpg key I have used to sign rpm packages I am creating. I used gpg --gen-key to create the key. I chose RSA, 1024. $ gpg --list-key /home/rpmbuild/.gnupg/pubring.gpg --------------------------------- pub 1024R/42A05359 2009-07-15 uid ... (2 Replies)
Discussion started by: Padow
2 Replies

8. Linux

where to edit yum or rpm packages to update

I am setting up a new server with the goal of porting a solaris server to centos. I want to compile some packages myself (ie) http, ssl, mysql, etc. The reason for this is the downloadable rpm packages are very old. I probably want to make sure the kernel is up to date, but the individual pages... (2 Replies)
Discussion started by: csross
2 Replies

9. Shell Programming and Scripting

Check if rpm is installed

Hi all im hoping someone can help, i want to check if a rpm package is installed, if it is then display one text if not then another text, below is what i have got so far, im am very much a noob at this, as you can probably can see so if possible make it simple, and a big thankyou if you can help... (3 Replies)
Discussion started by: dave123
3 Replies

10. Linux

Failed dependencies of rpm / how does RPM check for ?

Hey, I've a problem installing a package. rpm -ivh brings the errors: libjvm.so is needed by libverify.so is needed by But I have installed the Java SDK like requested and the files are on the disk. But I have no idea how to find out, why rpm cann't find them. I have also... (2 Replies)
Discussion started by: mod
2 Replies
Login or Register to Ask a Question