]> arthur.barton.de Git - netdata.git/blob - netdata.spec.in
Spec: OpenSUSE support
[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:  pkgconfig
39 BuildRequires:  xz
40 BuildRequires:  zlib-devel
41 BuildRequires:  libuuid-devel
42 Requires: zlib
43 Requires: libuuid
44
45 # Packages can be found in the EPEL repo
46 %if %{with nfacct}
47 BuildRequires:  libmnl-devel
48 BuildRequires:  libnetfilter_acct-devel
49 Requires: libmnl
50 Requires: libnetfilter_acct
51 %endif
52
53 Requires(pre): /usr/sbin/groupadd
54 Requires(pre): /usr/sbin/useradd
55
56 %if %{with systemd}
57 %if 0%{?suse_version}
58 %{?systemd_requires}
59 %else
60 Requires(preun):  systemd-units
61 Requires(postun): systemd-units
62 Requires(post):   systemd-units
63 %endif
64 %else
65 Requires(post):   chkconfig
66 %endif
67
68 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
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 -n %{name}-@PACKAGE_VERSION@
82
83 %build
84 %configure \
85         --with-zlib \
86         --with-math \
87         %{?with_nfacct:--enable-plugin-nfacct} \
88         --with-user=netdata
89 %{__make} %{?_smp_mflags}
90
91 %install
92 rm -rf $RPM_BUILD_ROOT
93 %{__make} %{?_smp_mflags} DESTDIR=$RPM_BUILD_ROOT install
94
95 find $RPM_BUILD_ROOT -name .keep -print0 | xargs --null --no-run-if-empty rm
96
97 install -m 644 -p system/netdata.conf $RPM_BUILD_ROOT%{_sysconfdir}/%{name}
98 install -Dm 644 -p system/netdata.logrotate $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/%{name}
99
100 %if %{with systemd}
101 install -d $RPM_BUILD_ROOT%{_unitdir}
102 install -m 644 -p system/netdata.service $RPM_BUILD_ROOT%{_unitdir}/netdata.service
103 %else
104 # install SYSV init stuff
105 mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d
106 install -m755 system/netdata-init-d \
107         $RPM_BUILD_ROOT/etc/rc.d/init.d/netdata
108 %endif
109
110 %if %{with systemd}
111 %pre
112 # Add the "netdata" user
113 /usr/sbin/groupadd -r netdata 2> /dev/null || :
114 /usr/sbin/useradd -c "netdata" -g netdata \
115         -s /sbin/nologin -r -d %{contentdir} netdata 2> /dev/null || :
116
117 %post
118 o%distro_post
119
120 %preun
121 %distro_preun
122
123 %postun
124 %distro_postun
125 %else
126 %pre
127 # Add the "netdata" user
128 getent group netdata >/dev/null || groupadd -r netdata
129 getent passwd netdata >/dev/null || \
130   useradd -r -g netdata -s /sbin/nologin \
131     -d %{contentdir} -c "netdata" netdata
132 exit 0
133
134 %post
135 # Register the netdata service
136 /sbin/chkconfig --add netdata
137 # Only gets run on initial install (not upgrades or uninstalls)
138 if [ $1 = 1 ]; then
139         # Start the netdata service
140         /sbin/service netdata start
141 fi
142 exit 0
143
144 %preun
145 # Only gets run on uninstall (not upgrades)
146 if [ $1 = 0 ]; then
147         /sbin/service netdata stop > /dev/null 2>&1
148         /sbin/chkconfig --del netdata
149 fi
150 exit 0
151
152 %postun
153 # Only gets run on upgrade (not uninstalls)
154 if [ $1 != 0 ]; then
155         /sbin/service netdata condrestart 2>&1 > /dev/null
156 fi
157 exit 0
158 %endif
159
160 %clean
161 rm -rf $RPM_BUILD_ROOT
162
163 %files
164 %defattr(-,root,root)
165
166 %dir %{_sysconfdir}/%{name}
167 %dir %{_sysconfdir}/%{name}/health.d
168 %dir %{_sysconfdir}/%{name}/python.d
169
170 %config(noreplace) %{_sysconfdir}/%{name}/*.conf
171 #%config(noreplace) %{_sysconfdir}/%{name}/charts.d/*.conf
172 %config(noreplace) %{_sysconfdir}/%{name}/health.d/*.conf
173 #%config(noreplace) %{_sysconfdir}/%{name}/node.d/*.conf
174 %config(noreplace) %{_sysconfdir}/%{name}/python.d/*.conf
175 %config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
176
177 # node.js config files are JSON (which do not support comments)
178 # so, we only supply markdown files
179 %{_sysconfdir}/%{name}/node.d/*.md
180
181 %{_libexecdir}/%{name}
182 %{_sbindir}/%{name}
183
184 %attr(0700,netdata,netdata) %dir %{_localstatedir}/cache/%{name}
185 %attr(0700,netdata,netdata) %dir %{_localstatedir}/log/%{name}
186 %attr(0700,netdata,netdata) %dir %{_localstatedir}/lib/%{name}
187
188 %dir %{_datadir}/%{name}
189
190 %if %{with systemd}
191 %{_unitdir}/netdata.service
192 %else
193 %{_sysconfdir}/rc.d/init.d/netdata
194 %endif
195
196 # Enforce 0644 for files and 0755 for directories
197 # for the netdata web directory
198 %defattr(0644,root,netdata,0755)
199 %{_datadir}/%{name}/web
200
201 %changelog
202 * Tue Oct 4 2016 Costa Tsaousis <costa@tsaousis.gr> - 1.4.0-1
203 - the fastest netdata ever (with a better look too)!
204 - improved IoT and containers support!
205 - alarms improved in almost every way!
206 - Several more improvements, new features and bugfixes.
207 * Sun Aug 28 2016 Costa Tsaousis <costa@tsaousis.gr> - 1.3.0-1
208 - netdata now has health monitoring
209 - netdata now generates badges
210 - netdata now has python plugins
211 - Several more improvements, new features and bugfixes.
212 * Tue Jul 26 2016 Jason Barnett <J@sonBarnett.com> - 1.2.0-2
213 - Added support for EL6
214 - Corrected several Requires statements
215 - Changed default to build without nfacct
216 - Removed --docdir from configure
217 * Mon May 16 2016 Costa Tsaousis <costa@tsaousis.gr> - 1.2.0-1
218 - netdata is now 30% faster.
219 - netdata now has a registry (my-netdata menu on the dashboard).
220 - netdata now monitors Linux containers.
221 - Several more improvements, new features and bugfixes.
222 * Wed Apr 20 2016 Costa Tsaousis <costa@tsaousis.gr> - 1.1.0-1
223 - Several new features (IPv6, SYNPROXY, Users, Users Groups).
224 - A lot of bug fixes and optimizations.
225 * Tue Mar 22 2016 Costa Tsaousis <costa@tsaousis.gr> - 1.0.0-1
226 - First public release.
227 * Sun Nov 15 2015 Alon Bar-Lev <alonbl@redhat.com> - 0.0.0-1
228 - Initial add.