File flowd.spec of Package flowd

Summary: The flowd NetFlow collector daemon
Name: flowd
Version: 0.9.1
Release: 1
URL: http://www.mindrot.org/flowd.html
Source0: flowd-%{version}.tar.bz2
Source1: flowd.init.suse
License: BSD
Group: Productivity/Networking/Diagnostic
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
PreReq: %fillup_prereq %insserv_prereq
BuildRequires: byacc
BuildRequires: glibc-devel
BuildRequires: python >= 2.3 byacc python-devel

%package -n perl-flowd
Requires: perl-base
Summary: Perl API to access flowd logfiles
Group: Productivity/Networking/Diagnostic
Requires: perl

%package -n python-flowd
Requires: python-base
Summary: Python API to access flowd logfiles
Group: Productivity/Networking/Diagnostic
Requires: python >= 2.3

%package tools
Summary: Collection of example flowd tools
Group: Productivity/Networking/Diagnostic

%package devel
Summary: C API to access flowd logfiles
Group: Development/Libraries/C and C++

%description
This is flowd, a NetFlow collector daemon intended to be small, fast and secure.

It features some basic filtering to limit or tag the flows that are recorded
and is privilege separated, to limit security exposure from bugs in flowd 
itself.

%description -n perl-flowd
This is a Perl API to the binary flowd network flow log format and an example
reader application

%description -n python-flowd
This is a Python API to the binary flowd network flow log format and an 
example reader application

%description tools
A collection of tools for use with flowd

%description devel
This is a C API to the binary flowd network flow log format.

%prep

%setup

%build
[ -f configure -a -f flowd-config.h.in ] || autoreconf
%configure --enable-gcc-warnings

make

%{__python} setup.py build

(cd Flowd-perl ; CFLAGS="$RPM_OPT_FLAGS" perl Makefile.PL \
	PREFIX=$RPM_BUILD_ROOT/usr INSTALLDIRS=vendor; make )

%install
rm -rf $RPM_BUILD_ROOT

%makeinstall

# Misc stuff
install -d $RPM_BUILD_ROOT/etc/init.d
install -d $RPM_BUILD_ROOT/var/lib/flowd
install -m755 %{S:1} $RPM_BUILD_ROOT/etc/init.d/flowd
ln -sf /etc/init.d/flowd $RPM_BUILD_ROOT/usr/sbin/rcflowd

# Perl module
(cd Flowd-perl; make install)
find ${RPM_BUILD_ROOT}/usr/lib*/perl5 \
	\( -name perllocal.pod -o -name .packlist \) -exec rm -v {} \;
find ${RPM_BUILD_ROOT}/usr/lib*/perl5 \
	-type f -print | sed "s@^$RPM_BUILD_ROOT@@g" > flowd-perl-filelist
find ${RPM_BUILD_ROOT}/usr/lib*/perl5 \
	-type d -name Flowd -print | sed "s@^$RPM_BUILD_ROOT@\%dir\ @g" >> flowd-perl-filelist
find ${RPM_BUILD_ROOT}%{_mandir} \
	-type f | grep -E '[0-9]pm(.gz)?$' | \
	sed "s@^$RPM_BUILD_ROOT@@g;s@\$@*@" >> \
	flowd-perl-filelist

if [ "$(cat flowd-perl-filelist)X" = "X" ] ; then
    echo "ERROR: EMPTY FILE LIST"
    exit -1
fi

# Python module
%{__python} setup.py install --prefix=%{_prefix} --root %{buildroot} --record=INSTALLED_FILES
sed -e 's|/[^/]*$||' INSTALLED_FILES | grep "site-packages/" | \
    sort -u | awk '{ print "%attr(755,root,root) %dir " $1}' > INSTALLED_DIRS
cat INSTALLED_FILES INSTALLED_DIRS > INSTALLED_OBJECTS

%clean
rm -rf $RPM_BUILD_ROOT

%pre
%{_sbindir}/groupadd -r _flowd 2>/dev/null || :
%{_sbindir}/useradd -d /var/lib/flowd -s /bin/false -g _flowd -M -r _flowd \
	2>/dev/null || :

%post
%{fillup_and_insserv flowd}

%postun
%{restart_on_update flowd}

%preun
if [ "$1" = 0 ]
then
    %{stop_on_removal flowd}
fi

%files
%defattr(-,root,root)
%doc ChangeLog LICENSE README TODO
%dir %attr(0111,root,root) %{_var}/lib/flowd
%attr(0600,root,root) %config(noreplace) %{_sysconfdir}/flowd.conf
%attr(0644,root,root) %{_mandir}/man5/flowd.conf.5*
%attr(0644,root,root) %{_mandir}/man8/flowd.8*
%attr(0644,root,root) %{_mandir}/man8/flowd-reader.8*
%attr(0755,root,root) %{_bindir}/flowd-reader
%attr(0755,root,root) /etc/init.d/flowd
/usr/sbin/rcflowd
%attr(0755,root,root) %{_sbindir}/flowd

%files -n perl-flowd -f flowd-perl-filelist
%defattr(-,root,root)
%doc reader.pl

%files -n python-flowd -f INSTALLED_OBJECTS
%defattr(-,root,root)
%doc reader.py

%files tools
%defattr(-,root,root)
%doc tools/*

%files devel
%defattr(-,root,root)
%dir %attr(0755,root,root) %{_includedir}/flowd
%attr(0644,root,root) %{_includedir}/flowd/*
%attr(0644,root,root) %{_libdir}/libflowd.a

%changelog
openSUSE Build Service is sponsored by