summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--netdata.spec.in42
1 files changed, 27 insertions, 15 deletions
diff --git a/netdata.spec.in b/netdata.spec.in
index 4012fb7fc5..f829f8737a 100644
--- a/netdata.spec.in
+++ b/netdata.spec.in
@@ -1,4 +1,15 @@
%define contentdir %{_datadir}/netdata
+%if 0%{?suse_version}
+%define distro_post %service_add_post netdata.service
+%define distro_preun %service_del_preun netdata.service
+%define distro_postun %service_del_postun netdata.service
+%define distro_buildrequires BuildRequires:\ systemd-rpm-macros
+%else
+%define distro_post %systemd_post netdata.service
+%define distro_preun %systemd_preun netdata.service
+%define distro_postun %systemd_postun_with_restart netdata.service
+%define distro_buildrequires %{nil}
+%endif
# This is temporary and should eventually be resolved. This bypasses
# the default rhel __os_install_post which throws a python compile
@@ -10,7 +21,7 @@
%bcond_without systemd # systemd
%bcond_with nfacct # build with nfacct plugin
-%if 0%{?fedora} || 0%{?rhel} >= 7
+%if 0%{?fedora} || 0%{?rhel} >= 7 || 0%{?suse_version} >= 1140
%else
%undefine with_systemd
%endif
@@ -23,6 +34,7 @@ License: GPL v3+
Group: Applications/System
Source0: http://firehol.org/download/netdata/releases/v@PACKAGE_VERSION@/%{name}-@PACKAGE_VERSION@.tar.xz
URL: http://my-netdata.io/
+%distro_buildrequires
BuildRequires: pkgconfig
BuildRequires: xz
BuildRequires: zlib-devel
@@ -42,15 +54,17 @@ Requires(pre): /usr/sbin/groupadd
Requires(pre): /usr/sbin/useradd
%if %{with systemd}
+%if 0%{?suse_version}
+%{?systemd_requires}
+%else
Requires(preun): systemd-units
Requires(postun): systemd-units
Requires(post): systemd-units
+%endif
%else
Requires(post): chkconfig
%endif
-BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
-
%description
netdata is the fastest way to visualize metrics. It is a resource
efficient, highly optimized system for collecting and visualizing any
@@ -62,7 +76,7 @@ so that you can get insights of what is happening now and what just
happened, on your systems and applications.
%prep
-%setup -q -n %{name}-@PACKAGE_VERSION@
+%setup -q
%build
%configure \
@@ -76,11 +90,10 @@ happened, on your systems and applications.
rm -rf $RPM_BUILD_ROOT
%{__make} %{?_smp_mflags} DESTDIR=$RPM_BUILD_ROOT install
-find $RPM_BUILD_ROOT -name .keep -print0 | xargs --null --no-run-if-empty rm
+find $RPM_BUILD_ROOT -name .keep -delete
install -m 644 -p system/netdata.conf $RPM_BUILD_ROOT%{_sysconfdir}/%{name}
-
-mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d
+install -d $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d
install -m 644 -p system/netdata.logrotate $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/%{name}
%if %{with systemd}
@@ -88,7 +101,7 @@ install -d $RPM_BUILD_ROOT%{_unitdir}
install -m 644 -p system/netdata.service $RPM_BUILD_ROOT%{_unitdir}/netdata.service
%else
# install SYSV init stuff
-mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d
+install -d $RPM_BUILD_ROOT/etc/rc.d/init.d
install -m755 system/netdata-init-d \
$RPM_BUILD_ROOT/etc/rc.d/init.d/netdata
%endif
@@ -101,13 +114,13 @@ install -m755 system/netdata-init-d \
-s /sbin/nologin -r -d %{contentdir} netdata 2> /dev/null || :
%post
-%systemd_post netdata.service
+%distro_post
%preun
-%systemd_preun netdata.service
+%distro_preun
%postun
-%systemd_postun_with_restart netdata.service
+%distro_postun
%else
%pre
# Add the "netdata" user
@@ -150,6 +163,7 @@ rm -rf $RPM_BUILD_ROOT
%defattr(-,root,root)
%dir %{_sysconfdir}/%{name}
+
%config(noreplace) %{_sysconfdir}/%{name}/*.conf
#%config(noreplace) %{_sysconfdir}/%{name}/charts.d/*.conf
%config(noreplace) %{_sysconfdir}/%{name}/health.d/*.conf
@@ -157,10 +171,6 @@ rm -rf $RPM_BUILD_ROOT
%config(noreplace) %{_sysconfdir}/%{name}/python.d/*.conf
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
-# node.js config files are JSON (which do not support comments)
-# so, we only supply markdown files
-%{_sysconfdir}/%{name}/node.d/*.md
-
%{_libexecdir}/%{name}
%{_sbindir}/%{name}
@@ -169,6 +179,8 @@ rm -rf $RPM_BUILD_ROOT
%attr(0700,netdata,netdata) %dir %{_localstatedir}/lib/%{name}
%dir %{_datadir}/%{name}
+%dir %{_sysconfdir}/%{name}/health.d
+%dir %{_sysconfdir}/%{name}/python.d
%if %{with systemd}
%{_unitdir}/netdata.service