screwed up rpm - how do I recover

James Olin Oden joden at lee.k12.nc.us
Sun Aug 22 17:59:32 UTC 2004


On Sun, 22 Aug 2004, Michal Jaegermann wrote:

> On Sun, Aug 22, 2004 at 12:53:04PM -0400, sean darcy wrote:
> > 
> > rpm2cpio doesn't work, so I can't install using cpio.
> 
> Hm ...
> 
> > Is the a tool to extract rpm files that doesn't depend on rpm being 
> > installed?
> 
> An rpm archive is really a header followed by an attached cpio
> archive compressed with bzip2 or gzip.  So a simple way to extract
> it is to search to a "magic" of a compressed blob and pipe bytes
> from that moment on through an uncompressor and cpio.  A slightly
> primitive, as a "magic signature" could be in theory found
> accidentally earlier in a header, but in practice really effective.
> 
> Some years ago I wrote myself such extractor in literally few lines
> of perl.  I am afraid that I do not know now where I stuck it if it
> is still around.  I have seen also something like that done in bash.
> Not very difficult.
>
Though I believe Alan Cox's advice is the best (using rescue 
environment), there is a bash script in /usr/lib/rpm called rpm2cpio.sh
that does not use librpm to implement rpm2cpio like functionality.

Cheers...james

>   Michal
> 
> 
> 





More information about the test mailing list