# RPM conditionals quirk %undefine defined %undefine undefined %undefine with %undefine without %undefine bcond_with %undefine bcond_without %define defined() %{expand:%%{?%{1}:1}%%{!?%{1}:0}} %define undefined() %{expand:%%{?%{1}:0}%%{!?%{1}:1}} %define with() %{expand:%%{?with_%{1}:1}%%{!?with_%{1}:0}} %define without() %{expand:%%{?with_%{1}:0}%%{!?with_%{1}:1}} %define bcond_with() %{expand:%%{?_with_%{1}:%%global with_%{1} 1}} %define bcond_without() %{expand:%%{!?_without_%{1}:%%global with_%{1} 1}} %if 0%{?fedora}%{?rhel} == 0 || 0%{?fedora} >= 7 || 0%{?rhel} >= 6 %bcond_without tcpwrappers_devel %else %bcond_with tcpwrappers_devel %endif %if 0%{?fedora}%{?rhel} == 0 || 0%{?fedora} >= 6 || 0%{?rhel} >= 5 %bcond_without libpcap_devel %else %bcond_with libpcap_devel %endif Summary: Network traffic probe that shows the network usage Name: ntop Version: 3.3 Release: 2%{?dist} License: GPLv2+ Group: System Environment/Daemons URL: http://www.ntop.org/ Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz Source1: ntop.init.in Source2: ntop.logrotate.in Source3: README.Fedora Patch0: ntop-3.3-ntopversionextra.patch Patch1: ntop-3.3-fhs.patch Patch2: ntop-3.3-config.patch Patch3: ntop.osreport.patch BuildRequires: automake >= 1.6 BuildRequires: autoconf >= 2.53 BuildRequires: gd-devel BuildRequires: gdbm-devel BuildRequires: gettext %if %{with libpcap_devel} BuildRequires: libpcap-devel %else BuildRequires: libpcap %endif BuildRequires: libpng-devel BuildRequires: libtool >= 1.4 BuildRequires: mysql-devel BuildRequires: openssl-devel BuildRequires: rrdtool-devel %if %{with tcpwrappers_devel} BuildRequires: tcp_wrappers-devel %else BuildRequires: tcp_wrappers %endif BuildRequires: zlib-devel Requires(pre): shadow-utils Requires(post): chkconfig Requires(post): /sbin/ldconfig Requires(post): initscripts Requires(preun): chkconfig Requires(preun): initscripts BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%__id_u -n) %description Ntop is a network and traffic analyzer that provides a wealth of information on various networking hosts and protocols. Ntop is primarily accessed via a built-in web interface. Optionally, data may be stored into a database for analysis or extracted from the web server in formats suitable for manipulation in perl or php. %prep %setup -q %patch0 -p1 -b .ntopversionextra %patch1 -p1 -b .fhs %patch2 -p1 -b .config %patch3 -p0 sed -e 's,@SYSCONFDIR@,%{_sysconfdir},g; s,@LOCALSTATEDIR@,%{_localstatedir},g; s,@INITRDDIR@,%{_initrddir},g; s,@BINDIR@,%{_bindir},g;' < %{SOURCE1} > ntop.init sed -e 's,@LOGDIR@,%{_localstatedir}/log,g' < %{SOURCE2} > ntop.logrotate cp %{SOURCE3} README.Fedora %build rm -f libtool.m4.in ./autogen.sh --noconfig %configure \ --enable-i18n \ --enable-largerrdpop \ --enable-mysql \ --enable-optimize \ --enable-sslv3 \ --enable-jumbo-frames \ --with-tcpwrap make %{?_smp_mflags} %install rm -rf %{buildroot} make DESTDIR="%{buildroot}" install install -Dp -m0755 ntop.init %{buildroot}%{_initrddir}/ntop install -Dp -m0644 ntop.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/ntop install -Dp -m0600 packages/RedHat/ntop.conf.sample %{buildroot}%{_sysconfdir}/ntop.conf rm -f %{buildroot}%{_libdir}/*.a rm -f %{buildroot}%{_libdir}/*.la %pre getent group ntop >/dev/null || groupadd -r ntop -g 453 getent passwd ntop >/dev/null || \ useradd -u 453 -r -g ntop -d %{_localstatedir}/lib/ntop -s /sbin/nologin \ -c 'Network traffic probe' ntop exit 0 %post /sbin/chkconfig --add ntop /sbin/ldconfig exit 0 %preun if [ $1 -eq 0 ]; then /sbin/service ntop stop >&/dev/null /sbin/chkconfig --del ntop fi exit 0 %postun if [ $1 -ge 1 ]; then /sbin/service ntop condrestart >&/dev/null || : fi /sbin/ldconfig %clean rm -rf %{buildroot} %files %defattr(-, root, root, 0755) %doc AUTHORS ChangeLog CONTENTS COPYING INSTALL MANIFESTO NEWS PORTING THANKS %doc *.txt docs/* README.Fedora %doc %{_mandir}/man8/ntop.8* %config(noreplace) %{_sysconfdir}/ntop.conf %config(noreplace) %{_sysconfdir}/logrotate.d/ntop %dir %{_sysconfdir}/ntop %config %{_sysconfdir}/ntop/* %{_initrddir}/ntop %{_bindir}/ntop %{_datadir}/ntop/ %{_libdir}/*.so %{_libdir}/ntop/ %defattr(-, ntop, nobody, 0775) %{_localstatedir}/lib/ntop/ %changelog * Thu Sep 25 2008 Mike Frisch - 3.3-2 - Use static uid/gid when adding ntop user (#116132) * Thu Feb 28 2008 Nils Philippsen - 3.3-1.1 - add RPM conditionals quirk (%%bcond_with/_without) - BR: tcp_wrappers-devel for %%{fedora} >= 7, %%{rhel} >= 6 * Tue Jan 22 2008 Nils Philippsen - version 3.3 - change license tag to GPLv2+ - change group to System Environment/Daemons - sanitize build requirements: - versionize - remove unnecessary gcc-c++, glib-devel - add libtool >= 1.4, libpng-devel, mysql-devel, rrdtool-devel - fix source URL - fix adding of ntop user/group as per Fedora guidelines, don't remove user upon removal of the package, don't modify user after installation/update of package - avoid excessive use of macros (e.g. "%%{__rm}" vs. plain "rm") - include init and logrotate script templates as source files - use patches instead of replacing strings with perl - include configuration file - move files from /var/ntop to /var/lib/ntop to conform with FHS * Fri Nov 16 2007 Shawn Starr - Modified Dag package - Initial packaging for Kusu