Mailinglist Archive: opensuse (4749 mails)

< Previous Next >
Re: [SLE] RPM question
  • From: zentara <zentara@xxxxxxxxxxx>
  • Date: Sun, 4 May 2003 18:17:25 -0400
  • Message-id: <20030504181725.1c35f565.zentara@xxxxxxxxxxx>
On Sun, 4 May 2003 11:40:16 -0700 (PDT)
Martin <earl072001@xxxxxxxxx> wrote:

>Is there a way to extract just specific files from rpm
>package?

mc will use a "virtual filesystem" to let you pull files out
of an rpm, but I usually use this script. It will rip an rpm
into the current directory. It works great.
###############################################
#!/usr/bin/perl
use warnings;
use strict;
use Cwd;
use File::Path;

if ($#ARGV < 0){print<<'EOT';
Usage: rpmrip 1.rpm 2.rpm 3.rpm.......
Will install the given rpm (or spm) into the current directory.
EOT
exit;
}
my $td=cwd();

## make fake rpm database in current directory
print "Creating rpm db directory $td/var/lib/rpm\n";
#system('mkdir','-p','var/lib/rpm');
mkpath ('var/lib/rpm');
print "Initializing rpm db\n";
system ('rpm','--root',$td,'--dbpath','/var/lib/rpm','--initdb');

foreach (@ARGV){
system ('rpm','--notriggers','--noscripts','--nodeps','--force',
'--ignorearch','--ignoreos',
'--relocate',"/=/$td",'--badreloc',
'--define',"_dbpath $td/var/lib/rpm",
'--define',"_topdir $td",
'-Uvh', $_)}

rmtree ('var',0,0);
print 'Source spm\'s are in SOURCE, binary rpms are in dirs',"\n\n";
__END__

--
use Perl; #powerful programmable prestidigitation

< Previous Next >
References