Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm building an RPM spec file and need to list in the %files section the files to include, relative to a build root that I'll specify. I already have the assembled directory that needs to be packaged--I just need to turn this into a list of relative paths to all files contained therein.

To do this I'm currently using find, but it's returning absolute paths.

find $1/codebase -type f ! -name ".*" >> ${BUILD_RPM_DST_DIR}/rpm.spec

I'm a bit of a unix n00b so I apologize.

Should I pipe it to sed or grep and remove the initial portion of the path? A sample of how to do that would be helpful.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Find will give you relative paths, if you pass a relative specification to it when you run it. You are passing $1/codebase which I gather is an absolute path. Instead of using that command try something like cd $1/codebase ; find . -type ... instead.

share|improve this answer

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.