License: GPLv2
Group: System Environment/Daemons
BuildRoot: %{_tmppath}/%{name}-%{version}-root
-BuildRequires: libgcrypt-devel, kernel-headers
+BuildRequires: libgcrypt-devel, kernel-headers, libtool-ltdl-devel
Vendor: collectd development team <collectd@verplant.org>
+ %if 0%{?el7:1}
+ Requires(pre): initscripts
+ Requires(post): systemd
+ Requires(preun): systemd
+ Requires(postun): systemd
+ %else
Requires(post): chkconfig
Requires(preun): chkconfig, initscripts
Requires(postun): initscripts
+ %endif
%description
collectd is a small daemon which collects system information periodically and
Group: System Environment/Daemons
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
- %if 0%{?rhel} >= 6
+ %if 0%{?rhel} >= 6
BuildRequires: perl-ExtUtils-Embed
- %else
+ %else
BuildRequires: perl
- %endif
+ %endif
%description perl
The Perl plugin embeds a Perl interpreter into collectd and exposes the
application programming interface (API) to Perl-scripts.
Summary: Python plugin for collectd
Group: System Environment/Daemons
Requires: %{name}%{?_isa} = %{version}-%{release}
- %if 0%{?rhel} >= 6
+ %if 0%{?rhel} >= 6
BuildRequires: python-devel
- %else
+ %else
BuildRequires: python26-devel
- %endif
+ %endif
%description python
The Python plugin embeds a Python interpreter into collectd and exposes the
application programming interface (API) to Python-scripts.
%endif
%if %{with_python}
- %if 0%{?rhel} >= 6
+ %if 0%{?rhel} >= 6
%define _with_python --enable-python
- %else
+ %else
%define _with_python --enable-python --with-python=%{_bindir}/python2.6
- %endif
+ %endif
%else
%define _with_python --disable-python
%endif
%install
rm -rf %{buildroot}
%{__make} install DESTDIR=%{buildroot}
- %{__install} -Dp -m 0755 contrib/redhat/init.d-collectd %{buildroot}%{_initrddir}/collectd
+ %if 0%{?el7:1}
+ %{__install} -Dp -m0644 contrib/systemd.collectd.service %{buildroot}%{_unitdir}/collectd.service
+ %else
+ %{__install} -Dp -m0755 contrib/redhat/init.d-collectd %{buildroot}%{_initrddir}/collectd
+ %endif
%{__install} -Dp -m0644 src/collectd.conf %{buildroot}%{_sysconfdir}/collectd.conf
%{__install} -d %{buildroot}%{_sharedstatedir}/collectd/
%{__install} -d %{buildroot}%{_sysconfdir}/collectd.d/
find %{buildroot} -type f -name perllocal.pod -delete
%if ! %{with_java}
+rm -f %{buildroot}%{_datadir}/collectd/java/collectd-api.jar
+rm -f %{buildroot}%{_datadir}/collectd/java/generic-jmx.jar
rm -f %{buildroot}%{_mandir}/man5/collectd-java.5*
%endif
rm -fr %{buildroot}/usr/lib/perl5/
%endif
+%if ! %{with_postgresql}
+rm -f %{buildroot}%{_datadir}/collectd/postgresql_default.conf
+%endif
+
%if ! %{with_python}
rm -f %{buildroot}%{_mandir}/man5/collectd-python.5*
%endif
%clean
rm -rf %{buildroot}
+ %pre
+ %if 0%{?el7:1}
+ # stop sysv-based instance before upgrading to systemd
+ if [ $1 -eq 2 ] && [ -f /var/lock/subsys/collectd ]; then
+ SYSTEMCTL_SKIP_REDIRECT=1 %{_initddir}/collectd stop >/dev/null 2>&1 || :
+ fi
+ %endif
+
%post
- /sbin/chkconfig --add collectd
+ %if 0%{?el7:1}
+ if [ $1 -eq 2 ]; then
+ /usr/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+ fi
+ %systemd_post collectd.service
+ %else
+ /sbin/chkconfig --add collectd || :
+ %endif
%preun
+ %if 0%{?el7:1}
+ %systemd_preun collectd.service
+ %else
+ # stop collectd only when uninstalling
if [ $1 -eq 0 ]; then
- /sbin/service collectd stop &>/dev/null
- /sbin/chkconfig --del collectd
+ /sbin/service collectd stop >/dev/null 2>&1 || :
+ /sbin/chkconfig --del collectd || :
fi
+ %endif
%postun
- if [ $1 -ge 1 ]; then
- /sbin/service collectd condrestart &>/dev/null || :
+ %if 0%{?el7:1}
+ %systemd_postun_with_restart collectd.service
+ %else
+ # restart collectd only when upgrading
+ if [ $1 -eq 1 ]; then
+ /sbin/service collectd condrestart >/dev/null 2>&1 || :
fi
+ %endif
%post -n libcollectdclient -p /sbin/ldconfig
%postun -n libcollectdclient -p /sbin/ldconfig
%files
%doc AUTHORS COPYING ChangeLog README
%config(noreplace) %{_sysconfdir}/collectd.conf
+ %if 0%{?el7:1}
+ %{_unitdir}/collectd.service
+ %else
%{_initrddir}/collectd
+ %endif
%{_sbindir}/collectd
%{_bindir}/collectd-nagios
%{_bindir}/collectd-tg
%{_bindir}/collectdctl
%{_sbindir}/collectdmon
-%{_datadir}/collectd/
+%{_datadir}/collectd/types.db
%{_sharedstatedir}/collectd
%{_mandir}/man1/collectd-nagios.1*
%{_mandir}/man1/collectd.1*
%if %{with_java}
%files java
-%{_prefix}/share/collectd/java/collectd-api.jar
-%{_prefix}/share/collectd/java/generic-jmx.jar
+%{_datadir}/collectd/java/collectd-api.jar
+%{_datadir}/collectd/java/generic-jmx.jar
%{_libdir}/%{name}/java.so
%{_mandir}/man5/collectd-java.5*
%endif
%if %{with_postgresql}
%files postgresql
-%{_prefix}/share/collectd/postgresql_default.conf
+%{_datadir}/collectd/postgresql_default.conf
%{_libdir}/%{name}/postgresql.so
%endif
# - New plugins disabled by default: barometer, write_kafka
# - Enable zfs_arc, now supported on Linux
# - Install disk plugin in an dedicated package, as it depends on libudev
+ # - use systemd on EL7, sysvinit on EL6 & EL5
* Mon Aug 19 2013 Marc Fournier <marc.fournier@camptocamp.com> 5.4.0-1
- New upstream version