]> arthur.barton.de Git - netdata.git/blob - netdata.spec.in
Merge pull request #1132 from x4FF3/master
[netdata.git] / netdata.spec.in
1 %define 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 %define __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
14 %else
15 %undefine       with_systemd
16 %endif
17
18 Summary:        Real-time performance monitoring, done right
19 Name:           @PACKAGE_NAME@
20 Version:        @PACKAGE_RPM_VERSION@
21 Release:        1%{?dist}
22 License:        GPL v3+
23 Group:          Applications/System
24 Source0:        http://firehol.org/download/netdata/releases/v@PACKAGE_VERSION@/%{name}-@PACKAGE_VERSION@.tar.xz
25 URL:            http://my-netdata.io/
26 BuildRequires:  pkgconfig
27 BuildRequires:  xz
28 BuildRequires:  zlib-devel
29 BuildRequires:  libuuid-devel
30 Requires: zlib
31 Requires: libuuid
32
33 # Packages can be found in the EPEL repo
34 %if %{with nfacct}
35 BuildRequires:  libmnl-devel
36 BuildRequires:  libnetfilter_acct-devel
37 Requires: libmnl
38 Requires: libnetfilter_acct
39 %endif
40
41 Requires(pre): /usr/sbin/groupadd
42 Requires(pre): /usr/sbin/useradd
43
44 %if %{with systemd}
45 Requires(preun):  systemd-units
46 Requires(postun): systemd-units
47 Requires(post):   systemd-units
48 %else
49 Requires(post):   chkconfig
50 %endif
51
52 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
53
54 %description
55 netdata is the fastest way to visualize metrics. It is a resource
56 efficient, highly optimized system for collecting and visualizing any
57 type of realtime timeseries data, from CPU usage, disk activity, SQL
58 queries, API calls, web site visitors, etc.
59
60 netdata tries to visualize the truth of now, in its greatest detail,
61 so that you can get insights of what is happening now and what just
62 happened, on your systems and applications.
63
64 %prep
65 %setup -q -n %{name}-@PACKAGE_VERSION@
66
67 %build
68 %configure \
69         --with-zlib \
70         --with-math \
71         %{?with_nfacct:--enable-plugin-nfacct} \
72         --with-user=netdata
73 %{__make} %{?_smp_mflags}
74
75 %install
76 rm -rf $RPM_BUILD_ROOT
77 %{__make} %{?_smp_mflags} DESTDIR=$RPM_BUILD_ROOT install
78
79 find $RPM_BUILD_ROOT -name .keep -print0 | xargs --null --no-run-if-empty rm
80
81 install -m 644 -p system/netdata.conf $RPM_BUILD_ROOT%{_sysconfdir}/%{name}
82
83 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d
84 install -m 644 -p system/netdata.logrotate $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/%{name}
85
86 %if %{with systemd}
87 install -d $RPM_BUILD_ROOT%{_unitdir}
88 install -m 644 -p system/netdata.service $RPM_BUILD_ROOT%{_unitdir}/netdata.service
89 %else
90 # install SYSV init stuff
91 mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d
92 install -m755 system/netdata-init-d \
93         $RPM_BUILD_ROOT/etc/rc.d/init.d/netdata
94 %endif
95
96 %if %{with systemd}
97 %pre
98 # Add the "netdata" user
99 /usr/sbin/groupadd -r netdata 2> /dev/null || :
100 /usr/sbin/useradd -c "netdata" -g netdata \
101         -s /sbin/nologin -r -d %{contentdir} netdata 2> /dev/null || :
102
103 %post
104 %systemd_post netdata.service
105
106 %preun
107 %systemd_preun netdata.service
108
109 %postun
110 %systemd_postun_with_restart netdata.service
111 %else
112 %pre
113 # Add the "netdata" user
114 getent group netdata >/dev/null || groupadd -r netdata
115 getent passwd netdata >/dev/null || \
116   useradd -r -g netdata -s /sbin/nologin \
117     -d %{contentdir} -c "netdata" netdata
118 exit 0
119
120 %post
121 # Register the netdata service
122 /sbin/chkconfig --add netdata
123 # Only gets run on initial install (not upgrades or uninstalls)
124 if [ $1 = 1 ]; then
125         # Start the netdata service
126         /sbin/service netdata start
127 fi
128 exit 0
129
130 %preun
131 # Only gets run on uninstall (not upgrades)
132 if [ $1 = 0 ]; then
133         /sbin/service netdata stop > /dev/null 2>&1
134         /sbin/chkconfig --del netdata
135 fi
136 exit 0
137
138 %postun
139 # Only gets run on upgrade (not uninstalls)
140 if [ $1 != 0 ]; then
141         /sbin/service netdata condrestart 2>&1 > /dev/null
142 fi
143 exit 0
144 %endif
145
146 %clean
147 rm -rf $RPM_BUILD_ROOT
148
149 %files
150 %defattr(-,root,root)
151
152 %dir %{_sysconfdir}/%{name}
153 %config(noreplace) %{_sysconfdir}/%{name}/*.conf
154 #%config(noreplace) %{_sysconfdir}/%{name}/charts.d/*.conf
155 %config(noreplace) %{_sysconfdir}/%{name}/health.d/*.conf
156 #%config(noreplace) %{_sysconfdir}/%{name}/node.d/*.conf
157 %config(noreplace) %{_sysconfdir}/%{name}/python.d/*.conf
158 %config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
159
160 %{_libexecdir}/%{name}
161 %{_sbindir}/%{name}
162
163 %attr(0700,netdata,netdata) %dir %{_localstatedir}/cache/%{name}
164 %attr(0700,netdata,netdata) %dir %{_localstatedir}/log/%{name}
165 %attr(0700,netdata,netdata) %dir %{_localstatedir}/lib/%{name}
166
167 %dir %{_datadir}/%{name}
168
169 %if %{with systemd}
170 %{_unitdir}/netdata.service
171 %else
172 %{_sysconfdir}/rc.d/init.d/netdata
173 %endif
174
175 # Enforce 0644 for files and 0755 for directories
176 # for the netdata web directory
177 %defattr(0644,root,netdata,0755)
178 %{_datadir}/%{name}/web
179
180 %changelog
181 * Tue Oct 4 2016 Costa Tsaousis <costa@tsaousis.gr> - 1.4.0-1
182 - the fastest netdata ever (with a better look too)!
183 - improved IoT and containers support!
184 - alarms improved in almost every way!
185 - Several more improvements, new features and bugfixes.
186 * Sun Aug 28 2016 Costa Tsaousis <costa@tsaousis.gr> - 1.3.0-1
187 - netdata now has health monitoring
188 - netdata now generates badges
189 - netdata now has python plugins
190 - Several more improvements, new features and bugfixes.
191 * Tue Jul 26 2016 Jason Barnett <J@sonBarnett.com> - 1.2.0-2
192 - Added support for EL6
193 - Corrected several Requires statements
194 - Changed default to build without nfacct
195 - Removed --docdir from configure
196 * Mon May 16 2016 Costa Tsaousis <costa@tsaousis.gr> - 1.2.0-1
197 - netdata is now 30% faster.
198 - netdata now has a registry (my-netdata menu on the dashboard).
199 - netdata now monitors Linux containers.
200 - Several more improvements, new features and bugfixes.
201 * Wed Apr 20 2016 Costa Tsaousis <costa@tsaousis.gr> - 1.1.0-1
202 - Several new features (IPv6, SYNPROXY, Users, Users Groups).
203 - A lot of bug fixes and optimizations.
204 * Tue Mar 22 2016 Costa Tsaousis <costa@tsaousis.gr> - 1.0.0-1
205 - First public release.
206 * Sun Nov 15 2015 Alon Bar-Lev <alonbl@redhat.com> - 0.0.0-1
207 - Initial add.