]> arthur.barton.de Git - netdata.git/blob - netdata.spec.in
spec: install systemd unit
[netdata.git] / netdata.spec.in
1 %if 0%{?fedora} || 0%{?rhel} >= 7
2 %global do_systemd 1
3 %else
4 %global do_systemd 0
5 %endif
6
7 Summary:        Linux real time system monitoring, over the web
8 Name:           @PACKAGE_NAME@
9 Version:        @PACKAGE_RPM_VERSION@
10 Release:        @PACKAGE_RPM_RELEASE@%{?release_suffix}%{?dist}
11 License:        GPLv2+
12 URL:            http://firehol.org
13 Source:         %{name}-@PACKAGE_VERSION@.tar.bz2
14
15 BuildRequires:  libmnl-devel
16 BuildRequires:  zlib-devel
17 Requires:       libmnl
18 Requires:       zlib
19 %if !0%{?rhel}
20 BuildRequires:  libnetfilter_acct-devel
21 Requires:       libnetfilter_acct
22 %endif
23 %if 0%{do_systemd}
24 BuildRequires:          systemd
25 Requires(post):         systemd
26 Requires(preun):        systemd
27 Requires(postun):       systemd
28 %endif
29
30 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
31
32 %description
33 Real-time performance monitoring, in the greatest possible detail!
34
35 %pre
36 getent group netdata > /dev/null || groupadd -r netdata
37 getent passwd netdata > /dev/null || useradd -r -g netdata -c netdata -s /sbin/nologin -d / netdata
38
39 %if 0%{do_systemd}
40 %post
41 %systemd_post netdata.service
42 %preun
43 %systemd_preun netdata.service
44 %postun
45 %systemd_postun_with_restart netdata.service
46 %endif
47
48 %global ovirt_create_user_engine \
49 %_ovirt_create_user %{engine_user} %{engine_uid} %{engine_group} %{engine_gid} "%{ovirt_user_description}" %{engine_state}
50
51
52 %prep
53 %setup -q -n %{name}-@PACKAGE_VERSION@
54
55 %build
56 %configure \
57         --docdir="%{_docdir}/%{name}-%{version}" \
58         --with-zlib \
59         --with-math \
60         --with-user=netdata \
61 %if !0%{?rhel}
62         --enable-plugin-nfacct \
63 %endif
64         %{?conf}
65 make %{?_smp_mflags}
66
67 %install
68 rm -rf "%{buildroot}"
69 make %{?_smp_mflags} install DESTDIR="%{buildroot}"
70 find "%{buildroot}" -name .keep -exec rm {} \;
71
72 %if 0%{do_systemd}
73 install -m 0755 -d "%{buildroot}/%{_unitdir}"
74 install -m 0644 system/netdata.service "%{buildroot}/%{_unitdir}"
75 %endif
76
77 %files
78 %attr(-, netdata, netdata) %dir %{_localstatedir}/cache/%{name}/
79 %attr(-, netdata, netdata) %dir %{_localstatedir}/log/%{name}/
80 %config(noreplace) %{_sysconfdir}/%{name}/
81 %{_datadir}/%{name}/
82 %{_libexecdir}/%{name}/
83 %{_sbindir}/%{name}
84
85 %if 0%{do_systemd}
86 %{_unitdir}/netdata.service
87 %endif
88
89 %changelog
90 * Tue Mar 22 2016 Costa Tsaousis <costa@tsaousis.gr> - 1.0.0-1
91 - First public release.
92 * Sun Nov 15 2015 Alon Bar-Lev <alonbl@redhat.com> - 0.0.0-1
93 - Initial add.