client/tools/osad/osa-dispatcher-selinux/osa-dispatcher-selinux-enable | 15 ++++++
client/tools/osad/osad.spec | 22 ++++------
2 files changed, 24 insertions(+), 13 deletions(-)
New commits:
commit 38a88ebc3820ff19e8e922faad4396015d662f6d
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Wed Apr 29 11:27:25 2009 +0200
osa-dispatcher-selinux: move the %post SELinux activation to
/usr/sbin/osa-dispatcher-selinux-enable.
This way it won't be called during rpm installation if SELinux
is disabled, and can be called later, once SELinux is enabled.
(cherry picked from commit 8d48a975081bd87d48a6cafa7e43311459664b1f)
diff --git a/client/tools/osad/osa-dispatcher-selinux/osa-dispatcher-selinux-enable
b/client/tools/osad/osa-dispatcher-selinux/osa-dispatcher-selinux-enable
new file mode 100644
index 0000000..87a91c2
--- /dev/null
+++ b/client/tools/osad/osa-dispatcher-selinux/osa-dispatcher-selinux-enable
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+# Install SELinux policy modules
+for selinuxvariant in mls strict targeted
+ do
+ /usr/sbin/semodule -s ${selinuxvariant} -l > /dev/null 2>&1 \
+ && /usr/sbin/semodule -s ${selinuxvariant} -i \
+ /usr/share/selinux/${selinuxvariant}/osa-dispatcher.pp || :
+ done
+
+/usr/sbin/semanage port -a -t osa_dispatcher_upstream_notif_server_port_t -p tcp 1290
> /dev/null 2>&1 || :
+
+rpm -ql osa-dispatcher | xargs -n 1 /sbin/restorecon -rvvi {}
+/sbin/restorecon -vvi /var/log/rhn/osa-dispatcher.log
+
diff --git a/client/tools/osad/osad.spec b/client/tools/osad/osad.spec
index f8e6ee9..bce75cc 100644
--- a/client/tools/osad/osad.spec
+++ b/client/tools/osad/osad.spec
@@ -77,7 +77,7 @@ Requires: spacewalk-selinux
%if "%{selinux_policyver}" != ""
Requires: selinux-policy >= %{selinux_policyver}
%endif
-Requires(post): /usr/sbin/semodule, /sbin/restorecon
+Requires(post): /usr/sbin/semodule, /sbin/restorecon, /usr/sbin/selinuxenabled
Requires(postun): /usr/sbin/semodule, /sbin/restorecon
Requires: osa-dispatcher
@@ -124,6 +124,10 @@ install -p -m 644 osa-dispatcher-selinux/%{modulename}.if \
# Hardlink identical policy module packages together
/usr/sbin/hardlink -cv %{buildroot}%{_datadir}/selinux
+
+# Install osa-dispatcher-selinux-enable which will be called in %post
+install -d %{buildroot}%{_sbindir}
+install -p -m 755 osa-dispatcher-selinux/osa-dispatcher-selinux-enable
%{buildroot}%{_sbindir}/osa-dispatcher-selinux-enable
%endif
%clean
@@ -153,18 +157,9 @@ fi
%if %{include_selinux_package}
%post -n osa-dispatcher-selinux
-# Install SELinux policy modules
-for selinuxvariant in %{selinux_variants}
- do
- /usr/sbin/semodule -s ${selinuxvariant} -l > /dev/null 2>&1 \
- && /usr/sbin/semodule -s ${selinuxvariant} -i \
- %{_datadir}/selinux/${selinuxvariant}/%{modulename}.pp || :
- done
-
-/usr/sbin/semanage port -a -t osa_dispatcher_upstream_notif_server_port_t -p tcp 1290
> /dev/null 2>&1 || :
-
-rpm -ql osa-dispatcher | xargs -n 1 /sbin/restorecon -rvvi {}
-/sbin/restorecon -vvi /var/log/rhn/osa-dispatcher.log
+if /usr/sbin/selinuxenabled ; then
+ %{_sbindir}/osa-dispatcher-selinux-enable
+fi
%postun -n osa-dispatcher-selinux
# Clean up after package removal
@@ -226,6 +221,7 @@ rpm -ql osa-dispatcher | xargs -n 1 /sbin/restorecon -rvvi {}
%{_datadir}/selinux/devel/include/%{moduletype}/%{modulename}.if
%doc LICENSE
%doc PYTHON-LICENSES.txt
+%attr(0755,root,root) %{_sbindir}/osa-dispatcher-selinux-enable
%endif
# $Id$
Show replies by date