Adding a helper file to an RPM

Hi all,

I am trying to create an RPM for the Emulex 2.01g drivers for our kernel. The base RPM works fine, but I am now trying to include a helper script in the RPM. This script lives outside the driver source, as I wan't to preserve the emulex tarball.

I tried including
in my spec file, but it died because it tries to unpack all source files during the RPM creation.

I then tried just adding the file where I do the other installs, but instead of doing
install -m $RPM_BUILD_ROOT/blah
I did
install -m /usr/src/redhat/SOURCES/ /usr/local/bin

This works fine, and the file then appears in my binary RPM and is installed at installation time.

The problem I have is that the file is _NOT_ included in the resulting source RPM, so rebuilding the source RPM means finding this file and manually copying it into place.

Can anyone advise a solution for this ?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Is listed as one of the sources in the .spec header as well as located in the SOURCES directory from out of which you are working?

For instance:

Source0: <baseurl>/%{name}-%{version}.tar.gz

Later down in %install you should have something like this

install -m %{SOURCE1} /usr/local/bin

Now, when you build the sources it should get included inside the srpm as well.  At least that's the theory.  It's been a while since I did something like that ;)
AnonymouslemmingAuthor Commented:
As I said in my question, if I include as a Source statement in the SPEC file, it tries to untar it, so it fails with an error.
Ahh... sorry missed that part.

I take it your doing a fairly by the book %prep section?

You can do something along the following instead for your %prep

%setup -T -b 0

If you don't specify a -T to the %setup macro it tries to unpack _all_ sources.  The -b <n> then specifies a particular source to unpack.  If you've multiple sources in there that you need to unpack you can either spell each one out on it's own line, or do a basic bash loop inside the spec file as it's just a bash script anyway ;)

Also, you might want to look through  It's old, but very good for the basics.  The particular secion of the book in question is

The other thing you might want to do is look through spec files that others have done.  Whenever I'm trying to do something new for me with RPM I tend to look through the spec files for rpms hosted by and other third party apt repository maintainers.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.