-%define snap 03-02-13
+# TODO:
+# - duplicate configure. remove or write down reason.
+# - configure appears to need gawk
+# - service ntop init steals terminal (it doesnt finish nor background)
+# - paths wrong somewhere /var/lib/ntop/ntop is expected (should be without last path component)
+# - /var/lib/ntop/* should be %ghost
+# - .la files should be in -devel
+# - ntop apperars to be daemon, so it should be in _sbindir not in _bindir
+#
Summary: Network monitoring tool
Summary(pl): Narzêdzie do monitorowania sieci
Name: ntop
-Version: 2.2
+Version: 3.1
Release: 0.2
License: GPL
Group: Networking
-Source0: http://snapshot.ntop.org/tgz/%{name}-%{version}.tgz
-# Source0-md5: 4586e4173fcab64d2394502603fc73aa
+Source0: http://dl.sourceforge.net/ntop/%{name}-%{version}.tgz
+# Source0-md5: 1c9b4097c2e464b84f2fe8f6626d2b06
Source1: %{name}.init
Source2: %{name}.sysconfig
-Source3: %{name}.conf
-Patch0: %{name}-acam.patch
-Patch1: %{name}-externallib.patch
-Patch2: %{name}-perl.patch
+Patch0: %{name}-plugins_makefile.patch
+Patch1: %{name}-conf.patch
+Patch2: %{name}-DESTDIR.patch
URL: http://www.ntop.org/
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: libwrap-devel
BuildRequires: libtool
BuildRequires: ncurses-devel >= 5.2
-BuildRequires: openssl-devel >= 0.9.7c
+BuildRequires: openssl-devel >= 0.9.7d
BuildRequires: readline-devel >= 4.2
+BuildRequires: rpmbuild(macros) >= 1.202
BuildRequires: zlib-devel
PreReq: rc-scripts
-Requires(pre): /usr/bin/getgid
Requires(pre): /bin/id
+Requires(pre): /usr/bin/getgid
Requires(pre): /usr/sbin/groupadd
Requires(pre): /usr/sbin/useradd
Requires(post,preun): /sbin/chkconfig
Requires(post,postun): /sbin/ldconfig
Requires(postun): /usr/sbin/groupdel
Requires(postun): /usr/sbin/userdel
+Provides: group(ntop)
+Provides: user(ntop)
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%description
%description -l pl
ntop to narzêdzie, które pokazuje u¿ycie sieci w podobny sposób jak
-robi to popularna Unixowa komenda top.
+robi to popularna uniksowa komenda top.
%prep
-%setup -q
-#%%patch0 -p1
-cd %{name}*
-%patch2 -p1
-cd ../gdchart*
+%setup -q -n %{name}
+%patch0 -p1
%patch1 -p1
+%patch2 -p1
%build
-cd gdchart*
-rm -rf gd-* zlib-*
-%{__libtoolize}
-%{__aclocal}
-%{__autoconf}
-%configure
-%{__make}
-
-cd ../%{name}*
#mv -f acinclude.m4.in acinclude.m4
-#rm -f missing
#%%{__libtoolize}
%{__aclocal}
%{__autoconf}
--with-gdchart-root=`pwd`/../gdchart0.94c \
--enable-tcpwrap \
--with-gnu-ld \
+ --enable-i18n \
+ --enable-showoses \
--localstatedir=%{_var}/lib/%{name} || true
%configure \
%{__make}
-cd plugins
-%{__make}
+%{__make} -C plugins
%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{%{_var}/lib/%{name},/etc/{rc.d/init.d,sysconfig}}
%{__make} install \
DESTDIR=$RPM_BUILD_ROOT
-#mv $RPM_BUILD_ROOT%{_bindir}/*.pem $RPM_BUILD_ROOT%{_datadir}/%{name}
-
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
+install packages/RedHat/ntop.conf.sample $RPM_BUILD_ROOT/etc/ntop.conf
+
+mv $RPM_BUILD_ROOT%{_libdir}/lib*Plugin*.so $RPM_BUILD_ROOT%{_libdir}/%{name}/plugins
+rm $RPM_BUILD_ROOT%{_libdir}/*.a
%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 /var/lib/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
%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
+ if [ -f /var/lock/subsys/ntop ]; then
+ /etc/rc.d/init.d/ntop stop 1>&2
+ fi
+ /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}
+%doc AUTHORS ChangeLog NEWS README THANKS
+%attr(770,root,ntop) %dir %{_var}/lib/%{name}
%attr(755,root,root) %{_bindir}/*
%attr(755,root,root) %{_libdir}/lib*
-#%attr(755,root,root) /usr/share/ntop/*
%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) /etc/ntop.conf
+%attr(750,root,ntop) %dir /etc/ntop
+%attr(640,root,ntop) %config(noreplace) %verify(not md5 mtime size) /etc/ntop/*
+%attr(644,root,ntop) %config(noreplace) %verify(not md5 mtime size) /etc/ntop.conf