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