aboutsummaryrefslogtreecommitdiffstats
path: root/rpm2cpio.pl
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2004-08-17 23:57:38 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2004-08-17 23:57:38 +0000
commit31a49a277bd22d25818267ba4bbcd753ba824ebe (patch)
tree4821584009c7dde673b8f7e8937ac3bdba62f6c8 /rpm2cpio.pl
parentd6b80e02c35442e1e234d6d62d79d33f998608ce (diff)
downloadrpmtools-31a49a277bd22d25818267ba4bbcd753ba824ebe.tar
rpmtools-31a49a277bd22d25818267ba4bbcd753ba824ebe.tar.gz
rpmtools-31a49a277bd22d25818267ba4bbcd753ba824ebe.tar.bz2
rpmtools-31a49a277bd22d25818267ba4bbcd753ba824ebe.tar.xz
rpmtools-31a49a277bd22d25818267ba4bbcd753ba824ebe.zip
Minor adjustements
Diffstat (limited to 'rpm2cpio.pl')
-rw-r--r--rpm2cpio.pl22
1 files changed, 8 insertions, 14 deletions
diff --git a/rpm2cpio.pl b/rpm2cpio.pl
index 44fb462..1121a04 100644
--- a/rpm2cpio.pl
+++ b/rpm2cpio.pl
@@ -29,15 +29,18 @@
# sw 2002-Mar-6 Don't slurp the whole file
-# add a path if desired
-$gzip = "gzip";
+# 2004-Aug-18: minor changes for Mandrakelinux by Rafael Garcia-Suarez
+
+# adjust path if desired
+$gzip = "/bin/gzip";
+-x $gzip or die "No /bin/gzip found, aborting\n";
sub printhelp {
print <<HERE;
-rpm2cpio, perl version by orabidoo <odar\@pobox.com> +sw
+rpm2cpio.pl, perl version by orabidoo <odar\@pobox.com> +sw
dumps the contents to stdout as a cpio archive
-use: rpm2cpio [file.rpm] > file.cpio
+use: rpm2cpio.pl [file.rpm] > file.cpio
Here's how to use cpio:
list of contents: cpio -t -i < /file/name
@@ -59,12 +62,6 @@ if ($#ARGV == -1) {
printhelp if -t STDOUT;
-# gobble the file up
-##undef $/;
-##$|=1;
-##$rpm = <$f>;
-##close ($f);
-
read $f,$rpm,96;
($magic, $major, $minor, $crap) = unpack("NCC C90", $rpm);
@@ -72,8 +69,6 @@ read $f,$rpm,96;
die "Not an RPM\n" if $magic != 0xedabeedb;
die "Not a version 3 or 4 RPM\n" if $major != 3 && $major != 4;
-##$rpm = substr($rpm, 96);
-
while (!eof($f)) {
$pos = tell($f);
read $f,$rpm,16;
@@ -99,8 +94,7 @@ if (eof($f)) {
die "bogus RPM\n";
}
-open(ZCAT, "|gzip -cd") || die "can't pipe to gzip\n";
-print STDERR "CPIO archive found!\n";
+open(ZCAT, "|$gzip -cd") || die "can't pipe to gzip\n";
print ZCAT $rpm;