Sponsored Content
Top Forums Shell Programming and Scripting awk to check for rpm packages Post 302519246 by linux4life on Tuesday 3rd of May 2011 12:01:14 PM
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
 

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
SETARCH(8)						     Linux Programmer's Manual							SETARCH(8)

NAME
setarch - change reported architecture in new program environment and set personality flags SYNOPSIS
setarch arch [options] [program [arguments]] arch [options] [program [arguments]] DESCRIPTION
setarch This utility currently only affects the output of uname -m. For example, on an AMD64 system, running 'setarch i386 program' will cause 'program' to see i686 (or other relevant arch) instead of x86_64 as machine type. It also allows to set various personality options. The default program is /bin/sh. OPTIONS
-v, --verbose Be verbose. -h, --help Display help (it is also displayed when setarch takes no arguments). -3, --3gb Specifies that processes should use a maximum of 3GB of address space on systems where it is supported (ADDR_LIMIT_3GB). -B, --32bit Turns on ADDR_LIMIT_32BIT. -F, --fdpic-funcptrs Userspace function pointers point to descriptors (turns on FDPIC_FUNCPTRS). -I, --short-inode Turns on SHORT_INODE. -L, --addr-compat-layout Changes the way virtual memory is allocated (turns on the ADDR_COMPAT_LAYOUT). -R, --addr-no-randomize Disables randomization of the virtual address space (turns on ADDR_NO_RANDOMIZE). -S, --whole-seconds Turns on WHOLE_SECONDS. -T, --sticky-timeouts Turns on STICKY_TIMEOUTS. -X --read-implies-exec Turns on READ_IMPLIES_EXEC. -Z, mmap-page-zero Turns on MMAP_PAGE_ZERO. EXAMPLES
setarch ppc32 rpmbuild --target=ppc --rebuild foo.src.rpm setarch ppc32 -v -vL3 rpmbuild --target=ppc --rebuild bar.src.rpm setarch ppc32 --32bit rpmbuild --target=ppc --rebuild foo.src.rpm AUTHOR
Elliot Lee <sopwith@redhat.com> Jindrich Novy <jnovy@redhat.com> AVAILABILITY
The setarch command is part of the util-linux package and is available from ftp://ftp.kernel.org/pub/linux/utils/util-linux/. setarch Jun 2007 SETARCH(8)
All times are GMT -4. The time now is 09:45 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy