summaryrefslogtreecommitdiffstats
path: root/netdata.spec.in
diff options
context:
space:
mode:
authorJason Barnett <jason.w.barnett@gmail.com>2016-07-26 09:30:49 -0400
committerJason Barnett <jason.w.barnett@gmail.com>2016-07-26 09:36:14 -0400
commit0ef78f367d242f6991ad56ad915b82e6fac300b3 (patch)
treee5e1f3e32d134c42ae5580741e3454031a91e9d0 /netdata.spec.in
parent8abfd74e85d19903559ca65da92796aaa395810d (diff)
update spec file to support EL6
Diffstat (limited to 'netdata.spec.in')
-rw-r--r--netdata.spec.in66
1 files changed, 55 insertions, 11 deletions
diff --git a/netdata.spec.in b/netdata.spec.in
index 13c047968b..4e82698570 100644
--- a/netdata.spec.in
+++ b/netdata.spec.in
@@ -1,7 +1,8 @@
+%define contentdir %{_datadir}/netdata
#
# Conditional build:
-%bcond_without systemd # systemd
-%bcond_without nfacct # build with nfacct plugin
+%bcond_without systemd # systemd
+%bcond_with nfacct # build with nfacct plugin
%if 0%{?fedora} || 0%{?rhel} >= 7
%else
@@ -19,16 +20,24 @@ URL: http://netdata.firehol.org/
BuildRequires: pkgconfig
BuildRequires: xz
BuildRequires: zlib-devel
+
+# Packages can be found in the EPEL repo
%if %{with nfacct}
BuildRequires: libmnl-devel
BuildRequires: libnetfilter_acct-devel
%endif
+
+Requires(pre): /usr/sbin/groupadd
+Requires(pre): /usr/sbin/useradd
+
%if %{with systemd}
-BuildRequires: systemd
-Requires(post): systemd
-Requires(preun): systemd
-Requires(postun): systemd
+Requires(preun): systemd-units
+Requires(postun): systemd-units
+Requires(post): systemd-units
+%else
+Requires(post): chkconfig
%endif
+
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%description
@@ -46,7 +55,6 @@ happened, on your systems and applications.
%build
%configure \
- --docdir=%{_docdir}/%{name}-%{version} \
--with-zlib \
--with-math \
%{?with_nfacct:--enable-plugin-nfacct} \
@@ -65,13 +73,20 @@ find $RPM_BUILD_ROOT -name .keep | xargs -r rm
%if %{with systemd}
install -d $RPM_BUILD_ROOT%{_unitdir}
install -m 644 -p system/netdata.service $RPM_BUILD_ROOT%{_unitdir}/netdata.service
+%else
+# install SYSV init stuff
+mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d
+install -m755 system/netdata-init-d \
+ $RPM_BUILD_ROOT/etc/rc.d/init.d/netdata
%endif
+%if %{with systemd}
%pre
-getent group netdata > /dev/null || groupadd -r netdata
-getent passwd netdata > /dev/null || useradd -r -g netdata -c netdata -s /sbin/nologin -d / netdata
+# Add the "netdata" user
+/usr/sbin/groupadd -r netdata 2> /dev/null || :
+/usr/sbin/useradd -c "netdata" -g netdata \
+ -s /sbin/nologin -r -d %{contentdir} netdata 2> /dev/null || :
-%if %{with systemd}
%post
%systemd_post netdata.service
@@ -80,6 +95,24 @@ getent passwd netdata > /dev/null || useradd -r -g netdata -c netdata -s /sbin/n
%postun
%systemd_postun_with_restart netdata.service
+%else
+%pre
+# Add the "netdata" user
+getent group netdata >/dev/null || groupadd -r netdata
+getent passwd netdata >/dev/null || \
+ useradd -r -g netdata -s /sbin/nologin \
+ -d %{contentdir} -c "netdata" netdata
+exit 0
+
+%post
+# Register the netdata service
+/sbin/chkconfig --add netdata
+
+%preun
+if [ $1 = 0 ]; then
+ /sbin/service netdata stop > /dev/null 2>&1
+ /sbin/chkconfig --del netdata
+fi
%endif
%clean
@@ -88,18 +121,29 @@ rm -rf $RPM_BUILD_ROOT
%files
%attr(-,netdata,netdata) %dir %{_localstatedir}/cache/%{name}
%attr(-,netdata,netdata) %dir %{_localstatedir}/log/%{name}
-%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/*.conf
+%config(noreplace) %{_sysconfdir}/%{name}/*.conf
+%config(noreplace) %{_sysconfdir}/%{name}/python.d/*.conf
%dir %{_sysconfdir}/%{name}
%{?with_systemd:%{_unitdir}/netdata.service}
%{_libexecdir}/%{name}
%{_sbindir}/%{name}
%dir %{_datadir}/%{name}
+%if %{with systemd}
+%else
+%{_sysconfdir}/rc.d/init.d/netdata
+%endif
+
# override defattr for web files
%defattr(644,root,netdata,755)
%{_datadir}/%{name}/web
%changelog
+* Tue Jul 26 2016 Jason Barnett <J@sonBarnett.com> - 1.2.0-2
+- Added support for EL6
+- Corrected several Requires statements
+- Changed default to build without nfacct
+- Removed --docdir from configure
* Mon May 16 2016 Costa Tsaousis <costa@tsaousis.gr> - 1.2.0-1
- netdata is now 30% faster.
- netdata now has a registry (my-netdata menu on the dashboard).