summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 602d882)
raw | patch | inline | side by side (parent: 602d882)
author | Ruben Kerkhof <ruben@rubenkerkhof.com> | |
Sat, 4 Jun 2016 13:11:43 +0000 (15:11 +0200) | ||
committer | Ruben Kerkhof <ruben@rubenkerkhof.com> | |
Sat, 4 Jun 2016 13:16:49 +0000 (15:16 +0200) |
contrib/redhat/collectd.spec | patch | blob | history |
index c8c1c258f9dd306f9563301b23262239e991c295..ed0ddb269468b9dbaa1dde6a441a5c8fa8692654 100644 (file)
BuildRequires: libgcrypt-devel, kernel-headers, libtool-ltdl-devel, libcap-devel
Vendor: collectd development team <collectd@verplant.org>
-%if 0%{?el7:1}
-Requires(pre): initscripts
-Requires(post): systemd
-Requires(preun): systemd
-Requires(postun): systemd
+%if 0%{?fedora} || 0%{?rhel} >= 7
+%{?systemd_requires}
+BuildRequires: systemd
%else
Requires(post): chkconfig
Requires(preun): chkconfig, initscripts
%install
rm -rf %{buildroot}
%{__make} install DESTDIR=%{buildroot}
-%if 0%{?el7:1}
+%if 0%{?fedora} || 0%{?rhel} >= 7
%{__install} -Dp -m0644 contrib/systemd.collectd.service %{buildroot}%{_unitdir}/collectd.service
%else
%{__install} -Dp -m0755 contrib/redhat/init.d-collectd %{buildroot}%{_initrddir}/collectd
%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
-%if 0%{?el7:1}
-if [ $1 -eq 2 ]; then
- /usr/bin/systemctl daemon-reload >/dev/null 2>&1 || :
-fi
+%if 0%{?fedora} || 0%{?rhel} >= 7
%systemd_post collectd.service
%else
/sbin/chkconfig --add collectd || :
%endif
%preun
-%if 0%{?el7:1}
+%if 0%{?fedora} || 0%{?rhel} >= 7
%systemd_preun collectd.service
%else
# stop collectd only when uninstalling
%endif
%postun
-%if 0%{?el7:1}
+%if 0%{?fedora} || 0%{?rhel} >= 7
%systemd_postun_with_restart collectd.service
%else
# restart collectd only when upgrading
%files
%doc AUTHORS COPYING ChangeLog README
%config(noreplace) %{_sysconfdir}/collectd.conf
-%if 0%{?el7:1}
+%if 0%{?fedora} || 0%{?rhel} >= 7
%{_unitdir}/collectd.service
%else
%{_initrddir}/collectd