Skip to content

Commit

Permalink
Install SELinux policy to active one
Browse files Browse the repository at this point in the history
Relates to: containers/qm#731

Change the bluechi-selinux module to be installed to the targeted
policy (which is hardcoded), simply install it to the active SELinux policy.

Signed-off-by: Michael Engel <[email protected]>
  • Loading branch information
engelmi committed Mar 6, 2025
1 parent 1e6d5f9 commit c125ee4
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions bluechi.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,14 @@ Requires: selinux-policy >= %{_selinux_policy_version}
%endif

Requires(post): policycoreutils
%if "%{_selinux_policy_version}" != ""
Requires(post): selinux-policy-base >= %_selinux_policy_version
Requires(post): selinux-policy-any >= %_selinux_policy_version
%endif

Obsoletes: hirte-selinux < 0.6.0
Provides: hirte-selinux = %{version}-%{release}

%global selinuxtype targeted

%description selinux
SELinux policy associated with the bluechi and bluechi-agent daemons

Expand All @@ -186,14 +188,16 @@ SELinux policy associated with the bluechi and bluechi-agent daemons
if [ $1 -eq 1 ]; then
semodule -N -X 200 -r hirte 2>/dev/null || true
fi
%selinux_modules_install -s %{selinuxtype} %{_datadir}/selinux/packages/bluechi.pp.bz2
. %{_sysconfdir}/selinux/config
%selinux_modules_install -s ${SELINUXTYPE} %{_datadir}/selinux/packages/bluechi.pp.bz2
restorecon -R %{_bindir}/bluechi* &> /dev/null || :
restorecon -R %{_rundir}/bluechi/ &> /dev/null || :
restorecon -R %{_localstatedir}/%{_rundir}/bluechi/ &> /dev/null || :

%postun selinux
if [ $1 -eq 0 ]; then
%selinux_modules_uninstall -s %{selinuxtype} bluechi
. %{_sysconfdir}/selinux/config
%selinux_modules_uninstall -s ${SELINUXTYPE} bluechi
restorecon -R %{_bindir}/bluechi* &> /dev/null || :
restorecon -R %{_rundir}/bluechi/ &> /dev/null || :
restorecon -R %{_localstatedir}/%{_rundir}/bluechi/ &> /dev/null || :
Expand Down

0 comments on commit c125ee4

Please sign in to comment.