From 7104f739ec93e5998a3b2ec9497a401b63376768 Mon Sep 17 00:00:00 2001 From: Zdenek Pytela Date: Fri, 10 Jun 2022 21:35:31 +0200 Subject: [PATCH] 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 --- selinux-policy.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/selinux-policy.spec b/selinux-policy.spec index 1339984f..ca5127a4 100644 --- a/selinux-policy.spec +++ b/selinux-policy.spec @@ -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