[mcollective] rhbz#850200 use systemd macros.
stevetraylen
stevetraylen at fedoraproject.org
Wed Apr 17 08:09:47 UTC 2013
commit 10ee73cc26c070d72e273efd3bb50a22ef4fcf46
Author: Steve Traylen <steve.traylen at cern.ch>
Date: Wed Apr 17 10:09:29 2013 +0200
rhbz#850200 use systemd macros.
mcollective.spec | 67 +++++++++++++++++------------------------------------
1 files changed, 22 insertions(+), 45 deletions(-)
---
diff --git a/mcollective.spec b/mcollective.spec
index 7a1e68d..b9dd412 100644
--- a/mcollective.spec
+++ b/mcollective.spec
@@ -25,19 +25,18 @@ Patch0: mcollective-rhbz#952970.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: ruby-devel
-%if 0%{?fedora} >= 15
-BuildRequires: systemd-units
+%if 0%{?fedora} >= 18
+BuildRequires: systemd
%endif
BuildArch: noarch
Requires: mcollective-common = %{version}-%{release}
-%if 0%{?fedora} >= 15
-Requires(post): systemd-units
-Requires(preun): systemd-units
-Requires(postun): systemd-units
-Requires(post): systemd-sysv
+%if 0%{?fedora} >= 18
+Requires(post): systemd
+Requires(preun): systemd
+Requires(postun): systemd
%endif
%package common
@@ -77,10 +76,10 @@ rm -rf lib/mcollective/vendor/systemu
rm -rf lib/mcollective/vendor/load_*.rb
%build
-%if 0%{?fedora} <= 14 || 0%{?rhel}
+%if 0%{?rhel}
%{__sed} -i -e 's/^daemonize = .*$/daemonize = 1/' etc/server.cfg.dist
%endif
-%if 0%{?fedora} >= 15
+%if 0%{?fedora} >= 18
%{__sed} -i -e 's/^daemonize = .*$/daemonize = 0/' etc/server.cfg.dist
%endif
@@ -94,12 +93,12 @@ cp --preserve=timestamps --recursive lib/* %{buildroot}/%{ruby_vendorlibdir}
%{__install} -p -m0755 bin/mcollectived %{buildroot}/usr/sbin/mcollectived
%{__install} -p -m0755 bin/mco %{buildroot}/usr/sbin/mco
-%if 0%{?fedora} <= 14 || 0%{?rhel}
+%if 0%{?rhel}
%{__install} -d -m0755 %{buildroot}%{_initrddir}
%{__install} -p -m0755 ext/redhat/mcollective.init %{buildroot}%{_initrddir}/mcollective
%endif
-%if 0%{?fedora} >= 15
+%if 0%{?fedora} >= 18
%{__install} -d -m0755 %{buildroot}%{_unitdir}
%{__install} -p -m0644 %{SOURCE1} %{buildroot}%{_unitdir}/mcollective.service
%endif
@@ -120,55 +119,32 @@ cp --preserve=timestamps --recursive plugins/* %{buildroot}%{_libexecdir}/mcolle
rm -rf %{buildroot}
%post
-%if 0%{?fedora} <= 14 || 0%{?rhel}
+%if 0%{?rhel}
/sbin/chkconfig --add mcollective || :
%endif
-%if 0%{?fedora} >= 15
-if [ $1 -eq 1 ] ; then
- # Initial installation
- /bin/systemctl daemon-reload >/dev/null 2>&1 || :
-fi
+%if 0%{?fedora} >= 18
+%systemd_post mcollective.service
%endif
%postun
-%if 0%{?fedora} <= 14 || 0%{?rhel}
+%if 0%{?rhel}
if [ "$1" -ge 1 ]; then
/sbin/service mcollective condrestart &>/dev/null || :
fi
%endif
-%if 0%{?fedora} >= 15
-/bin/systemctl daemon-reload >/dev/null 2>&1 || :
-if [ $1 -ge 1 ] ; then
- # Package upgrade, not uninstall
- /bin/systemctl try-restart mcollective.service >/dev/null 2>&1 || :
-fi
+%if 0%{?fedora} >= 18
+%systemd_postun_with_restart mcollective.service
%endif
%preun
-%if 0%{?fedora} <= 14 || 0%{?rhel}
+%if 0%{?rhel}
if [ "$1" = 0 ] ; then
/sbin/service mcollective stop > /dev/null 2>&1
/sbin/chkconfig --del mcollective || :
fi
%endif
-%if 0%{?fedora} >= 15
-if [ $1 -eq 0 ] ; then
- # Package removal, not upgrade
- /bin/systemctl --no-reload disable mcollective.service > /dev/null 2>&1 || :
- /bin/systemctl stop mcollective.service > /dev/null 2>&1 || :
-fi
-%endif
-
-%if 0%{?fedora} >= 15
-%triggerun -- mcollective < 1.3.1-1
-# Save the current service runlevel info
-# User must manually run systemd-sysv-convert --apply httpd
-# to migrate them to systemd targets
-/usr/bin/systemd-sysv-convert --save mcollective >/dev/null 2>&1 ||:
-
-# Run these because the SysV package being removed won't do them
-/sbin/chkconfig --del mcollective >/dev/null 2>&1 || :
-/bin/systemctl try-restart mcollective.service >/dev/null 2>&1 || :
+%if 0%{?fedora} >= 18
+%systemd_preun mcollective.service
%endif
%files common
@@ -193,10 +169,10 @@ fi
%config(noreplace) /etc/mcollective/server.cfg
%config(noreplace) /etc/mcollective/facts.yaml
%{_sbindir}/mcollectived
-%if 0%{?fedora} <= 14 || 0%{?rhel}
+%if 0%{?rhel}
%{_initrddir}/mcollective
%endif
-%if 0%{?fedora} >= 15
+%if 0%{?fedora} >= 18
%{_unitdir}/mcollective.service
%endif
%dir /etc/mcollective/ssl/clients
@@ -206,6 +182,7 @@ fi
* Wed Apr 17 2013 Vít Ondruch <vondruch at redhat.com> - 2.2.3-1
- Upstream to 2.2.3
- Add mcollective-rhbz#952970.patch
+- rhbz#850200 Use new systemd rpm macros.
* Wed Mar 20 2013 Vít Ondruch <vondruch at redhat.com> - 2.2.0-3
- Rebuild for https://fedoraproject.org/wiki/Features/Ruby_2.0.0
More information about the scm-commits
mailing list