File ntopng.spec of Package ntopng

%define svn_release 8116
Summary: Web-based traffic monitoring
Name: ntopng
Version: 1.2.0
Release: 1
License: GPL-3.0
Group: Networking/Utilities
Source: ntopng-%{version}_r%{svn_release}.tgz
Source1: ntopng-data-%{version}_r%{svn_release}.tgz
Patch0: 01-remove-runlevel-4-from-init.patch
Packager: Luca Deri <>
# Temporary location where the RPM will be built
BuildRoot:  %{_tmppath}/%{name}-%{version}-root
Requires: redis >= 2.4.0, GeoIP >= 1.4.8
BuildRequires: redis >= 2.4.0
BuildRequires: libpcap-devel
BuildRequires: libGeoIP-devel
BuildRequires: libxml2-devel
BuildRequires: glib2-devel
BuildRequires: gcc-c++
BuildRequires: sqlite3-devel
BuildRequires: fdupes
BuildRequires: automake
BuildRequires: autoconf
BuildRequires: libtool
BuildRequires: subversion
BuildRequires: groff

ntopng, the next generation version of the original ntop, a network traffic probe that shows the network usage, similar to what the popular top Unix command does. ntopng is based on libpcap and it has been written in a portable way in order to virtually run on every Unix platform, MacOSX and on Win32 as well.

%setup -q -n ntopng-%{version}
%patch0 -p1

CFLAGS="$RPM_OPT_FLAGS" ./configure

# Installation may be a matter of running an install make target or you
# may need to manually install files with the install command.
if [ -d $RPM_BUILD_ROOT ]; then
	\rm -rf $RPM_BUILD_ROOT
# "T.J. Yang" <>
mkdir -p $RPM_BUILD_ROOT/etc/ntopng
cat >$RPM_BUILD_ROOT/etc/ntopng/ntopng.conf.sample <<_EOT_
cat >$RPM_BUILD_ROOT/etc/ntopng/ntopng.start <<_EOT_
--local-networks “”
--interface 0

mkdir -p $RPM_BUILD_ROOT/usr/bin $RPM_BUILD_ROOT/usr/share/ntopng $RPM_BUILD_ROOT/usr/share/man/man8  $RPM_BUILD_ROOT/etc/init.d $RPM_BUILD_ROOT/usr/sbin
tar zxf %{S:1}
cp ntopng $RPM_BUILD_ROOT/usr/bin
cp ntopng.8 $RPM_BUILD_ROOT/usr/share/man/man8
cp -axR httpdocs scripts $RPM_BUILD_ROOT/usr/share/ntopng
%{__mv} ntopng-data-%{version}_r%{svn_release}/usr/local/share/ntopng/httpdocs/geoip/* $RPM_BUILD_ROOT/usr/share/ntopng/httpdocs/geoip/
chmod 644 $RPM_BUILD_ROOT/usr/share/ntopng/httpdocs/font-awesome/fonts/fontawesome-webfont.svg
cp packages/etc/init/ntopng.conf $RPM_BUILD_ROOT/etc/ntopng/
cp packages/etc/init.d/ntopng    $RPM_BUILD_ROOT/etc/init.d
find $RPM_BUILD_ROOT -name ".svn" | xargs /bin/rm -rf
find $RPM_BUILD_ROOT -name "*~"   | xargs /bin/rm -f
find $RPM_BUILD_ROOT/%{_datadir}/%{name} -name "*.js" -exec chmod 644 {} \;
find $RPM_BUILD_ROOT/%{_datadir}/%{name} -name "*.css" -exec chmod 644 {} \;
rm -f %{buildroot}/%{_datadir}/ntopng/scripts/lua/modules/redis.lua
#%{__ln_s} ../../usr/share/ntopng/third-party/redis-lua/src/redis.lua %{buildroot}/%{_datadir}/ntopng/scripts/lua/modules/redis.lua
%{__ln_s} ../../etc/init.d/ntopng "%{buildroot}/usr/sbin/rcntopng"
%fdupes %{buildroot}

# Clean out our build directory

%{?stop_on_removal:%stop_on_removal ntopng}

%restart_on_update ntopng

echo 'Setting up redis auto startup'
/sbin/chkconfig redis on

%defattr(-, root, root)
%dir %{_sysconfdir}/ntopng
%config %{_sysconfdir}/ntopng/ntopng.conf
%config %{_sysconfdir}/ntopng/ntopng.conf.sample
%config %{_sysconfdir}/ntopng/ntopng.start