I've trying to create a Samba RPM for an old version of Fedora. There aren't any available to download on the internet so I've got the source code.

So far I have the five standard directories /BUILD, /RPMS, /SOURCES, /SPECS and /SRPMS.

In /SOURCES there is the source code in a tar ball.
In /SPEC is the samba.spec file.

When I do a rpmbuild -v -bb --clean SPECS/samba.spec it falls over after untarring the ball and attempting to build. The error is: line 29: autogen.sh : command not found.

More specifically, in my %build there is: autogen.sh, ./configure and make.

After this I install it all with make install in section %install.

Where am I going wrong?

Please note this all works fine when manually installing the source code.

With the ./autogen.sh removed, it comes up with: '/var/tmp/rpm-tmp.BEyARh: line 29: ./configure: No such file or directory.

EDIT: A-ha! I think I know the problem. It's looking in the root /samba directory for ./autogen.sh and etc, when it should be looking in `/samba/source3/ once it's extracted the tar ball and put it into /BUILD. How do I configure this?

  • Check out CMake, it has the module CPac which can produce source archives, and it provides debian, red hat, nsis, and mac os x installers for everything which is uber nice. Just a suggestion! – alexmherrmann May 16 '12 at 13:41

The first thing I would try is to replace the line


in your .spec file with


since autogen.sh is probably not on your PATH. Putting the ./ in front of it will tell the shell to execute the file, provided there is a shebang (#!) at the top. If the first line of autogen.sh is not something like #! /bin/bash, instead of ./autogen.sh you could try

bash autogen.sh

which will explicitly execute the file as a bash script.

Edited in response to the changed question:

One way to hack this might be to change




or to

pushd source3

so that rpm can find the file. I'm not sure if this is considered "good" packaging, however.

There also may be some RPM settings you can change. There is an excellent book called Maximum RPM by Edward C. Bailey that talks all about creating RPMs, and this section may help you out in configuring for an odd build setup.

  • Just checked this and it doesn't make a difference :( Even when I remove ./autogen.sh and let it go straight into ./configure it trips. – Federer May 16 '12 at 13:18
  • Does it still give the error autogen.sh : command not found or is there a new error? – SethMMorton May 16 '12 at 13:37
  • It gives: "+ ./autogen.sh /var/tmp/rpm-tmp.r9Ax0q: line 29: ./autogen.sh: No such file or directory error: Bad exit status from /var/tmp/rpm-tmp.r9Ax0q (%build)" – Federer May 16 '12 at 13:39
  • If the .spec file isn't too long, could you add this to the original post? Sometimes errors that appear on line B are due to something on line A. – SethMMorton May 16 '12 at 13:46
  • 1
    I agree with Ignacio that you should remove the autogen.sh line. What has me confused is that you said the build failed even when this line was removed, but with the same error. If there was no line referencing autogen.sh then rpm shouldn't have been looking for it, so it shouldn't have complained that it didn't exist. Are you sure that you had removed the line telling it to execute autogen.sh before? – SethMMorton May 16 '12 at 14:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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