2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-11-21 18:02:18 +00:00

fix(xcat-core): the erase of xCAT-selinux leaves three files unlabeled_t

%postun removed the module and relabelled nothing, so the two entrypoint
types left the policy while three files still carried them. The files
became unlabeled_t, and /install kept public_content_t, which the stock
policy does not define for it.

%preun now saves the file contexts, because %pre does not run on an erase,
and %postun relabels after the module is removed, on an erase only.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
This commit is contained in:
Daniel Hilst
2026-10-14 17:33:44 -03:00
parent d3739aa512
commit 7f5cf08ad8
+8
View File
@@ -49,8 +49,16 @@ install -m 0644 xcat.pp.bz2 $RPM_BUILD_ROOT%{_datadir}/selinux/packages/targeted
%post
%selinux_modules_install -s targeted %{_datadir}/selinux/packages/targeted/xcat.pp.bz2
%preun
# %pre does not run on an erase, and %postun needs the snapshot to find the
# files whose context the removed module defined.
%selinux_relabel_pre -s targeted
%postun
%selinux_modules_uninstall -s targeted xcat
if [ $1 -eq 0 ]; then
%selinux_relabel_post -s targeted
fi
%posttrans
%selinux_relabel_post -s targeted