Tag: rpm

Areca Tools RPM for CentOS Linux.

We recently started deploying servers with Areca RAID controllers (we had been a long time 3ware purchaser, but recently the cards and the support of them seems to have taken a turn for the worse).

Areca provides a handful of tools for managing their RAID controllers, but leave it to you to deploy and install on your servers how you see fit; that might be fine for a handful of servers, but any more than that and you are going to need some sort of package that is easily installable across your network.

Enter the areca-tools RPM I built for CentOS Linux : areca-tools-1.8-1.el5.sonic.src.rpm .

With this Source RPM you can build the areca-tools RPM for whatever hardware architecture and Red Hat based Linux OS you want. Hopefully this will save you some time if you need to deploy Arecas in the servers you maintain.

Note :  if you want to monitor your Areca’s RAID status from mon, check out the raid.monitor I wrote.

When Perl and RPM don’t get along.

Sometimes when building rpm packages you will get an rpm that requires a file that it already contains. This seems pretty lame (which it is) but here is an example and a workaround.

Building a package for freepbx we see this output:

rpmbuild -ba freepbx.spec
Provides: config(freepbx) = 2.4.0-0
Requires(interp): /bin/sh /bin/sh
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1 Requires(post): /bin/sh Requires(postun): /bin/sh Requires: /bin/bash /usr/bin/env /usr/bin/perl /usr/bin/php config(freepbx) = 2.4.0-0 perl(DBI) perl(FindBin) perl(retrieve_parse_amportal_conf.pl)

The file we don’t want is: “perl(retrieve_parse_amportal_conf.pl)”

What rpmbuild does is go through the list of files and run “ldd” against all executables to find required libraries.
It also goes through each perl file and looks for “use / require” flags to pull out required perl modules.
When a developer does a legitimate thing like ‘require “retrieve_parse_amportal_conf.pl“‘ to include functions and such into their program, rpmbuild sees that this file is needed adds it too it’s list of required files.

Now rpmbuild also goes through and looks for what packages/files perl programs provide. It does this by scanning through the files and looking for “package“. If you just have an include file with functions, you don’t have a complete module and won’t have the package statement either. Thus rpmbuild will never see your file provides itself! Fortunatly there are a couple work arounds.

In your perl file that rpmbuild is requiring you can define ‘ our $RPM_Provides = “yourfilename.pl” ‘. rpmbuild will pick this up and happily add it to the provided file list. The other method is slightly more complicated but works well if you don’t want to patch the source code.

In your rpm spec file under the %prep section after the %setup add the following code:

cat << EOF > %{name}-req
%{__perl_requires} $* |
sed -e '/perl(yourperlfile.pl)/d'
%define __perl_requires %{_builddir}/%{name}-%{version}/%{name}-req
chmod 755 %{__perl_requires}

Where yourperlfile.pl is the file you want to exclude from the rpm requires check.
This should make your rpm build hapily and exlude that file from the requires check.

If you want to see the actuall files rpmbuild runs take a look at: