Re: custom RPM build

Dario Alcocer <[email protected]> Thu, 14 Feb 2008 21:43:54 -0800
Newsgroups gmane.linux.redhat.rpm.general
Message-ID <[email protected]>
Leigh Peterson wrote:
> Hi All,
>  
> I'm currently trying to create an RPM which contains the NRPE service 
> as well as some custom scripts.  The problem I'm having is that the 
> source for the plugins and NRPE are in seperate tar.gz files.  The 
> spec file I have at the moment allows me to build the NRPE executable 
> and start-up scripts, etc, and create an RPM.  I would like to include 
> some extra plugins from the other tar.gz file.  These plugins are all 
> perl scripts, so they don't require compilation, just a straight copy 
> into the plugins folder before the RPM is created.

First, add the plug-ins tarball as another source file; for example:

    Source: nrpe-source-tarball.tar.gz
    Source1: plugins.tar.gz

Next, modify the %prep section to unpack the the extra plug-ins tarball:

    %prep
    %setup
    %setup -T -D -a 1

The second %setup directive will unpack the plug-ins tarball in the
top-level source directory of NRPE.

Finally, add commands in the %install section to copy the plug-ins into
the install destination:

    %install
    # install NRPE
    rm -fr $RPM_BUILD_ROOT
    make install DESTDIR=$RPM_BUILD_ROOT
    # install plug-ins unpacked in top-level source directory
    cp other-plugins/*.pl $RPM_BUILD_ROOT/usr/lib/nrpe/plugins

Make sure to add the plug-in scripts to the %files section so they'll be
included in the package.

HTH,

-- D.