Signed-off-by: Stefan Schantl stefan.schantl@ipfire.org --- clamav/clamav.nm | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-)
diff --git a/clamav/clamav.nm b/clamav/clamav.nm index d4548a94a..14765e000 100644 --- a/clamav/clamav.nm +++ b/clamav/clamav.nm @@ -5,7 +5,7 @@
name = clamav version = 0.103.7 -release = 1 +release = 2
groups = System Environment/Daemons url = https://www.clamav.net @@ -55,13 +55,7 @@ build # User and group have to exist to compile the source code, # so we have to create them prepare_cmds - groupadd -g 497 -r clamupdate - useradd -u 497 -r -s /sbin/nologin -d /var/lib/clamav -M \ - -c 'Clamav database update user' -g clamupdate clamupdate - - groupadd -g 496 -r clamscan - useradd -u 496 -r -s /sbin/nologin -d / -M \ - -g clamscan clamscan + %{create_users} end
test @@ -69,11 +63,28 @@ build end end
+create_users + # Create user and group for clamupdate. + getent group clamupdate || groupadd -g 497 -r clamupdate || : + getent passwd clamupdate || useradd -u 497 -r -s /sbin/nologin \ + -d /var/lib/clamav -M -c 'Clamav database update user' \ + -g clamupdate clamupdate || : + + # Create user and group for clamscan. + getent group clamscan || groupadd -g 496 -r clamscan || : + getent passwd clamscan || useradd -u 496 -r -s /sbin/nologin \ + -d / -M -g clamscan clamscan || : +end + packages package %{name} requires %{name}-libs = %{thisver} end + + script prein + %{create_users} + end end
package %{name}-libs
Fixes #11603.
Signed-off-by: Stefan Schantl stefan.schantl@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