Only run modprobe in %post if the system is running

When the package is installed e.g., in a bootc
container, it does not make sense to load kernel
modules because the kernel is not yet booted.

Resolves: RHEL-78695
This commit is contained in:
Pavol Žáčik 2025-02-14 09:26:34 +01:00 committed by Pavol Zacik
parent a51b046922
commit dc3cd7581a

View File

@ -114,7 +114,7 @@ echo 'i2c-dev' > $RPM_BUILD_ROOT%{_prefix}/lib/modules-load.d/%{name}.conf
%post
# load i2c-dev after the first install
if [ "$1" = 1 ] ; then
if [ "$1" = 1 ] && systemctl is-system-running > /dev/null; then
/usr/sbin/modprobe i2c-dev
fi
exit 0