[CentOS] Creating Spec file for RPM

Andrew W

andrewjameswood at ymail.com
Thu Nov 23 17:39:00 UTC 2017


Im trying to learn how to create RPMs but am a little confused by the 
spec file.

Im trying to package up some Python scripts, rather than binary files, 
and I want them to be installed in a subdirectory under /usr/local which 
I shall refer to as /usr/local/X

Ive put the scripts in a tarball under /home/me/X/RPM/SOURCES

but Im getting terribly confused over what to put in the  %build 
%install and %files sections


If I set $RPM_BUILD_ROOT to /home/me/X/RPM/temp then put

%prep

%setup -q

that will unpack the tarball, yes?, but where to, /home/me/X/RPM/temp ?

how would I then tell it to move the files I want from there into 
/usr/local/X and set appropriate permissions on them? The examples 
online all assume you have a makefile with a make install target, could 
I simply use the cp command under the %install section? But where am I 
copying from and to?

My brain is tied in knots!

Many thanks

Andrew





More information about the CentOS mailing list