]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Update rpm spec to properly restart systemd ceph.target.
authorMilan Broz <mbroz@redhat.com>
Mon, 17 Aug 2015 10:48:17 +0000 (12:48 +0200)
committerMilan Broz <mbroz@redhat.com>
Tue, 18 Aug 2015 12:25:04 +0000 (14:25 +0200)
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 <mbroz@redhat.com>
ceph.spec.in

index e33b3f767d37bb625a97d421d9d34b07271d10d0..e207b3fe056333d49ecf45757231dfd29f82a42e 100644 (file)
@@ -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