Few days back I had raised a query,
While installing a rpm if I get a list of dependent files, and then how to
find a rpm which provides these file.
Well, here is the 10 liner perl

rpmsearch.pl
------cut here---------
#!/usr/bin/perl -w
$rpmdir=$ARGV[1];
$rpmdir="/mnt/cdrom/RedHat/RPMS" if !$rpmdir;
$findfile=$ARGV[0];
die "$0 usage: filename [rpm directory] \n" if !$findfile;
@filelist=`ls $rpmdir`;
SEARCH:
foreach $filename(@filelist){
next SEARCH if !($filename=~/.rpm/);
chomp($filename);
print "$findfile -> $filename \n" if (`rpm -qlp
$rpmdir/$filename`=~/$findfile/);
}
exit 1;
---------cut here--------------

The first argument is the name of file to be found, second argument is
directory which contains all the rpm (default is /mnt/cdrm/RedHat/RPMS)
suppose you want to find libgd.so.2 in default directory.

./rpmsearch libgd.so.2

or if you want to find libgd.so.2 in /mnt/linux

./rpmsearch libgd.so.2 /mnt/linux

Enjoy!!


Regards,
Mukund Deshmukh
Beta Computronics Pvt. Ltd.
Web Site - www.betacomp.com



----------------------------------------------
LIH is all for free speech.  But it was created
for a purpose.  Violations of the rules of
this list will result in stern action.

Reply via email to