| Description: |
Need to look at an rpm before installing, or installing an "alien" rpm?
Rips apart a rpm into current directory for your pleasure.
I was using a tsch script called "rpmdump", but didn't like having
to install tsch, just to run it. So here is the same thing in perl.
It relies mostly on system calls, so it may be better suited to a bash
shell script, but I know perl better than bash....haha. |
#!/usr/bin/perl
#by zentara zentara@gypsyfarm.com
#inspired by tsch script(rpmdump) of Volker Kuhlmann
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";
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";
|