summaryrefslogtreecommitdiffstats
path: root/netdata.spec.in
diff options
context:
space:
mode:
authorAlon Bar-Lev <alon.barlev@gmail.com>2016-04-02 19:36:38 +0300
committerAlon Bar-Lev <alon.barlev@gmail.com>2016-04-02 23:27:01 +0300
commit8443257227f6670abaf630280c168764666fc161 (patch)
treeec91c538e62e772feb9adeb7f7fe7f080997d853 /netdata.spec.in
parent68dc76f15db28dd0cb4874ffa7a4f725b429cadb (diff)
spec: install systemd unit
Thanks-To: sketch242 <github@rednsx.org> Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
Diffstat (limited to 'netdata.spec.in')
-rw-r--r--netdata.spec.in30
1 files changed, 30 insertions, 0 deletions
diff --git a/netdata.spec.in b/netdata.spec.in
index 53841acdd4..507806ba8b 100644
--- a/netdata.spec.in
+++ b/netdata.spec.in
@@ -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@
@@ -14,6 +20,12 @@ Requires: zlib
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)
@@ -24,6 +36,15 @@ Real-time performance monitoring, in the greatest possible detail!
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}
@@ -48,6 +69,11 @@ 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}/
@@ -56,6 +82,10 @@ find "%{buildroot}" -name .keep -exec rm {} \;
%{_libexecdir}/%{name}/
%{_sbindir}/%{name}
+%if 0%{do_systemd}
+%{_unitdir}/netdata.service
+%endif
+
%changelog
* Tue Mar 22 2016 Costa Tsaousis <costa@tsaousis.gr> - 1.0.0-1
- First public release.