Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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"?

share|improve this question
    
I found the answer. logiqwest.com/TechnicalPapers/rpmScriptInstall.html provides step-by-step instructions for doing what I was trying to do. –  sqenixs Dec 1 '11 at 0:17
add comment

3 Answers

Yes, you could use -r or --root option of rpm to specify an alternative root path as the top directory.

You also can extract the files from rpm with rpm2cpio command. man rpm2cpio.

share|improve this answer
add comment

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

share|improve this answer
add comment
up vote 0 down vote accepted

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

share|improve this answer
    
If it was all about making the spec file with what you intended (than a command line option) then use install section in the spec file to just untar the file to a specific directory. –  Nikhil Mulley Dec 6 '11 at 19:04
    
yes, that's exactly what I did. I just didn't understand how the spec file worked in terms of rpmbuild. –  sqenixs Dec 8 '11 at 3:42
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.