From: Boris Ranto Date: Fri, 2 Oct 2015 08:37:04 +0000 (+0200) Subject: ceph.spec.in: Do not always restart the daemons on removal X-Git-Tag: v9.1.0~30^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F6142%2Fhead;p=ceph.git ceph.spec.in: Do not always restart the daemons on removal 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 --- diff --git a/ceph.spec.in b/ceph.spec.in index 239a0fa7da0..1a3a3993346 100644 --- a/ceph.spec.in +++ b/ceph.spec.in @@ -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 || :