Don't do "live" operations during rpm-ostree composes

Package installation happens "offline" when using rpm-ostree thus the
scriptlets should not assume a running system.
This commit is contained in:
Timothée Ravier 2024-01-25 10:40:16 +01:00
parent e3e7bad0ce
commit 81c52d8251

View File

@ -138,6 +138,10 @@ rm -f rules/Makefile*
%post %post
%systemd_post auditd.service %systemd_post auditd.service
# Do not perform service start/restart when running during an rpm-ostree compose
if [[ -f /run/ostree-booted ]]: then
exit 0
fi
# If an upgrade, restart it if it's running # If an upgrade, restart it if it's running
if [ $1 -eq 2 ]; then if [ $1 -eq 2 ]; then
state=$(systemctl status auditd | awk '/Active:/ { print $2 }') state=$(systemctl status auditd | awk '/Active:/ { print $2 }')
@ -167,8 +171,11 @@ if [ "$files" -eq 0 ] ; then
else else
install -m 0600 -u 0 -g 0 /dev/null /etc/audit/rules.d/audit.rules install -m 0600 -u 0 -g 0 /dev/null /etc/audit/rules.d/audit.rules
fi fi
# Only load the new rules if not running during an rpm-ostree compose
if [[ ! -f /run/ostree-booted ]]: then
# Make the new rules active # Make the new rules active
augenrules --load || true augenrules --load || true
fi
fi fi
%preun %preun