]> arthur.barton.de Git - netdata.git/blob - netdata.spec.in
spec: reduce conditionals in body
[netdata.git] / netdata.spec.in
1 %global contentdir %{_datadir}/netdata
2
3 # This is temporary and should eventually be resolved. This bypasses
4 # the default rhel __os_install_post which throws a python compile
5 # error.
6 %global __os_install_post %{nil}
7
8 #
9 # Conditional build:
10 %bcond_without  systemd  # systemd
11 %bcond_with     nfacct   # build with nfacct plugin
12
13 %if 0%{?fedora} || 0%{?rhel} >= 7 || 0%{?suse_version} >= 1140
14 %else
15 %undefine       with_systemd
16 %endif
17
18 %if %{with systemd}
19 %if 0%{?suse_version}
20 %global netdata_initd_buildrequires \
21 BuildRequires: systemd-rpm-macros \
22 %{nil}
23 %global netdata_initd_requires \
24 %{?systemd_requires} \
25 %{nil}
26 %global netdata_init_post %service_add_post netdata.service
27 %global netdata_init_preun %service_del_preun netdata.service
28 %global netdata_init_postun %service_del_postun netdata.service
29 %else
30 %global netdata_initd_buildrequires %{nil}
31 %global netdata_initd_requires \
32 Requires(preun):  systemd-units \
33 Requires(postun): systemd-units \
34 Requires(post):   systemd-units \
35 %{nil}
36 %global netdata_init_post %systemd_post netdata.service
37 %global netdata_init_preun %systemd_preun netdata.service
38 %global netdata_init_postun %systemd_postun_with_restart netdata.service
39 %endif
40 %else
41 %global netdata_initd_buildrequires %{nil}
42 %global netdata_initd_requires \
43 Requires(post):   chkconfig \
44 %{nil}
45 %global netdata_init_post \
46 /sbin/chkconfig --add netdata \
47 %{nil}
48 %global netdata_init_preun %{nil} \
49 if [ $1 = 0 ]; then \
50         /sbin/service netdata stop > /dev/null 2>&1 \
51         /sbin/chkconfig --del netdata \
52 fi \
53 %{nil}
54 %global netdata_init_postun %{nil} \
55 if [ $1 != 0 ]; then \
56         /sbin/service netdata condrestart 2>&1 > /dev/null \
57 fi \
58 %{nil}
59 %endif
60
61 %if 0%{?_fedora}
62 %global netdata_recommends \
63 Recommends:     curl \
64 Recommends:     iproute-tc \
65 Recommends:     lm_sensors \
66 Recommends:     nmap-ncat \
67 Recommends:     nodejs \
68 Recommends:     python \
69 Recommends:     PyYAML \
70 Recommends:     python2-PyMySQL \
71 Recommends:     python2-psycopg2 \
72 %{nil}
73 %else
74 %global netdata_recommends %{nil}
75 %endif
76
77 Summary:        Real-time performance monitoring, done right
78 Name:           @PACKAGE_NAME@
79 Version:        @PACKAGE_RPM_VERSION@
80 Release:        1%{?dist}
81 License:        GPL v3+
82 Group:          Applications/System
83 Source0:        http://firehol.org/download/netdata/releases/v@PACKAGE_VERSION@/%{name}-@PACKAGE_VERSION@.tar.xz
84 URL:            http://my-netdata.io/
85 BuildRequires:  pkgconfig
86 BuildRequires:  xz
87 BuildRequires:  zlib-devel
88 BuildRequires:  libuuid-devel
89 Requires:       zlib
90 Requires:       libuuid
91 Requires(post): libcap
92
93 # Packages can be found in the EPEL repo
94 %if %{with nfacct}
95 BuildRequires:  libmnl-devel
96 BuildRequires:  libnetfilter_acct-devel
97 Requires: libmnl
98 Requires: libnetfilter_acct
99 %endif
100
101 Requires(pre): /usr/sbin/groupadd
102 Requires(pre): /usr/sbin/useradd
103 Requires(post): libcap
104
105 %{netdata_initd_buildrequires}
106 %{netdata_recommends}
107 %{netdata_initd_requires}
108
109 %description
110 netdata is the fastest way to visualize metrics. It is a resource
111 efficient, highly optimized system for collecting and visualizing any
112 type of realtime timeseries data, from CPU usage, disk activity, SQL
113 queries, API calls, web site visitors, etc.
114
115 netdata tries to visualize the truth of now, in its greatest detail,
116 so that you can get insights of what is happening now and what just
117 happened, on your systems and applications.
118
119 %prep
120 %setup -q -n @PACKAGE_NAME@-@PACKAGE_VERSION@
121
122 %build
123 %configure \
124         --with-zlib \
125         --with-math \
126         %{?with_nfacct:--enable-plugin-nfacct} \
127         --with-user=netdata
128 %{__make} %{?_smp_mflags}
129
130 %install
131 rm -rf "${RPM_BUILD_ROOT}"
132 %{__make} %{?_smp_mflags} DESTDIR="${RPM_BUILD_ROOT}" install
133
134 find "${RPM_BUILD_ROOT}" -name .keep -delete
135
136 install -m 644 -p system/netdata.conf "${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}"
137 install -m 755 -d "${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d"
138 install -m 644 -p system/netdata.logrotate "${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d/%{name}"
139
140 %if %{with systemd}
141 install -m 755 -d "${RPM_BUILD_ROOT}%{_unitdir}"
142 install -m 644 -p system/netdata.service "${RPM_BUILD_ROOT}%{_unitdir}/netdata.service"
143 %else
144 # install SYSV init stuff
145 install -d "${RPM_BUILD_ROOT}/etc/rc.d/init.d"
146 install -m 755 system/netdata-init-d \
147         "${RPM_BUILD_ROOT}/etc/rc.d/init.d/netdata"
148 %endif
149
150 %pre
151 getent group netdata >/dev/null || groupadd -r netdata
152 getent group docker >/dev/null || groupadd -r docker
153 getent passwd netdata >/dev/null || \
154   useradd -r -g netdata -G docker -s /sbin/nologin \
155     -d %{contentdir} -c "netdata" netdata
156
157 %post
158 %{netdata_init_post}
159
160 %preun
161 %{netdata_init_preun}
162
163 %postun
164 %{netdata_init_postun}
165
166 %clean
167 rm -rf "${RPM_BUILD_ROOT}"
168
169 %files
170 %doc README.md
171 %defattr(-,root,root)
172
173 %dir %{_sysconfdir}/%{name}
174
175 %config(noreplace) %{_sysconfdir}/%{name}/*.conf
176 %config(noreplace) %{_sysconfdir}/%{name}/charts.d/*.conf
177 %config(noreplace) %{_sysconfdir}/%{name}/health.d/*.conf
178 #%%config(noreplace) %{_sysconfdir}/%{name}/node.d/*.conf
179 %config(noreplace) %{_sysconfdir}/%{name}/python.d/*.conf
180 %config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
181
182 # To be eventually moved to %%_defaultdocdir
183 %{_sysconfdir}/%{name}/node.d/*.md
184 %{_libexecdir}/%{name}
185 %{_sbindir}/%{name}
186
187 %caps(cap_dac_read_search,cap_sys_ptrace=ep) %attr(0555,root,root) %{_libexecdir}/%{name}/plugins.d/apps.plugin
188
189 %attr(0700,netdata,netdata) %dir %{_localstatedir}/cache/%{name}
190 %attr(0700,netdata,netdata) %dir %{_localstatedir}/log/%{name}
191 %attr(0700,netdata,netdata) %dir %{_localstatedir}/lib/%{name}
192
193 %dir %{_datadir}/%{name}
194 %dir %{_sysconfdir}/%{name}/health.d
195 %dir %{_sysconfdir}/%{name}/python.d
196
197 %if %{with systemd}
198 %{_unitdir}/netdata.service
199 %else
200 %{_sysconfdir}/rc.d/init.d/netdata
201 %endif
202
203 # Enforce 0644 for files and 0755 for directories
204 # for the netdata web directory
205 %defattr(0644,root,netdata,0755)
206 %{_datadir}/%{name}/web
207
208 %changelog
209 * Sun Jan 22 2017 Costa Tsaousis <costa@tsaousis.gr> - 1.5.0-1
210 - FreeBSD, MacOS, FreeNAS
211 - Backends support
212 - dozens of new and improved plugins
213 - dozens of new and improved alarms and notification methods
214 * Tue Oct 4 2016 Costa Tsaousis <costa@tsaousis.gr> - 1.4.0-1
215 - the fastest netdata ever (with a better look too)!
216 - improved IoT and containers support!
217 - alarms improved in almost every way!
218 - Several more improvements, new features and bugfixes.
219 * Sun Aug 28 2016 Costa Tsaousis <costa@tsaousis.gr> - 1.3.0-1
220 - netdata now has health monitoring
221 - netdata now generates badges
222 - netdata now has python plugins
223 - Several more improvements, new features and bugfixes.
224 * Tue Jul 26 2016 Jason Barnett <J@sonBarnett.com> - 1.2.0-2
225 - Added support for EL6
226 - Corrected several Requires statements
227 - Changed default to build without nfacct
228 - Removed --docdir from configure
229 * Mon May 16 2016 Costa Tsaousis <costa@tsaousis.gr> - 1.2.0-1
230 - netdata is now 30% faster.
231 - netdata now has a registry (my-netdata menu on the dashboard).
232 - netdata now monitors Linux containers.
233 - Several more improvements, new features and bugfixes.
234 * Wed Apr 20 2016 Costa Tsaousis <costa@tsaousis.gr> - 1.1.0-1
235 - Several new features (IPv6, SYNPROXY, Users, Users Groups).
236 - A lot of bug fixes and optimizations.
237 * Tue Mar 22 2016 Costa Tsaousis <costa@tsaousis.gr> - 1.0.0-1
238 - First public release.
239 * Sun Nov 15 2015 Alon Bar-Lev <alonbl@redhat.com> - 0.0.0-1
240 - Initial add.