RPM build with single file


There is script /usr/sbin/khmel.sh
Simple way to build RPM file, that will install this scrip on another systems.


yum install rpmdevtools

Create directory structure


Copy template

cp /etc/rpmdevtools/spectemplate-minimal.spec /root/rpmbuild/SPECS/khmel.org.spec

Remove and edit strings in .spec file to get such result:

Name:        khmel
Version:     1.0
Release:     4
Summary:     Print different words
Group:       Misc
License:     GPL
URL:         http://khmel.org
This package contain script, that print different words.

Trying to build rpm

rpmbuild -bb /root/rpmbuild/SPECS/khmel.org.spec
Processing files: khmel-1.0-4.i686
error: File not found: /root/rpmbuild/BUILDROOT/khmel-1.0-4.i386/usr/sbin/khmel.sh

According error message creating subdirectory and copy script

mkdir -p /root/rpmbuild/BUILDROOT/khmel-1.0-4.i386/usr/sbin/
cp -ar /usr/sbin/khmel.sh /root/rpmbuild/BUILDROOT/khmel-1.0-4.i386/usr/sbin/khmel.sh

Build RPM again

rpmbuild -bb /root/rpmbuild/SPECS/khmel.org.spec

New rpm is located here


Installation on another system

rpm -iv khmel-1.0-4.i686.rpm