Build rpm for a shell script

From Wiki
Jump to: navigation, search

Making an RPM for a shell script.

1. Install rpmbuild so you may start to build your own RPMs.

2. Package your shell script into a tar.gz file and move that to /usr/src/redhat/SOURCES/

tar -cvzf shell-script-0.1.tar.gz shell-script-0.1 
mv shell-script-0.1.tar.gz /usr/src/redhat/SOURCES/

3. Create a .spec file that describes where everything is.

# cat /usr/src/redhat/SPECS/shell-script.spec
Summary: The do it all script. (Enterprise quality)
Name: shell-script
Version: 0.1
Release: 1
License: GPL
Group: Applications/Internet
BuildRoot: %{_tmppath}/%{name}-root
Requires: ruby
Source0: shell-script-%{version}.tar.gz
BuildArch: noarch

A shell script.



rm -rf ${RPM_BUILD_ROOT}
mkdir -p ${RPM_BUILD_ROOT}/usr/bin
install -m 755 ${RPM_BUILD_ROOT}%{_bindir}

rm -rf ${RPM_BUILD_ROOT}

%attr(755,root,root) %{_bindir}/

* Tue Jan 12 2010 Robert de Bock <>
- Uberscript!

3. Build it!

rpmbuild --bb /usr/src/redhat/SPECS/shell-script.spec

4. Install it!

rpm -Uvh /usr/src/redhat/RPMS/noarch/shell-script-0.1.1.noarch.rpm

Links - Togo is a tool to make packaging easier.