2019-11-06 19:04:45 +08:00
|
|
|
%global debug_package %{nil}
|
|
|
|
|
|
|
|
|
|
# container-selinux
|
2022-05-23 09:41:23 +08:00
|
|
|
%global git0 https://github.com/containers/container-selinux
|
|
|
|
|
%global commit0 99b40c5013ec2720a04b1d3579ef888281714c35
|
2019-11-06 19:04:45 +08:00
|
|
|
%global shortcommit0 %(c=%{commit0}; echo ${c:0:7})
|
|
|
|
|
|
|
|
|
|
# container-selinux stuff (prefix with ds_ for version/release etc.)
|
|
|
|
|
# Some bits borrowed from the openstack-selinux package
|
|
|
|
|
%global selinuxtype targeted
|
|
|
|
|
%global moduletype services
|
|
|
|
|
%global modulenames container
|
|
|
|
|
|
|
|
|
|
# Usage: _format var format
|
|
|
|
|
# Expand 'modulenames' into various formats as needed
|
|
|
|
|
# Format must contain '$x' somewhere to do anything useful
|
|
|
|
|
%global _format() export %1=""; for x in %{modulenames}; do %1+=%2; %1+=" "; done;
|
|
|
|
|
|
|
|
|
|
Name: container-selinux
|
|
|
|
|
Epoch: 2
|
2022-05-23 09:41:23 +08:00
|
|
|
Version: 2.163
|
|
|
|
|
Release: 1
|
2019-11-06 19:04:45 +08:00
|
|
|
License: GPLv2
|
|
|
|
|
URL: %{git0}
|
|
|
|
|
Summary: SELinux policies for container runtimes
|
|
|
|
|
Source0: %{git0}/archive/%{commit0}/%{name}-%{shortcommit0}.tar.gz
|
2022-05-23 09:41:23 +08:00
|
|
|
#fix ERROR 'unknown class lockdown' at token ';'
|
|
|
|
|
Patch0: fix.patch
|
2019-11-06 19:04:45 +08:00
|
|
|
BuildArch: noarch
|
2022-05-23 09:41:23 +08:00
|
|
|
BuildRequires: git-core
|
2019-11-06 19:04:45 +08:00
|
|
|
BuildRequires: pkgconfig(systemd)
|
2022-05-23 09:41:23 +08:00
|
|
|
BuildRequires: selinux-policy >= %_selinux_policy_version
|
|
|
|
|
BuildRequires: selinux-policy-devel >= %_selinux_policy_version
|
2019-11-06 19:04:45 +08:00
|
|
|
# RE: rhbz#1195804 - ensure min NVR for selinux-policy
|
2022-05-23 09:41:23 +08:00
|
|
|
Requires: selinux-policy >= %_selinux_policy_version
|
|
|
|
|
Requires(post): selinux-policy-base >= %_selinux_policy_version
|
|
|
|
|
Requires(post): selinux-policy-targeted >= %_selinux_policy_version
|
2019-11-06 19:04:45 +08:00
|
|
|
Requires(post): policycoreutils
|
|
|
|
|
Requires(post): libselinux-utils
|
|
|
|
|
Requires(post): sed
|
2022-05-23 09:41:23 +08:00
|
|
|
Obsoletes: %{name} <= 2:1.12.5-14
|
2019-11-06 19:04:45 +08:00
|
|
|
Obsoletes: docker-selinux <= 2:1.12.4-28
|
2022-05-23 09:41:23 +08:00
|
|
|
Provides: docker-selinux = %{?epoch:%{epoch}:}%{version}-%{release}
|
2019-11-06 19:04:45 +08:00
|
|
|
|
|
|
|
|
%description
|
|
|
|
|
SELinux policy modules for use with container runtimes.
|
|
|
|
|
|
|
|
|
|
%prep
|
2021-08-11 19:24:11 +08:00
|
|
|
%autosetup -n %{name}-%{commit0} -p1
|
2019-11-06 19:04:45 +08:00
|
|
|
|
|
|
|
|
%build
|
|
|
|
|
make
|
|
|
|
|
|
|
|
|
|
%install
|
|
|
|
|
# install policy modules
|
|
|
|
|
%_format MODULES $x.pp.bz2
|
|
|
|
|
install -d %{buildroot}%{_datadir}/selinux/packages
|
|
|
|
|
install -d -p %{buildroot}%{_datadir}/selinux/devel/include/services
|
|
|
|
|
install -p -m 644 container.if %{buildroot}%{_datadir}/selinux/devel/include/services
|
|
|
|
|
install -m 0644 $MODULES %{buildroot}%{_datadir}/selinux/packages
|
2022-05-23 09:41:23 +08:00
|
|
|
install -d %{buildroot}/%{_datadir}/containers/selinux
|
|
|
|
|
install -m 644 container_contexts %{buildroot}/%{_datadir}/containers/selinux/contexts
|
2019-11-06 19:04:45 +08:00
|
|
|
|
|
|
|
|
%check
|
|
|
|
|
|
2022-05-23 09:41:23 +08:00
|
|
|
%pre
|
|
|
|
|
%selinux_relabel_pre -s %{selinuxtype}
|
|
|
|
|
|
2019-11-06 19:04:45 +08:00
|
|
|
%post
|
|
|
|
|
# Install all modules in a single transaction
|
|
|
|
|
if [ $1 -eq 1 ]; then
|
2022-05-23 09:41:23 +08:00
|
|
|
%{_sbindir}/setsebool -P -N virt_use_nfs=1 virt_sandbox_use_all_caps=1
|
2019-11-06 19:04:45 +08:00
|
|
|
fi
|
|
|
|
|
%_format MODULES %{_datadir}/selinux/packages/$x.pp.bz2
|
|
|
|
|
%{_sbindir}/semodule -n -s %{selinuxtype} -r container 2> /dev/null
|
|
|
|
|
%{_sbindir}/semodule -n -s %{selinuxtype} -d docker 2> /dev/null
|
|
|
|
|
%{_sbindir}/semodule -n -s %{selinuxtype} -d gear 2> /dev/null
|
2022-05-23 09:41:23 +08:00
|
|
|
%selinux_modules_install -s %{selinuxtype} $MODULES
|
2019-11-06 19:04:45 +08:00
|
|
|
. %{_sysconfdir}/selinux/config
|
|
|
|
|
sed -e "\|container_file_t|h; \${x;s|container_file_t||;{g;t};a\\" -e "container_file_t" -e "}" -i /etc/selinux/${SELINUXTYPE}/contexts/customizable_types
|
|
|
|
|
matchpathcon -qV %{_sharedstatedir}/containers || restorecon -R %{_sharedstatedir}/containers &> /dev/null || :
|
|
|
|
|
|
|
|
|
|
%postun
|
|
|
|
|
if [ $1 -eq 0 ]; then
|
2022-05-23 09:41:23 +08:00
|
|
|
%selinux_modules_uninstall -s %{selinuxtype} %{modulenames} docker
|
2019-11-06 19:04:45 +08:00
|
|
|
fi
|
|
|
|
|
|
2022-05-23 09:41:23 +08:00
|
|
|
%posttrans
|
|
|
|
|
%selinux_relabel_post -s %{selinuxtype}
|
|
|
|
|
|
2019-11-06 19:04:45 +08:00
|
|
|
#define license tag if not already defined
|
|
|
|
|
%{!?_licensedir:%global license %doc}
|
|
|
|
|
|
|
|
|
|
%files
|
|
|
|
|
%doc README.md
|
|
|
|
|
%{_datadir}/selinux/*
|
2022-05-23 09:41:23 +08:00
|
|
|
%dir %{_datadir}/containers/selinux
|
|
|
|
|
%{_datadir}/containers/selinux/contexts
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%triggerpostun -- container-selinux < 2:2.162.1-3
|
|
|
|
|
if %{_sbindir}/selinuxenabled ; then
|
|
|
|
|
echo "Fixing Rootless SELinux labels in homedir"
|
|
|
|
|
%{_sbindir}/restorecon -R /home/*/.local/share/containers/storage/overlay* 2> /dev/null
|
|
|
|
|
fi
|
2019-11-06 19:04:45 +08:00
|
|
|
|
|
|
|
|
%changelog
|
2022-05-23 09:41:23 +08:00
|
|
|
* Mon May 23 2022 duyiwei <duyiwei@kylinos.cn> - 2.163-1
|
|
|
|
|
- Update container-selinux to v2.163.0
|
|
|
|
|
|
2021-10-26 14:05:01 +08:00
|
|
|
* Tue Oct 26 2021 caodongxia <caodongxia@huawei.com> - 2.138-5
|
|
|
|
|
- DESC: systemd_dbus_chat_resolved has been deprecated, use systemd_chat_resolved instead
|
|
|
|
|
|
2021-08-11 19:24:11 +08:00
|
|
|
* Wed Aug 11 2021 chenyanpanHW <chenyanpan@huawei.com> - 2.138-4
|
|
|
|
|
- DESC: delete -Sgit from %autosetup, and delete BuildRequires git
|
|
|
|
|
|
2020-12-14 11:02:32 +08:00
|
|
|
* Mon Dec 14 2020 openEuler Buildteam <buildteam@openeuler.org> - 2.138-2
|
|
|
|
|
- Update container-selinux spec
|
|
|
|
|
|
2020-08-19 17:00:39 +08:00
|
|
|
* Wed Aug 19 2020 openEuler Buildteam <buildteam@openeuler.org> - 2.138-1
|
2020-12-14 11:02:32 +08:00
|
|
|
- Update container-selinux to v2.138.1
|
2020-08-19 17:00:39 +08:00
|
|
|
|
|
|
|
|
* Sat Sep 14 2019 openEuler Buildteam <buildteam@openeuler.org> - 2.73-3
|
2019-11-06 19:04:45 +08:00
|
|
|
- Package init
|