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