2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-11-21 01:42:15 +00:00
Files
xcat-core/xCAT-probe/xCAT-probe.spec
T
Daniel Hilst db07a23349 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>
2026-10-15 12:06:01 -03:00

91 lines
2.5 KiB
RPMSpec

Summary: xCAT diagnostic tool
Name: xCAT-probe
Version: %{?version:%{version}}%{!?version:%(cat Version)}
Release: %{?release:%{release}}%{!?release:%(cat Release)}
Epoch: 4
License: EPL
Group: Applications/System
Source: xCAT-probe-%{version}.tar.gz
Packager: IBM Corp.
Vendor: IBM Corp.
Distribution: %{?_distribution:%{_distribution}}%{!?_distribution:%{_vendor}}
Prefix: /opt/xcat
BuildRoot: /var/tmp/%{name}-%{version}-%{release}-root
Requires: xCAT-client = 4:%{version}-%{release}
# Disable shebang mangling of python scripts
%undefine __brp_mangle_shebangs
%ifos linux
BuildArch: noarch
%endif
%ifos linux
#Below tools are required by sub-command 'xcatmn'
Requires: /usr/bin/nslookup
Requires: /usr/bin/tftp
Requires: /usr/bin/wget
# Tool detect_dhcpd requires tcpdump
Requires: /usr/sbin/tcpdump
# TCP listener checks use ss, which is packaged differently on SUSE.
%if 0%{?suse_version}
Requires: iproute2
%else
Requires: iproute
%endif
%endif
%description
xCAT-probe provides a toolkits to probe potential issues with the xCAT cluster.
%prep
%setup -q -n xCAT-probe
%build
# Convert pods to man pages and html pages
%install
# The install phase puts all of the files in the paths they should be in when the rpm is
# installed on a system. The RPM_BUILD_ROOT is a simulated root file system and usually
# has a value like: /var/tmp/xCAT-probe-2.0-snap200802270932-root
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/
cp -r lib $RPM_BUILD_ROOT/%{prefix}/probe/
cp -r scripts $RPM_BUILD_ROOT/%{prefix}/probe/
%clean
# This step does not happen until *after* the %files packaging below
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
#%doc LICENSE.html
# Just package everything that has been copied into RPM_BUILD_ROOT
%{prefix}
%changelog
* Thu Aug 30 2018 - GONG Jie <gongjie@linux.vnet.ibm.com>
- Add /usr/sbin/tcpdump as requirement
* Fri Jul 1 2016 - huweihua <huweihua@cn.ibm.com>
- "Create xCAT probe package"
%post
if [ -e %{prefix}/probe/subcmds/bin/switchprobe ]; then
rm -rf %{prefix}/probe/subcmds/bin/switchprobe
fi
%preun
#remove the bin directory if not on upgrade
if [ "$1" != "1" ]; then
rm -rf %{prefix}/probe/subcmds/bin/
fi