A new user interface for you! Read more...

File atop.spec of Package atop

# vim: set ts=4 sw=4 et:

# Copyright (c) 2012 Pascal Bleser <pascal.bleser@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:           atop
Version:        2.2
%define pkg_version %{version}-3
Release:        0
Summary:        Monitor for System Resources and Process Activity
Source:         http://www.atoptool.nl/download/atop-%{pkg_version}.tar.gz
Source1:        atop.desktop
Source99:       atop-rpmlintrc
Patch1:         atop-makefile.patch
URL:            http://www.atoptool.nl/
Group:          System/Monitoring
License:        GPL-2.0
BuildRoot:      %{_tmppath}/build-%{name}-%{version}
BuildRequires:  ncurses-devel make glibc-devel gcc
BuildRequires:  zlib-devel
BuildRequires:  systemd-rpm-macros
%if 0%{?suse_version:1}
BuildRequires:  update-desktop-files
%endif
%{?systemd_requires}

%description
Atop is an ASCII full-screen performance monitor, similar to the top
command. At regular intervals, it shows system-level activity related to
the CPU, memory, swap, disks and network layers, and it shows for every
active process the CPU utilization in system and user mode, the virtual
and resident memory growth, priority, username, state, and exit code. The
process level activity is also shown for processes which finished during
the last interval, to get a complete overview about the consumers of things
such as CPU time. Atop only shows the active system-resources and processes,
and only shows the deviations since the previous interval.

%package daemon
Summary:        System Resource and Process Monitoring History Daemon
Group:          System/Monitoring
Requires:       %{name} = %{version}-%{release}
Recommends:     logrotate
Recommends:     cron

%description daemon
Atop is an ASCII full-screen performance monitor, similar to the top
command. At regular intervals, it shows system-level activity related to
the CPU, memory, swap, disks and network layers, and it shows for every
active process the CPU utilization in system and user mode, the virtual
and resident memory growth, priority, username, state, and exit code. The
process level activity is also shown for processes which finished during
the last interval, to get a complete overview about the consumers of things
such as CPU time. Atop only shows the active system-resources and processes,
and only shows the deviations since the previous interval.

This subpackage contains the permanent monitoring daemon, to store history
information about processes and system resources.

%prep
%setup -q -n "%{name}-%{pkg_version}"
%patch1

%build
%__make %{?_smp_mflags} \
    	  OPTFLAGS="%{optflags} -fstack-protector" \
    	  CC="%__cc" \
    	  INIPATH=/etc/init.d

%install
%__install -d "%{buildroot}%{_sbindir}"
make systemdinstall DESTDIR=%{buildroot}

%__rm -f "%{buildroot}%{_localstatedir}/log/atop"/*

%__install -D -m0644 "atop.service" "%{buildroot}%{_usr}/lib/systemd/system/%{name}.service"

%__install -D -m 0644 atop.cronsystemd "%{buildroot}/etc/cron.d/%{name}"

%__install -D -m 0644 "%{SOURCE1}" "%{buildroot}%{_datadir}/applications/%{name}.desktop"
%if 0%{?suse_update_desktop_file:1}
%suse_update_desktop_file -r "%{name}" System Monitor
%endif

ln -s /usr/sbin/service %{buildroot}%{_sbindir}/rc%{name}
ln -s /usr/sbin/service %{buildroot}%{_sbindir}/rcatopacct

%pre daemon
%service_add_pre atop.service atopacct.service

%post daemon
%service_add_post atop.service atopacct.service

%postun daemon
%service_del_postun atop.service atopacct.service

%preun daemon
%service_del_preun atop.service atopacct.service

%files
%defattr(-,root,root)
%doc COPYING README
%attr(0755,root,root) %{_bindir}/atop
%{_bindir}/atopsar
%{_bindir}/atop-%{pkg_version}
%{_bindir}/atopsar-%{pkg_version}
%doc %{_mandir}/man1/atop.1*
%doc %{_mandir}/man1/atopsar.1*
%doc %{_mandir}/man5/atoprc.5*
%{_datadir}/applications/%{name}.desktop

%files daemon
%defattr(-,root,root)
%doc COPYING README
%attr(0700,root,root) %dir %{_sysconfdir}/atop
%attr(0700,root,root) %{_sysconfdir}/atop/atop.daily
%config(noreplace) /etc/logrotate.d/psaccs_atop
%config(noreplace) /etc/logrotate.d/psaccu_atop
%config(noreplace) /etc/cron.d/%{name}
%{_localstatedir}/log/atop
%{_usr}/lib/systemd/system/%{name}.service
%doc %{_mandir}/man8/atopacctd.8*
%{_usr}/lib/systemd/system/atopacct.service
%dir %{_usr}/lib/systemd/system-sleep
%{_usr}/lib/systemd/system-sleep/atop-pm.sh
%{_sbindir}/atopacctd
%{_sbindir}/rcatopacct
%{_sbindir}/rc%{name}

%changelog