2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-11-19 08:52:15 +00:00

fix(xcat-core): rpm does not own the probe subcmds/bin directory

The %post of xCAT-probe created /opt/xcat/probe/subcmds/bin, so the
directory belonged to no package and carried usr_t from its parent rather
than the bin_t the policy gives /opt/.*/bin. It was the only path under
/opt/xcat that restorecon reported as pending, on every management node.

%install now creates the directory, so rpm owns it and labels it from the
policy at install, as the Debian package already does through debian/dirs.
The %post keeps removing the obsolete switchprobe file it finds there.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
This commit is contained in:
Daniel Hilst
2026-10-15 12:06:01 -03:00
parent e2bae62e61
commit db07a23349
+4 -2
View File
@@ -52,6 +52,10 @@ rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/%{prefix}/bin
mkdir -p $RPM_BUILD_ROOT/%{prefix}/probe/
# xcatprobe drops a switchprobe symlink in here at run time. rpm must own the
# directory, or it takes the context of its parent instead of the one the
# policy gives /opt/.*/bin, and nothing relabels it afterwards.
mkdir -p $RPM_BUILD_ROOT/%{prefix}/probe/subcmds/bin
cp xcatprobe $RPM_BUILD_ROOT/%{prefix}/bin
cp -r subcmds $RPM_BUILD_ROOT/%{prefix}/probe/
@@ -77,8 +81,6 @@ rm -rf $RPM_BUILD_ROOT
%post
if [ -e %{prefix}/probe/subcmds/bin/switchprobe ]; then
rm -rf %{prefix}/probe/subcmds/bin/switchprobe
else
mkdir -p %{prefix}/probe/subcmds/bin/
fi
%preun