-%define snap 03-02-13
+# TODO
+# - see if it uses system files for ettercap and geoip, ieee-oui files we did not package
+# - see where plugins are needed in plugin dir or in system dir
+# - unpackaged
+# /etc/ntop/GeoIPASNum.dat
+# /etc/ntop/GeoLiteCity.dat
+# /usr/lib64/libntop.a
+# /usr/lib64/libntopreport.a
+# NOTE: can read oui.txt.xz if MAKE_WITH_ZLIB enabled
+
Summary: Network monitoring tool
-Summary(pl): Narzêdzie do monitorowania sieci
+Summary(pl.UTF-8): Narzędzie do monitorowania sieci
Name: ntop
-Version: 2.2
-Release: 0.2
-License: GPL
+Version: 5.0.1
+Release: 9
+License: GPL v3+
Group: Networking
-Source0: http://snapshot.ntop.org/tgz/%{name}-%{version}.tgz
-# Source0-md5: 4586e4173fcab64d2394502603fc73aa
+Source0: http://downloads.sourceforge.net/ntop/%{name}-%{version}.tar.gz
+# Source0-md5: 01710b6925a8a5ffe1a41b8b512ebd69
Source1: %{name}.init
Source2: %{name}.sysconfig
-Source3: %{name}.conf
-Patch0: %{name}-acam.patch
-Patch1: %{name}-externallib.patch
-Patch2: %{name}-perl.patch
+# http://ettercap.cvs.sourceforge.net/ettercap/ettercap_ng/share/etter.finger.os?rev=HEAD
+Source3: etter.finger.os
+Patch0: %{name}-conf.patch
+Patch1: %{name}-config.patch
+Patch2: %{name}-am.patch
+Patch3: %{name}-lua_wget.patch
+Patch4: %{name}-http_c.patch
+Patch5: %{name}-running-user.patch
+Patch6: ieee-oui.patch
+Patch7: %{name}-install.patch
+Patch8: %{name}-rrdtool-1.6.0.patch
+Patch9: ac-am.patch
URL: http://www.ntop.org/
-BuildRequires: autoconf
-BuildRequires: automake
-BuildRequires: gd-devel >= 2.0.1
+BuildRequires: GeoIP-devel
+BuildRequires: autoconf >= 2.52
+BuildRequires: automake >= 1.6
+BuildRequires: gawk
BuildRequires: gdbm-devel >= 1.8.3
BuildRequires: libpcap-devel
-BuildRequires: libpng-devel
-BuildRequires: libtiff-devel
-BuildRequires: libwrap-devel
BuildRequires: libtool
-BuildRequires: ncurses-devel >= 5.2
-BuildRequires: openssl-devel >= 0.9.7c
-BuildRequires: readline-devel >= 4.2
+BuildRequires: net-snmp-devel
+BuildRequires: openssl-devel >= 0.9.7d
+BuildRequires: perl-devel
+BuildRequires: rpm-pythonprov
+BuildRequires: rpmbuild(macros) >= 1.268
+BuildRequires: rrdtool-devel >= 1.1.0
+BuildRequires: sed >= 4.0
BuildRequires: zlib-devel
-PreReq: rc-scripts
-Requires(pre): /usr/bin/getgid
-Requires(pre): /bin/id
-Requires(pre): /usr/sbin/groupadd
-Requires(pre): /usr/sbin/useradd
-Requires(post,preun): /sbin/chkconfig
Requires(post,postun): /sbin/ldconfig
+Requires(post,preun): /sbin/chkconfig
Requires(postun): /usr/sbin/groupdel
Requires(postun): /usr/sbin/userdel
+Requires(pre): /bin/id
+Requires(pre): /usr/bin/getgid
+Requires(pre): /usr/sbin/groupadd
+Requires(pre): /usr/sbin/useradd
+Requires: hwdata >= 0.243-2
+Requires: rc-scripts >= 0.4.2.8
+# maybe is optional, needs checking
+Suggests: GeoIP-db-City
+Suggests: GeoIP-db-IPASNum
+Suggests: ettercap
+Provides: group(ntop)
+Provides: user(ntop)
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+%define _localstatedir /var/lib
+
%description
ntop is a tool that shows the network usage, similar to what the
popular top Unix command does.
-%description -l pl
-ntop to narzêdzie, które pokazuje u¿ycie sieci w podobny sposób jak
-robi to popularna Unixowa komenda top.
+%description -l pl.UTF-8
+ntop to narzędzie, które pokazuje użycie sieci w podobny sposób jak
+robi to popularna uniksowa komenda top.
%prep
%setup -q
-#%%patch0 -p1
-cd %{name}*
-%patch2 -p1
-cd ../gdchart*
+%patch0 -p1
%patch1 -p1
+%patch2 -p1
+%patch3 -p1
+%patch4 -p1
+%patch5 -p1
+%patch6 -p1
+%patch7 -p1
+%patch8 -p1
+%patch9 -p1
+
+gzip -9c %{SOURCE3} >etter.finger.os.gz
+
+# taken from autogen.sh
+cp -f %{_aclocaldir}/libtool.m4 libtool.m4.in
+cat acinclude.m4.in libtool.m4.in acinclude.m4.ntop > acinclude.m4
+
+%{__sed} -i -e '1s,/usr/bin/env python$,%{__python},' python/sankey.py
%build
-cd gdchart*
-rm -rf gd-* zlib-*
%{__libtoolize}
%{__aclocal}
%{__autoconf}
+%{__autoheader}
+%{__automake}
+
+cd nDPI
%configure
%{__make}
+cd ..
-cd ../%{name}*
-#mv -f acinclude.m4.in acinclude.m4
-#rm -f missing
-#%%{__libtoolize}
-%{__aclocal}
-%{__autoconf}
-%{__automake}
+# "verified.awk -u" calls require gawk
%configure \
- --with-ossl-root=%{_prefix} \
- --with-gdchart-root=`pwd`/../gdchart0.94c \
- --enable-tcpwrap \
+ AWK=gawk \
+ --disable-static \
--with-gnu-ld \
- --enable-i18n \
- --enable-showoses \
- --localstatedir=%{_var}/lib/%{name} || true
-
-%configure \
--with-ossl-root=%{_prefix} \
- --with-gdchart-root=`pwd`/../gdchart0.94c \
- --enable-tcpwrap \
- --with-gnu-ld \
- --localstatedir=%{_var}/lib/%{name}
-
+ --enable-snmp
-%{__make}
-cd plugins
%{__make}
%install
rm -rf $RPM_BUILD_ROOT
-cd %{name}*
-install -d $RPM_BUILD_ROOT{%{_var}/lib/%{name},/etc/{rc.d/init.d,sysconfig}}
+install -d $RPM_BUILD_ROOT{%{_localstatedir}/ntop/rrd,/etc/{rc.d/init.d,sysconfig},%{_sbindir}}
%{__make} install \
+ GEOIP_FILES= \
+ OUI_FILES= \
+ ETTER_PASSIVE= \
DESTDIR=$RPM_BUILD_ROOT
-#mv $RPM_BUILD_ROOT%{_bindir}/*.pem $RPM_BUILD_ROOT%{_datadir}/%{name}
+install -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/ntop
+cp -a %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/ntop
+cp -a packages/RedHat/ntop.conf.sample $RPM_BUILD_ROOT%{_sysconfdir}/ntop.conf
+
+# these are identical files according to find-debuginfo
+for p in icmpPlugin lastSeenPlugin netflowPlugin cpacketPlugin rrdPlugin sflowPlugin; do
+ ln -snf ../../lib$p-%{version}.so $RPM_BUILD_ROOT%{_libdir}/ntop/plugins/$p.so
+done
+
+# read by checkForInputFile() scanning various dirs and extensions
+ln -s /lib/hwdata/oui.txt $RPM_BUILD_ROOT%{_sysconfdir}/ntop/oui.txt
-install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/ntop
-install %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/ntop
-install %{SOURCE3} $RPM_BUILD_ROOT/etc/ntop.conf
+# no -devel
+rm -f $RPM_BUILD_ROOT%{_libdir}{,/ntop/plugins}/*.la
%clean
rm -rf $RPM_BUILD_ROOT
%pre
-if [ -n "`getgid ntop`" ]; then
- if [ "`getgid ntop`" != "120" ]; then
- echo "Error: group ntop doesn't have gid=120. Correct this before installing ntop." 1>&2
- exit 1
- fi
-else
- /usr/sbin/groupadd -g 120 -r -f ntop
-fi
-if [ -n "`id -u ntop 2>/dev/null`" ]; then
- if [ "`id -u ntop`" != "120" ]; then
- echo "Error: user ntop doesn't have uid=120. Correct this before installing ntop." 1>&2
- exit 1
- fi
-else
- /usr/sbin/useradd -u 120 -r -d /var/lib/ntop -s /bin/false -c "ntop User" -g ntop ntop 1>&2
-fi
+%groupadd -g 120 ntop
+%useradd -u 120 -d %{_localstatedir}/ntop -s /bin/false -c "ntop User" -g ntop ntop
-%post
+%post
/sbin/ldconfig
/sbin/chkconfig --add ntop
-if [ -f /var/lock/subsys/ntop ]; then
- /etc/rc.d/init.d/ntop restart >&2
-else
- echo "Run \"/etc/rc.d/init.d/ntop start\" to start ntop daemon." >&2
-fi
+%service ntop restart "ntop daemon"
%preun
if [ "$1" = "0" ]; then
- if [ -f /var/lock/subsys/ntop ]; then
- /etc/rc.d/init.d/ntop stop 1>&2
- fi
- /sbin/chkconfig --del ntop
+ %service ntop stop
+ /sbin/chkconfig --del ntop
fi
-%postun
+%postun
/sbin/ldconfig
if [ "$1" = "0" ]; then
- /usr/sbin/userdel ntop
- /usr/sbin/groupdel ntop
+ %userremove ntop
+ %groupremove ntop
fi
%files
%defattr(644,root,root,755)
-%doc ntop/AUTHORS ntop/NEWS ntop/README ntop/THANKS
-#ntop/docs/1STRUN.TXT ntop/docs/FAQ
-%dir %{_var}/lib/%{name}
-%attr(755,root,root) %{_bindir}/*
-%attr(755,root,root) %{_libdir}/lib*
-#%attr(755,root,root) /usr/share/ntop/*
+%doc AUTHORS ChangeLog NEWS README THANKS docs/{1STRUN.txt,FAQ}
+%attr(750,root,ntop) %dir %{_sysconfdir}/ntop
+%attr(640,root,ntop) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/ntop/ntop-cert.pem
+%attr(640,root,ntop) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/ntop/oui.txt
+%attr(640,root,ntop) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/ntop/specialMAC.txt.gz
+%attr(660,root,ntop) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/ntop.conf
+%attr(754,root,root) /etc/rc.d/init.d/ntop
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/ntop
+%attr(755,root,root) %{_sbindir}/ntop
+%attr(755,root,root) %{_libdir}/lib*.so
%attr(755,root,root) %{_datadir}/%{name}
-#%%{_libdir}/lib*.la
-#%dir %{_libdir}/%{name}
-#%dir %{_libdir}/%{name}/plugins
+%dir %{_libdir}/%{name}
%attr(755,root,root) %{_libdir}/%{name}/plugins
-%{_mandir}/man*/*
-%attr(754,root,root) /etc/rc.d/init.d/ntop
-%attr(640,root,root) /etc/sysconfig/ntop
-%attr(644,ntop,ntop) %config(noreplace) %verify(not size mtime md5) /etc/ntop.conf
+%{_mandir}/man8/ntop.8*
+
+%attr(770,root,ntop) %dir %{_localstatedir}/ntop
+%attr(770,root,ntop) %dir %{_localstatedir}/ntop/rrd