Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 475858

Summary: app-antivirus/clamav: import unit file for systemd
Product: Gentoo Linux Reporter: Pacho Ramos <pacho>
Component: Current packagesAssignee: Net-Mail Packages <net-mail+disabled>
Status: RESOLVED FIXED    
Severity: enhancement CC: antivirus, lxnay
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 468898    
Attachments: clamav-milter.service
clamd.service
clamd_at.service

Description Pacho Ramos gentoo-dev 2013-07-05 16:46:01 UTC
From systemd-love overlay. I will commit in a week if nobody disagrees. Thanks

# diff -u /usr/portage/app-antivirus/clamav/clamav-0.97.8.ebuild /usr/portage/local/layman/systemd-love/app-antivirus/clamav/clamav-0.97.8.ebuild 
--- /usr/portage/app-antivirus/clamav/clamav-0.97.8.ebuild	2013-06-12 23:31:02.000000000 +0200
+++ /usr/portage/local/layman/systemd-love/app-antivirus/clamav/clamav-0.97.8.ebuild	2013-07-05 18:38:32.000000000 +0200
@@ -1,10 +1,10 @@
 # Copyright 1999-2013 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/app-antivirus/clamav/clamav-0.97.8.ebuild,v 1.2 2013/06/12 21:13:19 radhermit Exp $
+# $Header: /var/cvsroot/gentoo-x86/app-antivirus/clamav/clamav-0.97.8.ebuild,v 1.1 2013/04/23 18:02:01 lordvan Exp $
 
 EAPI=5
 
-inherit eutils flag-o-matic user
+inherit eutils flag-o-matic user systemd
 
 DESCRIPTION="Clam Anti-Virus Scanner"
 HOMEPAGE="http://www.clamav.net/"
@@ -31,6 +31,10 @@
 
 DOCS=( AUTHORS BUGS ChangeLog FAQ INSTALL NEWS README UPGRADE )
 
