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