Run restorecon for nm-dispatcher directory only if it exists

Unconditional execution can make the rpm scriptlet failing:

Running scriptlet: selinux-policy-targeted-36.9-1.fc36.noarch             4/4
/usr/sbin/restorecon: SELinux: Could not get canonical path for /etc/NetworkManager/dispatcher.d restorecon: No such file or directory.
warning: %posttrans(selinux-policy-targeted-36.9-1.fc36.noarch) scriptlet failed, exit status 255

Resolves: rhbz#2082547
This commit is contained in:
Zdenek Pytela 2022-06-10 21:35:31 +02:00
parent 75ed729ffd
commit 7104f739ec

View File

@ -583,7 +583,10 @@ exit 0
%posttrans targeted
%checkConfigConsistency targeted
%{_sbindir}/restorecon -Ri /usr/lib/sysimage/rpm /var/lib/rpm /etc/NetworkManager/dispatcher.d
%{_sbindir}/restorecon -Ri /usr/lib/sysimage/rpm /var/lib/rpm
if [ -d /etc/NetworkManager/dispatcher.d ]; then
%{_sbindir}/restorecon -Ri /etc/NetworkManager/dispatcher.d
fi
%postun targeted
if [ $1 = 0 ]; then