RHEL Package

nicubunu_PackageI like to work with open source code. But it is not always possible. Sometimes you have to deal with proprietary code. And sometimes you have to distribute it. I like to distribute software as RPM package because it allows me to put together patches, post-install scripts and configuration files. But how can I create and distribute proprietary software without violating license? The answer is "nosrc.rpm".

For example - let assume that you want to distribute Oracle Database Server with your custom settings and patches. The oracle-server.spec file may look like this:

Summary: Oracle 10g Database Server Enterprise Edition
License: Oracle License
Group: Applications/Databases
Name: oracle-server-x86_64
Version: 10.2.0.4
Release: 78%{?dist}
Source0: 10201_database_linux_x86_64.cpio.gz
Source1: p6810189_10204_Linux-x86-64.zip
...

Usually you build it using:

rpmbuild -bs oracle-server.spec

which would create oracle-server-10.2.0.4-78.el7.src.rpm. But that would contains those archives, which you are not allowed to redistribute.

The solution is to alter your spec file like:

...
Source0: 10201_database_linux_x86_64.cpio.gz
Source1: p6810189_10204_Linux-x86-64.zip
NoSource: 0, 1
...

and then run:

rpmbuild -bs oracle-server.spec

This will create file oracle-server-10.2.0.4-78.el7.nosrc.rpm.
Resulting source package will include your scriptlets, patches, but will not include those archives. Positive side effects is that resulting file is much smaller.

You can freely distribute the resulting nosrc.rpm file.

Now you have to instruct your users to do:

yum install rpmdevtools
rpmdev-setuptree

Then they have to download those archives (in this case from oracle.com) and place them in ~/rpmbuild/SOURCES. Then they finish with:

rpm -Uvh oracle-server-10.2.0.4-78.el7.nosrc.rpm
rpmbuild -ba ~/rpmbuild/SPECS/oracle-server.spec

And users will end up with binary rpm packages, which they can install. Without violating their proprietary license.

Last updated: August 31, 2016