Run restorecon with "-i" not to report errors

The %posttrans scriptlet contains explicit call to restorecon
to restore context of files/directories which are not handled
properly on updates. When a file or directory does not exist,
an error is reported:

/usr/sbin/restorecon: lstat(/etc/NetworkManager/dispatcher.d) failed: No such file or directory
warning: %posttrans(selinux-policy-targeted-36.8-1.fc36.noarch) scriptlet failed, exit status 255

Error in POSTTRANS scriptlet in rpm package selinux-policy-targeted

With the "-i" switch, restorecon does not report an error.

Resolves: rhbz#2082547
This commit is contained in:
Zdenek Pytela 2022-05-06 14:33:26 +02:00
parent 0e9b088744
commit 59a2a4bfc4

View File

@ -23,7 +23,7 @@
%define CHECKPOLICYVER 3.2 %define CHECKPOLICYVER 3.2
Summary: SELinux policy configuration Summary: SELinux policy configuration
Name: selinux-policy Name: selinux-policy
Version: 37.1 Version: 38.1
Release: 1%{?dist} Release: 1%{?dist}
License: GPLv2+ License: GPLv2+
Source: %{giturl}/archive/%{commit}/%{name}-%{shortcommit}.tar.gz Source: %{giturl}/archive/%{commit}/%{name}-%{shortcommit}.tar.gz
@ -583,7 +583,7 @@ exit 0
%posttrans targeted %posttrans targeted
%checkConfigConsistency targeted %checkConfigConsistency targeted
%{_sbindir}/restorecon -R /usr/lib/sysimage/rpm /var/lib/rpm /etc/NetworkManager/dispatcher.d %{_sbindir}/restorecon -Ri /usr/lib/sysimage/rpm /var/lib/rpm /etc/NetworkManager/dispatcher.d
%postun targeted %postun targeted
if [ $1 = 0 ]; then if [ $1 = 0 ]; then
@ -696,7 +696,7 @@ exit 0
%posttrans minimum %posttrans minimum
%checkConfigConsistency minimum %checkConfigConsistency minimum
%{_sbindir}/restorecon -R /usr/lib/sysimage/rpm /var/lib/rpm /etc/NetworkManager/dispatcher.d %{_sbindir}/restorecon -Ri /usr/lib/sysimage/rpm /var/lib/rpm /etc/NetworkManager/dispatcher.d
%postun minimum %postun minimum
if [ $1 = 0 ]; then if [ $1 = 0 ]; then
@ -770,7 +770,7 @@ exit 0
%posttrans mls %posttrans mls
%checkConfigConsistency mls %checkConfigConsistency mls
%{_sbindir}/restorecon -R /usr/lib/sysimage/rpm /var/lib/rpm /etc/NetworkManager/dispatcher.d %{_sbindir}/restorecon -Ri /usr/lib/sysimage/rpm /var/lib/rpm /etc/NetworkManager/dispatcher.d
%postun mls %postun mls
if [ $1 = 0 ]; then if [ $1 = 0 ]; then
@ -813,6 +813,9 @@ exit 0
%endif %endif
%changelog %changelog
* Fri May 06 2022 Zdenek Pytela <zpytela@redhat.com> - 38.1-1
- run restorecon with "-i" not to report errors
* Mon May 02 2022 Zdenek Pytela <zpytela@redhat.com> - 37.1-1 * Mon May 02 2022 Zdenek Pytela <zpytela@redhat.com> - 37.1-1
- Fix users for SELinux userspace 3.4 - Fix users for SELinux userspace 3.4
- Label /var/run/machine-id as machineid_t - Label /var/run/machine-id as machineid_t