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