From 59da250552f0c964b83d0aa09530f855e9acebab Mon Sep 17 00:00:00 2001 From: Adam Piasecki Date: Thu, 24 Aug 2023 13:04:22 +0100 Subject: [PATCH] audit.spec: Replace calls to service with auditctl commands See: https://github.com/coreos/fedora-coreos-tracker/issues/1362 --- audit.spec | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/audit.spec b/audit.spec index 8ff23e0..6cf65e8 100644 --- a/audit.spec +++ b/audit.spec @@ -16,7 +16,8 @@ BuildRequires: autoconf automake libtool Requires: %{name}-libs%{?_isa} = %{version}-%{release} Requires(post): systemd coreutils procps-ng -Requires(preun): systemd initscripts-service +Requires(preun): systemd +Recommends: initscripts-service Requires(postun): systemd coreutils initscripts-service # Placing this here under the assumption that anything using the @@ -148,13 +149,19 @@ fi %preun %systemd_preun auditd.service -if [ $1 -eq 0 ]; then - /sbin/service auditd stop > /dev/null 2>&1 +if [ -e /usr/libexec/initscripts/legacy-actions/auditd/stop ] ; then + /usr/libexec/initscripts/legacy-actions/auditd/stop +else + auditctl --signal stop fi %postun if [ $1 -ge 1 ]; then - /sbin/service auditd condrestart > /dev/null 2>&1 || : + state=$(systemctl status auditd | awk '/Active:/ { print $2 }') + if [ $state = "active" ] ; then + auditctl --signal stop + systemctl start auditd + fi fi %files libs