]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph.spec.in: Do not always restart the daemons on removal 6142/head
authorBoris Ranto <branto@redhat.com>
Fri, 2 Oct 2015 08:37:04 +0000 (10:37 +0200)
committerBoris Ranto <branto@redhat.com>
Fri, 2 Oct 2015 10:19:14 +0000 (12:19 +0200)
There is no need to restart the daemons when removing ceph-selinux
package if SELinux is not enabled.

Fixes: #13061
Signed-off-by: Boris Ranto <branto@redhat.com>
ceph.spec.in

index 239a0fa7da09edc1f9913f31ca219156c9b57a40..1a3a3993346e89f4f391da90c1639ffd8ad0630f 100644 (file)
@@ -1177,6 +1177,18 @@ exit 0
 
 %postun selinux
 if [ $1 -eq 0 ]; then
+    # Remove the module
+    %{_sbindir}/semodule -n -r ceph
+
+    # Reload the policy if SELinux is enabled
+    if %{_sbindir}/selinuxenabled ; then
+        %{_sbindir}/load_policy
+    else
+        # Do not relabel if SELinux is not enabled
+        exit 0
+    fi
+
+    # Check whether the daemons are running
     %if 0%{?_with_systemd}
         /usr/bin/systemctl status ceph.target > /dev/null 2>&1
     %else
@@ -1184,6 +1196,7 @@ if [ $1 -eq 0 ]; then
     %endif
     STATUS=$?
 
+    # Stop the daemons if they were running
     if test $STATUS -eq 0; then
     %if 0%{?_with_systemd}
         /usr/bin/systemctl stop ceph.target > /dev/null 2>&1
@@ -1192,12 +1205,10 @@ if [ $1 -eq 0 ]; then
     %endif
     fi
 
-    %{_sbindir}/semodule -n -r ceph
-    if %{_sbindir}/selinuxenabled ; then
-       %{_sbindir}/load_policy
-       %relabel_files
-    fi;
+    # Now, relabel the files
+    %relabel_files
 
+    # Start the daemons if they were running before
     if test $STATUS -eq 0; then
     %if 0%{?_with_systemd}
        /usr/bin/systemctl start ceph.target > /dev/null 2>&1 || :