RPM builds
Daniel Deighton
dan at deightime.net
Mon Jul 25 20:25:07 CEST 2005
I've made a few changes to the hobbit.spec file which make it easier for
me to customize the building of hobbit RPMs. I've attached the new spec
file and the modified init and logrotate files, in case anyone is
interested.
To customize the RPM, change the definitions at the top of the spec
file. Place the init and logrotate files in your RPM_SOURCE_DIR (along
with the hobbit tarball). Then run 'rpmbuild -ba hobbit.spec'
I thought this might be useful to others who want to change some of the
defaults.
-Dan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hobbit-init.d-DIST
Type: application/x-shellscript
Size: 1283 bytes
Desc: not available
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20050725/8a076362/attachment.bin>
-------------- next part --------------
#
# Logrotate fragment for Hobbit.
#
/var/log/hobbit/*.log {
weekly
compress
delaycompress
rotate 5
missingok
nocreate
sharedscripts
postrotate
su -c "/etc/init.d/hobbit rotate" USERNAME
endscript
}
-------------- next part --------------
%define VER 4.1.1
%define BBUSER hobbit
%define BBGROUP hobbit
%define HTTPDGROUP apache
%define HOSTNAME localhost
%define HOSTIP 127.0.0.1
%define TOPDIR /usr/lib/hobbit
%define BINDIR %{TOPDIR}/server/bin \
%define EXTDIR %{TOPDIR}/server/ext \
%define ETCDIR /etc/hobbit \
%define WEBDIR %{ETCDIR}/web \
%define VARDIR /var/lib/hobbit
%define TMPDIR %{VARDIR}/tmp \
%define WWWDIR %{VARDIR}/www \
%define MANDIR /usr/share/man
%define LOGDIR /var/log/hobbit
Name: hobbit
Version: %{VER}
Release: 2
Group: Networking/Daemons
URL: http://hobbitmon.sourceforge.net/
License: GPL
Source: hobbit-%{VER}.tar.gz
Source1: hobbit-init.d-DIST
Source2: hobbit.logrotate-DIST
Summary: Hobbit network monitor
BuildRoot: /tmp/hobbit-root
Requires: fping
# BuildRequires: openssl-devel, pcre-devel, rrdtool-devel, openldap-devel
%description
Hobbit is a system for monitoring your network servers and
applications. It is heavily inspired by the Big Brother
tool, but is a complete re-implementation with a lot of added
functionality and performance improvements.
%prep
rm -rf $RPM_BUILD_ROOT
%setup
ENABLESSL=y \
ENABLELDAP=y \
ENABLELDAPSSL=y \
BBUSER=%{BBUSER} \
BBTOPDIR=%{TOPDIR} \
BBVAR=%{VARDIR} \
BBHOSTURL=/ \
CGIDIR=%{TOPDIR}/cgi-bin \
BBCGIURL=/hobbit-cgi \
SECURECGIDIR=%{TOPDIR}/cgi-secure \
SECUREBBCGIURL=/hobbit-seccgi \
HTTPDGID=%{HTTPDGROUP} \
BBLOGDIR=%{LOGDIR} \
BBHOSTNAME=%{HOSTNAME} \
BBHOSTIP=%{HOSTIP} \
MANROOT=%{MANDIR} \
BARS=all \
USENEWHIST=y \
PIXELCOUNT=960 \
INSTALLBINDIR=%{BINDIR} \
INSTALLETCDIR=%{ETCDIR} \
INSTALLWEBDIR=%{WEBDIR} \
INSTALLEXTDIR=%{EXTDIR} \
INSTALLTMPDIR=%{TMPDIR} \
INSTALLWWWDIR=%{WWWDIR} \
./configure
%build
PKGBUILD=1 make
%install
INSTALLROOT=$RPM_BUILD_ROOT PKGBUILD=1 make install
mkdir -p $RPM_BUILD_ROOT/etc/init.d
#cp %{SOURCE1} $RPM_BUILD_ROOT/etc/init.d/hobbit
cp %{SOURCE1} $RPM_BUILD_ROOT/%{ETCDIR}
cat %{SOURCE1}| sed -e "s/USERNAME/%{BBUSER}/" > $RPM_BUILD_ROOT/etc/init.d/hobbit
mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d
#cp %{SOURCE2} $RPM_BUILD_ROOT/etc/logrotate.d/hobbit
cp %{SOURCE2} $RPM_BUILD_ROOT/%{ETCDIR}
cat %{SOURCE2}| sed -e "s/USERNAME/%{BBUSER}/" > $RPM_BUILD_ROOT/etc/logrotate.d/hobbit
mkdir -p $RPM_BUILD_ROOT/usr/bin
cd $RPM_BUILD_ROOT/usr/bin && ln -s ../lib/hobbit/server/bin/{bb,bbcmd} .
%clean
rm -rf $RPM_BUILD_ROOT
%pre
id hobbit 1>/dev/null 2>&1
if [ $? -ne 0 ]
then
/usr/bin/getent group %{BBGROUP} || {
groupadd %{BBGROUP}
}
/usr/bin/getent passwd %{BBUSER} || {
useradd -g %{BBGROUP} -c "Hobbit user" -d /usr/lib/hobbit %{BBUSER}
}
fi
if [ -e /var/log/hobbit/hobbitlaunch.pid -a -x /etc/init.d/hobbit ]
then
/etc/init.d/hobbit stop || true
fi
%post
chkconfig --add hobbit
%preun
if [ -e /var/log/hobbit/hobbitlaunch.pid -a -x /etc/init.d/hobbit ]
then
/etc/init.d/hobbit stop || true
fi
chkconfig --del hobbit
%files
%attr(-, root, root) %doc README Changes* COPYING CREDITS
%attr(644, root, root) %doc /usr/share/man/man*/*
%attr(644, root, root) %config /etc/hobbit/*
%attr(755, root, root) %dir /etc/hobbit
%attr(755, root, root) %dir /etc/hobbit/web
%attr(755, %{BBUSER}, %{BBGROUP}) %dir /var/log/hobbit
%attr(755, root, root) /etc/init.d/hobbit
%attr(644, root, root) /etc/logrotate.d/hobbit
%attr(-, root, root) /usr/lib/hobbit
%attr(-, root, root) /usr/bin/*
%attr(-, %{BBUSER}, %{BBGROUP}) /var/lib/hobbit
%attr(775, %{BBUSER}, %{HTTPDGROUP}) %dir /var/lib/hobbit/www/rep
%attr(775, %{BBUSER}, %{HTTPDGROUP}) %dir /var/lib/hobbit/www/snap
%attr(644, root, root) %config /var/lib/hobbit/www/menu/menu_items.js
%attr(644, root, root) %config /var/lib/hobbit/www/menu/menu_tpl.js
%attr(644, root, root) %config /var/lib/hobbit/www/menu/menu.css
More information about the Xymon
mailing list