update spec file to support EL6
Jason Barnett committed
Jul 26, 2016 at 09:30 UTC
0ef78f367d242f6991ad56ad915b82e6fac300b3
1 file changed
+55
-11
netdata.spec.in
+55
-11
@@ -1,7 +1,8 @@
1
+%define contentdir %{_datadir}/netdata
2
#
3
# Conditional build:
3
-%bcond_without systemd # systemd
4
-%bcond_without nfacct # build with nfacct plugin
4
+%bcond_without systemd # systemd
5
+%bcond_with nfacct # build with nfacct plugin
6
7
%if 0%{?fedora} || 0%{?rhel} >= 7
8
%else
@@ -19,16 +20,24 @@ URL: http://netdata.firehol.org/
20
BuildRequires: pkgconfig
21
BuildRequires: xz
22
BuildRequires: zlib-devel
23
+
24
+# Packages can be found in the EPEL repo
25
%if %{with nfacct}
26
BuildRequires: libmnl-devel
27
BuildRequires: libnetfilter_acct-devel
28
%endif
29
+
30
+Requires(pre): /usr/sbin/groupadd
31
+Requires(pre): /usr/sbin/useradd
32
+
33
%if %{with systemd}
27
-BuildRequires: systemd
28
-Requires(post): systemd
29
-Requires(preun): systemd
30
-Requires(postun): systemd
34
+Requires(preun): systemd-units
35
+Requires(postun): systemd-units
36
+Requires(post): systemd-units
37
+%else
38
+Requires(post): chkconfig
39
%endif
40
+
41
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
42
43
%description
@@ -46,7 +55,6 @@ happened, on your systems and applications.
55
56
%build
57
%configure \
49
- --docdir=%{_docdir}/%{name}-%{version} \
58
--with-zlib \
59
--with-math \
60
%{?with_nfacct:--enable-plugin-nfacct} \
@@ -65,13 +73,20 @@ find $RPM_BUILD_ROOT -name .keep | xargs -r rm
73
%if %{with systemd}
74
install -d $RPM_BUILD_ROOT%{_unitdir}
75
install -m 644 -p system/netdata.service $RPM_BUILD_ROOT%{_unitdir}/netdata.service
76
+%else
77
+# install SYSV init stuff
78
+mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d
79
+install -m755 system/netdata-init-d \
80
+ $RPM_BUILD_ROOT/etc/rc.d/init.d/netdata
81
%endif
82
83
+%if %{with systemd}
84
%pre
71
-getent group netdata > /dev/null || groupadd -r netdata
72
-getent passwd netdata > /dev/null || useradd -r -g netdata -c netdata -s /sbin/nologin -d / netdata
85
+# Add the "netdata" user
86
+/usr/sbin/groupadd -r netdata 2> /dev/null || :
87
+/usr/sbin/useradd -c "netdata" -g netdata \
88
+ -s /sbin/nologin -r -d %{contentdir} netdata 2> /dev/null || :
89
74
-%if %{with systemd}
90
%post
91
%systemd_post netdata.service
92
@@ -80,6 +95,24 @@ getent passwd netdata > /dev/null || useradd -r -g netdata -c netdata -s /sbin/n
95
96
%postun
97
%systemd_postun_with_restart netdata.service
98
+%else
99
+%pre
100
+# Add the "netdata" user
101
+getent group netdata >/dev/null || groupadd -r netdata
102
+getent passwd netdata >/dev/null || \
103
+ useradd -r -g netdata -s /sbin/nologin \
104
+ -d %{contentdir} -c "netdata" netdata
105
+exit 0
106
+
107
+%post
108
+# Register the netdata service
109
+/sbin/chkconfig --add netdata
110
+
111
+%preun
112
+if [ $1 = 0 ]; then
113
+ /sbin/service netdata stop > /dev/null 2>&1
114
+ /sbin/chkconfig --del netdata
115
+fi
116
%endif
117
118
%clean
@@ -88,18 +121,29 @@ rm -rf $RPM_BUILD_ROOT
121
%files
122
%attr(-,netdata,netdata) %dir %{_localstatedir}/cache/%{name}
123
%attr(-,netdata,netdata) %dir %{_localstatedir}/log/%{name}
91
-%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/*.conf
124
+%config(noreplace) %{_sysconfdir}/%{name}/*.conf
125
+%config(noreplace) %{_sysconfdir}/%{name}/python.d/*.conf
126
%dir %{_sysconfdir}/%{name}
127
%{?with_systemd:%{_unitdir}/netdata.service}
128
%{_libexecdir}/%{name}
129
%{_sbindir}/%{name}
130
%dir %{_datadir}/%{name}
131
132
+%if %{with systemd}
133
+%else
134
+%{_sysconfdir}/rc.d/init.d/netdata
135
+%endif
136
+
137
# override defattr for web files
138
%defattr(644,root,netdata,755)
139
%{_datadir}/%{name}/web
140
141
%changelog
142
+* Tue Jul 26 2016 Jason Barnett <J@sonBarnett.com> - 1.2.0-2
143
+- Added support for EL6
144
+- Corrected several Requires statements
145
+- Changed default to build without nfacct
146
+- Removed --docdir from configure
147
* Mon May 16 2016 Costa Tsaousis <costa@tsaousis.gr> - 1.2.0-1
148
- netdata is now 30% faster.
149
- netdata now has a registry (my-netdata menu on the dashboard).