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