From 14da7e20d9625dff3f0941ebe24b23d8399693cf Mon Sep 17 00:00:00 2001 From: Milan Broz Date: Mon, 17 Aug 2015 12:48:17 +0200 Subject: [PATCH] Update rpm spec to properly restart systemd ceph.target. If we are using systemd, ceph target should be used. Also fail to restart service should not stop policy to load. Signed-off-by: Milan Broz --- ceph.spec.in | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/ceph.spec.in b/ceph.spec.in index e33b3f767d3..e207b3fe056 100644 --- a/ceph.spec.in +++ b/ceph.spec.in @@ -1137,24 +1137,42 @@ ln -sf %{_libdir}/librbd.so.1 /usr/lib64/qemu/librbd.so.1 %{_mandir}/man8/ceph_selinux.8.* %post selinux -/sbin/service ceph stop >/dev/null 2>&1 +%if 0%{?_with_systemd} + /usr/bin/systemctl stop ceph.target > /dev/null 2>&1 || : +%else + /sbin/service ceph stop >/dev/null 2>&1 || : +%endif + semodule -n -i %{_datadir}/selinux/packages/ceph.pp if /usr/sbin/selinuxenabled ; then /usr/sbin/load_policy %relabel_files fi -/sbin/service ceph start >/dev/null 2>&1 + +%if 0%{?_with_systemd} + /usr/bin/systemctl start ceph.target > /dev/null 2>&1 || : +%else + /sbin/service ceph start >/dev/null 2>&1 || : +%endif exit 0 %postun selinux if [ $1 -eq 0 ]; then - /sbin/service ceph stop >/dev/null 2>&1 + %if 0%{?_with_systemd} + /usr/bin/systemctl stop ceph.target > /dev/null 2>&1 || : + %else + /sbin/service ceph stop >/dev/null 2>&1 || : + %endif semodule -n -r ceph if /usr/sbin/selinuxenabled ; then /usr/sbin/load_policy %relabel_files fi; - /sbin/service ceph start >/dev/null 2>&1 + %if 0%{?_with_systemd} + /usr/bin/systemctl start ceph.target > /dev/null 2>&1 || : + %else + /sbin/service ceph start >/dev/null 2>&1 || : + %endif fi; exit 0 -- 2.47.3