Don't trigger udev if socket doesn't exist

On rpm-ostree systems, we don't want scriptlets to affect the running
system because a major part of the value is "background updates".
Scriptlets are run in a containerized environment where e.g. udev is not
available.

Add a check for the udev socket before triggering it to handle this.
This also helps the container use case.

See also: https://bugzilla.redhat.com/show_bug.cgi?id=1352154
See also: https://src.fedoraproject.org/rpms/udisks2/pull-request/3
See also: https://github.com/coreos/fedora-coreos-tracker/issues/703
This commit is contained in:
Jonathan Lebon 2020-12-21 10:32:45 -05:00 committed by mruprich
parent 75916227cf
commit 60b7a73608

View File

@ -184,7 +184,11 @@ getent group usbmon >/dev/null || groupadd -r usbmon
%post cli
%{?ldconfig}
/usr/bin/udevadm trigger --subsystem-match=usbmon
# skip triggering if udevd isn't even accessible, e.g. containers or
# rpm-ostree-based systems
if [ -S /run/udev/control ]; then
/usr/bin/udevadm trigger --subsystem-match=usbmon
fi
%ldconfig_postun cli