]> arthur.barton.de Git - netdata.git/blobdiff - netdata.spec.in
Merge pull request #172 from mcnewton/infiles
[netdata.git] / netdata.spec.in
index 486dcf7313d4ca626ae0e08373dc4e9b0cbd7701..507806ba8b3dd698257d6d027565ce4068cd9628 100644 (file)
@@ -1,3 +1,9 @@
+%if 0%{?fedora} || 0%{?rhel} >= 7
+%global do_systemd 1
+%else
+%global do_systemd 0
+%endif
+
 Summary:       Linux real time system monitoring, over the web
 Name:          @PACKAGE_NAME@
 Version:       @PACKAGE_RPM_VERSION@
@@ -7,21 +13,38 @@ URL:         http://firehol.org
 Source:                %{name}-@PACKAGE_VERSION@.tar.bz2
 
 BuildRequires: libmnl-devel
-BuildRequires: libnetfilter_acct-devel
 BuildRequires: zlib-devel
 Requires:      libmnl
-Requires:      libnetfilter_acct
 Requires:      zlib
+%if !0%{?rhel}
+BuildRequires: libnetfilter_acct-devel
+Requires:      libnetfilter_acct
+%endif
+%if 0%{do_systemd}
+BuildRequires:         systemd
+Requires(post):                systemd
+Requires(preun):       systemd
+Requires(postun):      systemd
+%endif
 
 BuildRoot:     %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 %description
-Linux real time system monitoring, over the web!
+Real-time performance monitoring, in the greatest possible detail!
 
 %pre
 getent group netdata > /dev/null || groupadd -r netdata
 getent passwd netdata > /dev/null || useradd -r -g netdata -c netdata -s /sbin/nologin -d / netdata
 
+%if 0%{do_systemd}
+%post
+%systemd_post netdata.service
+%preun
+%systemd_preun netdata.service
+%postun
+%systemd_postun_with_restart netdata.service
+%endif
+
 %global ovirt_create_user_engine \
 %_ovirt_create_user %{engine_user} %{engine_uid} %{engine_group} %{engine_gid} "%{ovirt_user_description}" %{engine_state}
 
@@ -32,10 +55,12 @@ getent passwd netdata > /dev/null || useradd -r -g netdata -c netdata -s /sbin/n
 %build
 %configure \
        --docdir="%{_docdir}/%{name}-%{version}" \
-       --enable-plugin-nfacct \
        --with-zlib \
        --with-math \
        --with-user=netdata \
+%if !0%{?rhel}
+       --enable-plugin-nfacct \
+%endif
        %{?conf}
 make %{?_smp_mflags}
 
@@ -44,14 +69,25 @@ rm -rf "%{buildroot}"
 make %{?_smp_mflags} install DESTDIR="%{buildroot}"
 find "%{buildroot}" -name .keep -exec rm {} \;
 
+%if 0%{do_systemd}
+install -m 0755 -d "%{buildroot}/%{_unitdir}"
+install -m 0644 system/netdata.service "%{buildroot}/%{_unitdir}"
+%endif
+
 %files
 %attr(-, netdata, netdata) %dir %{_localstatedir}/cache/%{name}/
 %attr(-, netdata, netdata) %dir %{_localstatedir}/log/%{name}/
-%{_bindir}/%{name}
+%config(noreplace) %{_sysconfdir}/%{name}/
 %{_datadir}/%{name}/
 %{_libexecdir}/%{name}/
-%{_sysconfdir}/%{name}/
+%{_sbindir}/%{name}
+
+%if 0%{do_systemd}
+%{_unitdir}/netdata.service
+%endif
 
 %changelog
-* Sun Nov 15 2015 Alon Bar-Lev <alonbl@redhat.com> - 1.0.0-1
+* Tue Mar 22 2016 Costa Tsaousis <costa@tsaousis.gr> - 1.0.0-1
+- First public release.
+* Sun Nov 15 2015 Alon Bar-Lev <alonbl@redhat.com> - 0.0.0-1
 - Initial add.