0

I'm trying to make a very simple RPM installation file for RedHat.

This file must only put my binary to /usr/bin and my configuration file to /usr/etc.

I don't want to put my sources on the RPM.

Ethaan
  • 11,291
  • 5
  • 35
  • 45
nerixm
  • 1
  • 2
    There are any number of (varying quality) guides to building an rpm package online (not least of which is http://www.rpm.org/max-rpm/ch-rpm-basics.html which is linked from the [rpm-spec] tag wiki). Have you tried anything? Where are you stuck specifically? What version of RedHat/Fedora/CentOS are you building this on and what version(s) are you building this rpm for? – Etan Reisner Apr 20 '15 at 15:47
  • Since packages in Red Hat distribution mostly follows fedora package guidelines, you can get started from this wikipage: https://fedoraproject.org/wiki/How_to_create_an_RPM_package – marbu Apr 20 '15 at 16:03
  • Yes I found a lot of guides but none without compilation. For the head of the spec file OK but after I assume that %prep, %build and clean must be empty. – nerixm Apr 21 '15 at 06:54
  • I try to make a spec file with my binary and my configuration file in BUILD directory and to copy them by a cp cmd in /usr/bin and /usr/etc. Then in the %files part I try to give them the 755 permission. It doesn't work. I'm in a CentOS 6.5. Thanks for your answer anyway, your link is interesting – nerixm Apr 21 '15 at 06:58

1 Answers1

0

Create a tar ball with your files on paths (in the tar ball) like ./usr/etc …

Then add the tar ball with a SourceN: directive (choose N appropriately).

In %install do

%install
rm -rf %{buildroot}
mkdir -p %{buildroot}
tar -C %{buildroot} -xvf %{SOURCEn}    # <== choose n same as N in SourceN:

Then create %files with the absolute paths (i.e. w/o leading . and/or %buildroot). Use %attr(mode,user,group) if necessary: default %defattr(0644,root,root,0755) is usually what is necessary.

Run "rpm -ba your.spec" to create the binary packages.

Q.E.D.

Jeff Johnson
  • 2,310
  • 13
  • 23
  • Thanks a lot. I didn't anderstand that it was that simple I totally confused between RPM with sources and without sources. – nerixm Apr 24 '15 at 06:21