File netdata.spec of Package netdata
#
# spec file for package netdata
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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/
#
%if 0%{?suse_version} > 1220
%bcond_without systemd
%else
%bcond_with systemd
%endif
%define netdata_user netdata
%define netdata_group netdata
Name: netdata
Version: 1.6.0
Release: 1
Summary: Real-time performance monitoring
# netdata is GPL-3.0+ other licenses refer to included third-party software (see LICENSE.md)
License: GPL-3.0+ and MIT and BSD-2-Clause and BSD-3-Clause and LGPL-2.1 and OFL-1.1 and CC0-1.0
Group: System/Monitoring
Url: http://my-netdata.io/
Source0: https://github.com/firehol/netdata/releases/download/v%{version}/netdata-%{version}.tar.gz
Source1: netdata.service
Source2: netdata.init
Source3: netdata.logrotate
Source4: netdata-rpmlintrc
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: dos2unix
BuildRequires: fdupes
BuildRequires: libmnl-devel
BuildRequires: libnetfilter_acct-devel
BuildRequires: libuuid-devel
BuildRequires: zlib-devel
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Requires(pre): shadow
%description
netdata is a highly optimized Linux daemon providing real-time performance monitoring for Linux systems, Applications, SNMP devices, over the web!
%prep
%setup -q
dos2unix web/lib/tableExport-1.6.0.min.js
%build
autoreconf -fi
%configure \
--docdir="%{_docdir}/%{name}-%{version}" \
--enable-plugin-nfacct \
--with-zlib \
--with-math \
--with-user=netdata \
%{?conf}
make %{?_smp_mflags}
%install
%make_install
find %{buildroot} -name .keep -delete
%fdupes -s %{buildroot}
%if %{with systemd}
install -D -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service
ln -s -f %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}
%else
install -D -m 0755 %{SOURCE2} %{buildroot}%{_sysconfdir}/init.d/%{name}
ln -s -f %{_sysconfdir}/init.d/%{name} %{buildroot}%{_sbindir}/rc%{name}
%endif
install -D -m 0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
%pre
getent group %{netdata_group} >/dev/null || \
%{_sbindir}/groupadd -r %{netdata_group}
getent passwd %{netdata_user} >/dev/null || \
%{_sbindir}/useradd -r -g %{netdata_group} -s /bin/false \
-c "netdata daemon user" -d %{_localstatedir}/lib/empty %{netdata_user}
%{_sbindir}/usermod -g %{netdata_group} %{netdata_user} >/dev/null
%if %{with systemd}
%service_add_pre %{name}.service
%endif
%post
%if %{with systemd}
%service_add_post %{name}.service
%else
%fillup_and_insserv %{name}
%endif
%preun
%if %{with systemd}
%service_del_preun %{name}.service
%else
%stop_on_removal %{name}
%endif
%postun
%if %{with systemd}
%service_del_postun %{name}.service
%else
%restart_on_update %{name}
%insserv_cleanup
%endif
%files
%defattr(-,root,root)
%doc ChangeLog COPYING LICENSE.md README.md
%attr(750, %{netdata_user},root ) %dir %{_localstatedir}/cache/%{name}/
%attr(750, %{netdata_user},root ) %dir %{_localstatedir}/log/%{name}/
%attr(750, root,%{netdata_group} ) %dir %{_sysconfdir}/%{name}/
%attr(755, root,%{netdata_group} ) %dir %{_datadir}/%{name}
%attr(755, root,%{netdata_group} ) %dir %{_datadir}/%{name}/*
%attr(755, root,%{netdata_group} ) %dir %{_datadir}/%{name}/web/*
%attr(644, root,%{netdata_group} ) %{_datadir}/%{name}/web/*
%attr(644, root,%{netdata_group} ) %{_datadir}/%{name}/web/*/*
%config(noreplace) %{_sysconfdir}/%{name}/*
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%{_sbindir}/%{name}
%{_sbindir}/rc%{name}
%{_datadir}/%{name}/
%{_libexecdir}/%{name}/
%if %{with systemd}
%{_unitdir}/%{name}.service
%else
%{_sysconfdir}/init.d/%{name}
%endif
%{_datadir}/%{name}/
%changelog