[CentOS] Shell Script - Compare packages. rpm.

Tiago Dias tux.tiago at gmail.com
Mon Jan 26 10:26:06 UTC 2009


Hi,

         I need a script which makes the package compação rpm's through two
text files ...

         Since a file is the output of the command *rpm-qa > pkg.out *

         And the second file is a list of several packages rpm's, multiple
versions and architectures.

         My idea is to compare a package *x* file pkg.out with several
packages *y* of the file update.out and know whether a package and has a
larger version of the package *x* installed and with that I return I have a
package to be updated.

        Does anyone can help me do this comparison?

        OBS.: The servers do not have access to internet.

        Here's an example of the packages described in the files:

[root at rpm tiago]# tail -n12 pkg.out
glibc-devel-2.3.4-2.39
libuser-devel-0.52.5-1.el4.1
libmudflap-4.1.2-14.EL4
iiimf-libs-devel-12.1-13.EL.6
xorg-x11-devel-6.8.2-1.EL.33
lam-libs-7.1.2-8
libdbi-0.6.5-10.RHEL4.1
unixODBC-kde-2.2.11-1.RHEL4.1
perl-Compress-Zlib-1.42-1.el4
MySQL-python-1.2.1_p2-1.el4.1
nmap-3.70-1
sysstat-5.0.5-16.rhel4
[root at rpm tiago]#

--

[root at rpm tiago]# cat update.out
glibc-devel-2.3.4-2.41.i386.rpm
glibc-devel-2.3.4-2.39.i386.rpm
glibc-devel-2.3.4-2.36.i386.rpm
glibc-devel-2.3.4-2.25.i386.rpm
glibc-devel-2.3.4-2.19.i386.rpm
glibc-devel-2.3.4-2.13.i386.rpm
glibc-devel-2.3.4-2.9.i386.rpm
glibc-devel-2.3.4-2.i386.rpm
libuser-devel-0.52.5-1.el4.3.i386.rpm
libuser-devel-0.52.5-1.el4.1.i386.rpm
libuser-devel-0.52.5-1.i386.rpm
libmudflap-4.1.2-42.EL4.i386.rpm
libmudflap-4.1.2-14.EL4.i386.rpm
libmudflap-4.1.1-53.EL4.i386.rpm
libmudflap-4.1.0-18.EL4.3.i386.rpm
libmudflap-4.1.0-18.EL4.i386.rpm
libmudflap-4.0.2-14.EL4.i386.rpm
libmudflap-4.0.1-4.EL4.2.i386.rpm
libmudflap-4.0.0-0.14.EL4.i386.rpm
xorg-x11-devel-6.8.2-1.EL.52.i386.rpm
xorg-x11-devel-6.8.2-1.EL.33.0.4.i386.rpm
xorg-x11-devel-6.8.2-1.EL.33.0.2.i386.rpm
xorg-x11-devel-6.8.2-1.EL.33.0.1.i386.rpm
xorg-x11-devel-6.8.2-1.EL.33.i386.rpm
xorg-x11-devel-6.8.2-1.EL.31.i386.rpm
xorg-x11-devel-6.8.2-1.EL.19.i386.rpm
xorg-x11-devel-6.8.2-1.EL.18.i386.rpm
xorg-x11-devel-6.8.2-1.EL.13.37.7.i386.rpm
xorg-x11-devel-6.8.2-1.EL.13.37.5.i386.rpm
xorg-x11-devel-6.8.2-1.EL.13.37.2.i386.rpm
xorg-x11-devel-6.8.2-1.EL.13.37.i386.rpm
xorg-x11-devel-6.8.2-1.EL.13.36.i386.rpm
xorg-x11-devel-6.8.2-1.EL.13.25.1.i386.rpm
xorg-x11-devel-6.8.2-1.EL.13.25.i386.rpm
xorg-x11-devel-6.8.2-1.EL.13.20.i386.rpm
xorg-x11-devel-6.8.2-1.EL.13.16.i386.rpm
xorg-x11-devel-6.8.2-1.EL.13.6.i386.rpm
xorg-x11-devel-6.8.1-23.EL.i386.rpm
lam-libs-7.1.2-15.el4:2.i386.rpm
lam-libs-7.1.2-8:2.i386.rpm
MySQL-python-1.2.1_p2-1.el4.1.i386.rpm
MySQL-python-1.0.0-1.RHEL4.1.i386.rpm
sysstat-5.0.5-19.el4.i386.rpm
sysstat-5.0.5-16.rhel4.i386.rpm
sysstat-5.0.5-15.0.1.el4.i386.rpm
sysstat-5.0.5-14.rhel4.i386.rpm
sysstat-5.0.5-11.rhel4.i386.rpm
sysstat-5.0.5-7.rhel4.i386.rpm
sysstat-5.0.5-1.i386.rpm
nmap-3.70-1:2.i386.rpm
[root at rpm tiago]#

Att,

-- 
Tiago Dias da Silva
Administrador de Sistemas GNU/Linux
HomePage: www.dias.eti.br
Email: tiago at dias.eti.br

"A mente que se abre a uma nova idéia jamais voltará ao seu tamanho
original"

(Albert Einstein)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.centos.org/pipermail/centos/attachments/20090126/d8c8cf7f/attachment.html 


More information about the CentOS mailing list