Monday, April 9, 2012

Extract File from RPM

I failed to extract /etc/hue/log4j.properties from hue-common-1.2.0.0+114.20-1.x86_64.rpm because cpio prints out garbage data with something like this
[bewang@pmaster tmp]$ rpm2cpio hue-common-1.2.0.0+114.20-1.x86_64.rpm | cpio -idvm ./etc/hue/log4j.properties
cpio: warning: skipped 10263 bytes of junk
cpio: warning: archive header has reverse byte-order
cpio: premature end of file
It turns out that rpm2cpio outputs compressed data after googling this issue. I have to do like this:
rpm2cpio hue-common-1.2.0.0+114.20-1.x86_64.rpm | xz -d | cpio -idvm ./etc/hue/log4j.properties

2 comments:

  1. Thanks for this.

    For those that don't have xz installed on their system, there is a java implementation and other downloadable files here: http://tukaani.org/xz/

    ReplyDelete
  2. Where does the file is extracted?

    Im running it this way but not sure where the extrated file will stay:

    rpm2cpio kernel-uek-debuginfo-3.8.13-98.el6uek.x86_64.rpm |xz -d| cpio -idvm /usr/lib/debug/lib/modules/3.8.13-98.el6uek.x86_64/vmlinux

    ReplyDelete