]> git.ipfire.org Git - ipfire-3.x.git/commitdiff
clamav: Add scriptlets to handle systemd service files.
authorStefan Schantl <stefan.schantl@ipfire.org>
Sun, 12 Feb 2023 15:20:13 +0000 (16:20 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 16 Feb 2023 11:25:33 +0000 (11:25 +0000)
Fixes #11603.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
clamav/clamav.nm

index 14765e000ff5b84292ad2d63a1a041f24cc838c5..f941bc6b980b08209b00e5cf1e405fe580d41ba6 100644 (file)
@@ -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