+PATCHES=(
+	"${FILESDIR}"/${PN}-0.97-nls.patch
+)
+
 pkg_setup() {
 	enewgroup clamav
 	enewuser clamav -1 -1 /dev/null clamav
@@ -39,7 +43,6 @@
 src_prepare() {
 	use ppc64 && append-flags -mminimal-toic
 	use uclibc && export ac_cv_type_error_t=yes
-	epatch "${FILESDIR}"/${PN}-0.97-nls.patch
 }
 
 src_configure() {
@@ -64,6 +67,10 @@
 	newinitd "${FILESDIR}"/clamd.initd-r5 clamd
 	newconfd "${FILESDIR}"/clamd.conf clamd
 
+	systemd_dotmpfilesd "${FILESDIR}/tmpfiles.d/clamav.conf"
+	systemd_newunit "${FILESDIR}/clamd_at.service" "clamd@.service"
+	systemd_dounit "${FILESDIR}/clamd.service"
+
 	keepdir /var/lib/clamav
 	fowners clamav:clamav /var/lib/clamav
 	keepdir /var/log/clamav
@@ -75,15 +82,15 @@
 
 	# Modify /etc/{clamd,freshclam}.conf to be usable out of the box
 	sed -i -e "s:^\(Example\):\# \1:" \
-		-e "s:.*\(PidFile\) .*:\1 ${EPREFIX}/var/run/clamav/clamd.pid:" \
-		-e "s:.*\(LocalSocket\) .*:\1 ${EPREFIX}/var/run/clamav/clamd.sock:" \
+		-e "s:.*\(PidFile\) .*:\1 ${EPREFIX}/run/clamav/clamd.pid:" \
+		-e "s:.*\(LocalSocket\) .*:\1 ${EPREFIX}/run/clamav/clamd.sock:" \
 		-e "s:.*\(User\) .*:\1 clamav:" \
 		-e "s:^\#\(LogFile\) .*:\1 ${EPREFIX}/var/log/clamav/clamd.log:" \
 		-e "s:^\#\(LogTime\).*:\1 yes:" \
 		-e "s:^\#\(AllowSupplementaryGroups\).*:\1 yes:" \
 		"${ED}"/etc/clamd.conf
 	sed -i -e "s:^\(Example\):\# \1:" \
-		-e "s:.*\(PidFile\) .*:\1 ${EPREFIX}/var/run/clamav/freshclam.pid:" \
+		-e "s:.*\(PidFile\) .*:\1 ${EPREFIX}/run/clamav/freshclam.pid:" \
 		-e "s:.*\(DatabaseOwner\) .*:\1 clamav:" \
 		-e "s:^\#\(UpdateLogFile\) .*:\1 ${EPREFIX}/var/log/clamav/freshclam.log:" \
 		-e "s:^\#\(NotifyClamd\).*:\1 ${EPREFIX}/etc/clamd.conf:" \
@@ -96,10 +103,10 @@
 		# inet: which we want to leave
 		dodoc "${FILESDIR}"/clamav-milter.README.gentoo
 		sed -i -e "s:^\(Example\):\# \1:" \
-			-e "s:.*\(PidFile\) .*:\1 ${EPREFIX}/var/run/clamav/clamav-milter.pid:" \
-			-e "s+^\#\(ClamdSocket\) .*+\1 unix:${EPREFIX}/var/run/clamav/clamd.sock+" \
+			-e "s:.*\(PidFile\) .*:\1 ${EPREFIX}/run/clamav/clamav-milter.pid:" \
+			-e "s+^\#\(ClamdSocket\) .*+\1 unix:${EPREFIX}/run/clamav/clamd.sock+" \
 			-e "s:.*\(User\) .*:\1 clamav:" \
-			-e "s+^\#\(MilterSocket\) /.*+\1 unix:${EPREFIX}/var/run/clamav/clamav-milter.sock+" \
+			-e "s+^\#\(MilterSocket\) /.*+\1 unix:${EPREFIX}/run/clamav/clamav-milter.sock+" \
 			-e "s:^\#\(AllowSupplementaryGroups\).*:\1 yes:" \
 			-e "s:^\#\(LogFile\) .*:\1 ${EPREFIX}/var/log/clamav/clamav-milter.log:" \
 			"${ED}"/etc/clamav-milter.conf
@@ -107,6 +114,8 @@
 			MILTER_NICELEVEL=19
 			START_MILTER=no
 		EOF
+
+		systemd_dounit "${FILESDIR}/clamav-milter.service"
 	fi
 
 	prune_libtool_files --all


Reproducible: Always
Comment 1 Pacho Ramos gentoo-dev 2013-07-05 16:46:35 UTC
Created attachment 352682 [details]
clamav-milter.service
Comment 2 Pacho Ramos gentoo-dev 2013-07-05 16:46:49 UTC
Created attachment 352684 [details]
clamd.service
Comment 3 Pacho Ramos gentoo-dev 2013-07-05 16:46:59 UTC
Created attachment 352686 [details]
clamd_at.service
Comment 4 Tim Harder gentoo-dev 2013-07-05 21:16:02 UTC
(In reply to Pacho Ramos from comment #0)
> From systemd-love overlay. I will commit in a week if nobody disagrees.
> Thanks
> 
> +PATCHES=(
> +	"${FILESDIR}"/${PN}-0.97-nls.patch
> +)
> +

Nothing in the ebuild supports the PATCHES array so now this patch won't get applied.

IMO, when you're adding systemd support just do that, don't change other parts of the ebuild unless they're clearly broken or wrong.
Comment 5 Pacho Ramos gentoo-dev 2013-07-06 06:21:23 UTC
That is true, thanks.

What about the /var/run -> /run movement? I think /var/run is being deprecated, no?
Comment 6 Tim Harder gentoo-dev 2013-07-06 08:32:14 UTC
(In reply to Pacho Ramos from comment #5)
> What about the /var/run -> /run movement? I think /var/run is being
> deprecated, no?

The problem is clamav has a bunch of non-linux prefix keywords which probably don't have /run directories so that could cause issues for them.
Comment 7 Pacho Ramos gentoo-dev 2013-07-06 09:16:06 UTC
+*clamav-0.97.8-r1 (06 Jul 2013)
+
+  06 Jul 2013; Pacho Ramos <pacho@gentoo.org> +clamav-0.97.8-r1.ebuild,
+  +files/clamav-milter.service, +files/clamd.service, +files/clamd_at.service,
+  +files/tmpfiles.d/clamav.conf:
+  Add unit files (#475858, thanks to Tim Harder for his help)
+


OK, that only adds unit files then
Comment 8 Pacho Ramos gentoo-dev 2013-07-27 07:52:37 UTC
*** Bug 470722 has been marked as a duplicate of this bug. ***