How to make a src.rpm unpack the source to whatever directory I want?

13,237

Solution 1

The solution was as simple as calling tar in the spec file and then specifying the path I wanted to untar to.

Solution 2

use rpm2cpio to unpack rpm. Or use alien to convert the rpm to other packages (deb, tar...)

The exact syntax for using rpm2cio

rpm2cpio ./package_name-test-1.1-1.x86_64.rpm | cpio -idmv
Share:
13,237

Related videos on Youtube

barn
Author by

barn

Software Engineer and tech enthusiast.

Updated on September 18, 2022

Comments

  • barn
    barn over 1 year

    I'm trying to make an rpm that will unpack the source to a custom directory, such as /asdf. When I run it, it always errors out saying "cannot create %sourcedir /usr/src/redhat/SOURCES". Is there something I can put in my .spec file that will make it unpack the source (which is just a .tar.gz file inside the src.rpm) to a custom directory when I do the command "rpm -i xyz.src.rpm"?

  • barn
    barn over 12 years
    yes, that's exactly what I did. I just didn't understand how the spec file worked in terms of rpmbuild.
  • DustWolf
    DustWolf over 3 years
    Use that option on what?
  • DustWolf
    DustWolf over 3 years
    Does not answer the question, how to unpack a source package.