File netatop.spec of Package netatop
#
# spec file for package netatop
#
# Copyright (c) 2014-2023 Malcolm J Lewis <malcolmlewis@opensuse.org>
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: netatop
Version: 3.1
Release: 0
Summary: Kernel module to gather statistics for atop
License: GPL-2.0
Group: System/Kernel
Url: http://www.atoptool.nl/netatop.php
Source0: http://www.atoptool.nl/download/netatop-3.1.tar.gz
Source1: preamble
Source2: netatop.conf
Source3: netatopd.service
# PATCH-FIX-OPENSUSE netatop-add-optflags.patch malcolmlewis@opensuse.org -- Add rpm optflags when building netatopd.
Patch0: netatop-add-optflags.patch
BuildRequires: %{kernel_module_package_buildreqs}
BuildRequires: kernel-source
BuildRequires: kernel-syms
BuildRequires: libelf-devel
BuildRequires: module-init-tools
BuildRequires: systemd
BuildRequires: zlib-devel
%suse_kernel_module_package -p %_sourcedir/preamble -x default
%description
This optional kernel module can be loaded to gather statistics about the
TCP and UDP packets that have been transmitted/received per process and per
thread.
%prep
%autosetup -p1
set -- *
mkdir source
mv "$@" source/
mkdir obj
%build
export EXTRA_CFLAGS='-DVERSION=\"%version\"'
export KBUILD_NOPEDANTIC=1
export CFLAGS="%{optflags}"
for flavor in %flavors_to_build; do
rm -rf obj/$flavor
cp -r source obj/$flavor
make -C /usr/src/linux-obj/%_target_cpu/$flavor modules \
M=$PWD/obj/$flavor/module
done
make -C $PWD/source/daemon
%install
export INSTALL_MOD_PATH=%{buildroot}
export INSTALL_MOD_DIR=updates
for flavor in %flavors_to_build; do
make -C /usr/src/linux-obj/%_target_cpu/$flavor modules_install \
M=$PWD/obj/$flavor/module
done
install -Dm0644 %{S:2} %{buildroot}/usr/lib/modules-load.d/netatop.conf
install -Dm0755 $PWD/source/daemon/netatopd %{buildroot}%{_sbindir}/netatopd
install -Dm0644 %{S:3} %{buildroot}%{_unitdir}/netatopd.service
install -Dm0644 source/man/netatop.4 %{buildroot}%{_mandir}/man4/netatop.4
install -Dm0644 source/man/netatopd.8 %{buildroot}%{_mandir}/man8/netatopd.8
pushd %{buildroot}%{_sbindir}
ln -s service rcnetatopd
popd
%preun
%service_del_preun netatopd.service
%postun
%service_del_postun netatopd.service
%pre
%service_add_pre netatopd.service
%post
%service_add_post netatopd.service
%files
%doc source/ChangeLog
%{_unitdir}/netatopd.service
%{_sbindir}/netatopd
%{_sbindir}/rcnetatopd
/usr/lib/modules-load.d/netatop.conf
%{_mandir}/man4/netatop.4%{?ext_man}
%{_mandir}/man8/netatopd.8%{?ext_man}
%changelog