Thursday, June 10, 2010

rpmcat

One of the ideas that came out of packaging rubygem dependencies for sup and sup itself, was a need of a script that would cat a specific file from an rpm. Since rpmls exists, the next logical step would be a rpmcat.

Rahul told me to go ahead and write it down. He also gave me a few pointers.

Here it is.
Copy it to your /usr/bin/ and do a chmod +x

Usage:
$ rpmcat <RPM> <full-file-path>
(get the full-file-path from rpmls)

Don't try random stuff. It will break! :-P

6 comments:

Anonymous said...

You can always do this:

$ rpmpeek <rpm> cat <full-file-path>

skvidal said...

Why would you want to get a specific file out of an rpm? Why not install the rpm properly?

Joe said...

You have some major defects that will show up on a multi-user system. Also, you can tell cpio to get one file, instead of writing the whole archive out to disk.

Dennis Gregorovic said...
This comment has been removed by the author.
Dennis Gregorovic said...

#!/bin/sh

rpm2cpio $1 | cpio -i --quiet --to-stdout .$2

$hRiNk said...

@skvidal: To see if some changes I made in a specific file turned out properly. (say sed, etc.)

@others: thanks for the pointers.