Building an rpm which contains a single file

When I looked through the rpm build doco on the web, it seemed that all the instructions largely focussed on compiling binaries prior to packaging in an RPM. What if all you want to do is package a single file (eg an initialisation script) into an RPM for distribution with Yum?

Below is an example which covers this scenario

RPM Build

cd /root/cobbler-audit

tar –czvf cobbler-audit.tar.gz ./cobbler-audit

cp –p cobbler-audit.tar.gz /home/rpmbuild/rpmbuild/SOURCES/

su – rpmbuild

cd /home/rpmbuild/rpmbuild/SPECS

vi cobbler-audit.spec      (update version number)

rpmbuild –ba cobbler-audit.spec

(return to root prompt)

cp –p /home/rpmbuild/rpmbuild/RPMS/cobbler-audit-{V}.{v}-{R}.x86_64.rpm /var/www/cobbler/cobbler-audit-repo/

createrepo /var/www/cobbler/cobbler-audit-repo/

 yum install cobbler-audit