X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=contrib%2Fredhat%2Fcollectd.spec;h=acc38ac4352209efb36db8ce5d7cbaffc036114c;hb=60786de4e8280a109077ab5ecc293f74b3b9bce3;hp=6507d5fe0aeb200ae4536025e5ed719f12c9d21a;hpb=3ed71d2774fcacdf0c88b3a6d81bd826a6893b32;p=collectd.git diff --git a/contrib/redhat/collectd.spec b/contrib/redhat/collectd.spec index 6507d5fe..acc38ac4 100644 --- a/contrib/redhat/collectd.spec +++ b/contrib/redhat/collectd.spec @@ -216,9 +216,16 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-root BuildRequires: libgcrypt-devel, kernel-headers, libtool-ltdl-devel Vendor: collectd development team +%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 @@ -554,11 +561,11 @@ Summary: Perl plugin for collectd 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. @@ -602,11 +609,11 @@ database. 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. @@ -1257,11 +1264,11 @@ Development files for libcollectdclient %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 @@ -1647,7 +1654,11 @@ Development files for libcollectdclient %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/ @@ -1704,19 +1715,44 @@ rm -f %{buildroot}%{_mandir}/man5/collectd-snmp.5* %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 @@ -1725,7 +1761,11 @@ fi %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 @@ -2215,6 +2255,7 @@ fi # - 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 5.4.0-1 - New upstream version