[hobbit] Is anyone working on a RHEL/CentOS spec file to build an rpm package?

Christoph Schug cs at schug.net
Wed Aug 26 09:18:01 CEST 2009


Russ Hammer wrote:
> Is anyone working on a RHEL/CentOS spec file to build an rpm package?
> If so, is it being integrated into the xymon source tree?
> 
> If not, does anyone have one that I could use (at least as a starting
> point) to build an rpm for xymon 4.2.3 on CentOS 5.3 x86_64?

Hi Russ!

I made a client-only package for the CentOS 5.3 nodes of my employer 
(server is running FreeBSD). As this was done as part of my professional 
work, I am not sure if I am allowed to publish the spec and patches I 
made for legal reasons. But at least I can give you some hints and 
tweaks, which were needed in my case.

First some patches. I was required to tweak the hobbitd-client target in 
build/Makefile.rules, as the LDFLAGS were missing 
'LIBRTDEF="$(LIBRTDEF)"'. In configure.client I had to source 
build/clock-gettime-librt.sh and also had to 'echo LIBRTDEF = $LIBRTDEF" 
 >>Makefile' near where also the LFSDEF definition gets appended to the 
Makefile.

When building client-only ('CONFTYPE="client" ... ./configure 
--client'), the build process always assumes local client mode. 
Therefore, after the configure you have set 'LOCALCLIENT=no' in the 
resulting Makefile.

As you would build the package with no root privs, ensure that you 
invoke 'make PKGBUILD="1"', otherwise the build process tries (and fails 
of course) to chmod(1)/chown(1) files. You have to set correct 
permissions later of using the RPM file list.

After performing the 'make install INSTALLROOT="$RPM_BUILD_ROOT" 
PKGBUILD="1"' step, you can remove any hobbitclient-*.sh scripts except 
hobbitclient-linux.sh. You may also want to allign the file system 
layout to common standards by relocating directories like 'client/etc' 
to '%{_sysconfdir}/xymon/client/etc' for example. Same thing for 
'client/tmp' or 'client/logs', which should go to 
'%{_localstatedir}/...' for example. I used symlinks for this approach. 
Not nice, but IMHO at least somehow better than having stuff like log 
files under /usr/... You might also want to strip(1) the binaries.

Final steps were to provide an according run-command script which was 
copied to '%{_initrddir}/xymon-client'. Also don't forget to create  the 
user (with the same name as we defined BBUSER when calling the configure 
script" as part of the %pre script. In the %post should register the 
service using chkconfig(8), in %preun deregister it after stopping the 
service. %postun should contain a restart of the service. Evaluate "$1" 
in all cases to detect if you are dealing with the initial package 
installation, upgrades or package removal, as written in the RPM 
documentation. Last but not least you might also have a logrotate 
configuration file '%{_sysconfdir}/logrotate.d/xymon-client' which 
performs log file rotation on certain conditions and restarts the 
service after doing so.

Sorry, that I cannot provide the full spec for now (have to clarify this 
with the legal department here), but at least you should have a better 
idea what's actually needed.

Cheers!
-cs



More information about the Xymon mailing list