[an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Index   Calendar   Search
 

Hvordan finder jeg den rpm-pakke jeg mangler?

Et af de oftest stillede spørgsmål i forbindelse med Red Hat Linux er: Hvilken rpm-pakke indeholder filen XYZ?

På SSLUG's mailingliste har mange givet gode råd til svar på dette spørgsmål.
Denne løsning fremkom fra Hernik Størner, Ole Vilmann og Ole Tange en gang 1998.

Løsningen kræver et perl-script og et shell-script. Begge er ganske simple.

#!/usr/bin/perl
#
# doit
# 
while($rpm = <>) {
    chomp $rpm;
    @files=`rpm -qpl $rpm`;
    print map { $rpm ," ", $_ } @files;
}
#!/bin/sh
#
# findrpm
# 
if [ $# != 2 ]
then
    echo Usage: findrpm file-to-find /path/to/rpms
else
    find ${2}/*.rpm | /usr/local/bin/doit | grep -i $1 2>/dev/null
fi

Begge scripts kan f.eks. placeres i /usr/local/bin. Begge scripts skal selvfølgelig også være eksekverbare:

# chmod +x /usr/local/bin/doit /usr/local/bin/findrpm
#

Herefter er det muligt at finde ud af hvilken rpm-pakke, der indeholder libgpm.so:

[vilmann@supernaut ~]$ findrpm libgpm.so /cdrom/RedHat/RPMS/
/cdrom/RedHat/RPMS//gpm-1.13-8.i386.rpm /usr/lib/libgpm.so.1.13
/cdrom/RedHat/RPMS//gpm-devel-1.13-8.i386.rpm /usr/lib/libgpm.so
[vilmann@supernaut ~]$ 

En ulempe ved denne metode er, at en søgning efter make også vil give alle rpm-pakker med indhold WindowMaker, men det skulle være til at klare med grep:

# findrpm make /cdrom/RedHat/RPMS/ | grep -v WindowMaker

Happy rpm-hunting!

 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2004-03-07, 21:24 CET [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive](none) [an error occurred while processing this directive] # [an error occurred while processing this directive] *
 
Denne side vedligeholdes af Kristian Vilmann (<kristian@sslug.dk>)