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