public inbox for development@lists.ipfire.org
 help / color / mirror / Atom feed
From: Stefan Schantl <stefan.schantl@ipfire.org>
To: development@lists.ipfire.org
Subject: [PATCH 2/2] clamav: Add scriptlets to handle systemd service files.
Date: Sun, 12 Feb 2023 16:20:13 +0100	[thread overview]
Message-ID: <20230212152013.386417-2-stefan.schantl@ipfire.org> (raw)
In-Reply-To: <20230212152013.386417-1-stefan.schantl@ipfire.org>

[-- Attachment #1: Type: text/plain, Size: 1453 bytes --]

Fixes #11603.

Signed-off-by: Stefan Schantl <stefan.schantl(a)ipfire.org>
---
 clamav/clamav.nm | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/clamav/clamav.nm b/clamav/clamav.nm
index 14765e000..f941bc6b9 100644
--- a/clamav/clamav.nm
+++ b/clamav/clamav.nm
@@ -82,9 +82,42 @@ packages
 			%{name}-libs = %{thisver}
 		end
 
+		configfiles
+			%{sysconfdir}/clamd.conf
+			%{sysconfdir}/freshclam.conf
+		end
+
+		prerequires
+			systemd-units
+		end
+
 		script prein
 			%{create_users}
 		end
+
+		script postin
+			systemctl daemon-reload >/dev/null 2>&1 || :
+			systemctl enable clamav-freshclam.service >/dev/null 2>&1 || :
+			systemctl enable clamav-daemon.service >/dev/null 2>&1 || :
+		end
+
+		script preun
+			systemctl --no-reload disable clamav-freshclam.service >/dev/null 2>&1 || :
+			systemctl --no-reload disable clamav-daemon.service >/dev/null 2>&1 ||:
+
+			systemctl stop clamav-freshclam.service.service >/dev/null 2>&1 || :
+			systemctl stop clamav-daemon.service >/dev/null 2>&1 || :
+		end
+
+		script postun
+			systemctl daemon-reload >/dev/null 2>&1 || :
+		end
+
+		script postup
+			systemctl daemon-reload >/dev/null 2>&1 || :
+			systemctl try-restart clamav-freshclam.service >/dev/null 2>&1 || :
+			systemctl try-restart clamav-daemon.service >/dev/null 2>&1 || :
+		end
 	end
 
 	package %{name}-libs
-- 
2.30.2


      reply	other threads:[~2023-02-12 15:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-12 15:20 [PATCH 1/2] clamav: Proper create users and groups during package installation Stefan Schantl
2023-02-12 15:20 ` Stefan Schantl [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230212152013.386417-2-stefan.schantl@ipfire.org \
    --to=stefan.schantl@ipfire.org \
    --cc=development@lists.ipfire.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox