Currently, the ceph files are being relabelled every time the package is
rebuilt. Fix this by checking the policy versions and relabel the files
only if the policy actually changed (different policy version was
detected).
Signed-off-by: Boris Ranto <branto@redhat.com>
/sbin/service ceph stop >/dev/null 2>&1 || :
%endif
+OLD_POLVER=$(%{_sbindir}/semodule -l | grep -P '^ceph[\t ]' | awk '{print $2}')
%{_sbindir}/semodule -n -i %{_datadir}/selinux/packages/ceph.pp
-if %{_sbindir}/selinuxenabled ; then
+NEW_POLVER=$(%{_sbindir}/semodule -l | grep -P '^ceph[\t ]' | awk '{print $2}')
+if %{_sbindir}/selinuxenabled; then
%{_sbindir}/load_policy
- %relabel_files
+ if test "$OLD_POLVER" != "$NEW_POLVER"; then
+ %relabel_files
+ fi
fi
%if 0%{?_with_systemd}