diff --git a/app-antivirus/clamav-unofficial-sigs/clamav-unofficial-sigs-6.0.1.ebuild b/app-antivirus/clamav-unofficial-sigs/clamav-unofficial-sigs-6.0.1-r1.ebuild similarity index 80% rename from app-antivirus/clamav-unofficial-sigs/clamav-unofficial-sigs-6.0.1.ebuild rename to app-antivirus/clamav-unofficial-sigs/clamav-unofficial-sigs-6.0.1-r1.ebuild index 6fc6ec0b574c7..34c988c3a2f19 100644 --- a/app-antivirus/clamav-unofficial-sigs/clamav-unofficial-sigs-6.0.1.ebuild +++ b/app-antivirus/clamav-unofficial-sigs/clamav-unofficial-sigs-6.0.1-r1.ebuild @@ -7,12 +7,12 @@ inherit user DESCRIPTION="Download and install third-party clamav signatures" HOMEPAGE="https://github.com/extremeshok/${PN}" -SRC_URI="https://github.com/extremeshok/clamav-unofficial-sigs/archive/${PV}.tar.gz -> ${P}.tar.gz" +SRC_URI="${HOMEPAGE}/archive/${PV}.tar.gz -> ${P}.tar.gz" LICENSE="BSD" SLOT="0" KEYWORDS="~amd64 ~x86" -IUSE="" +IUSE="cron" # The script relies on either net-misc/socat, or Perl's # IO::Socket::UNIX. We already depend on Perl, and Gentoo's Perl ships @@ -41,6 +41,17 @@ src_install() { doman "${FILESDIR}/${PN}.8" dodoc README.md + + if use cron; then + # Beware, this directory is not completely standard. However, + # we need this to run as "clamav" with a non-default shell and + # home directory (bug 694054), and this seems like the most + # reliable way to accomplish that. + insinto "/etc/cron.d" + newins "${FILESDIR}/${PN}.crond" "${PN}" + else + dodoc "${FILESDIR}/${PN}.crond" + fi } pkg_preinst() { diff --git a/app-antivirus/clamav-unofficial-sigs/files/clamav-unofficial-sigs.crond b/app-antivirus/clamav-unofficial-sigs/files/clamav-unofficial-sigs.crond new file mode 100644 index 0000000000000..49ef1db3034ba --- /dev/null +++ b/app-antivirus/clamav-unofficial-sigs/files/clamav-unofficial-sigs.crond @@ -0,0 +1,19 @@ +# +# Run clamav-unofficial-sigs hourly. +# +# This file should be copied to /etc/cron.d rather than, say, +# /etc/cron.hourly because it needs to run as the clamav user (to +# alter the databases), but the default settings for that user in +# Gentoo are insufficient (see bug 694054). +# +# In particular, the clamav user needs a Bash shell and a home +# directory since clamav-unofficial-sigs is written in Bash and +# because otherwise cron will complain about trying to chdir to a +# nonexistent home directory. When run out of /etc/cron.d, we can set +# HOME and SHELL to appropriate values, unlike with scripts in +# /etc/cron.hourly. +# +HOME=/var/lib/clamav-unofficial-sigs +SHELL=/bin/bash + +01 * * * * clamav /usr/sbin/clamav-unofficial-sigs.sh diff --git a/app-antivirus/clamav-unofficial-sigs/metadata.xml b/app-antivirus/clamav-unofficial-sigs/metadata.xml index cb13edbbb596c..828e566ffcab0 100644 --- a/app-antivirus/clamav-unofficial-sigs/metadata.xml +++ b/app-antivirus/clamav-unofficial-sigs/metadata.xml @@ -4,6 +4,14 @@ mjo@gentoo.org + + + Install an hourly cron job to /etc/cron.d that runs the + updates as the clamav user (instead of root), with an + appropriate home directory and shell. The same cron job + is installed as documentation when this flag is disabled. + + unofficial-sigs extremeshok/clamav-unofficial-sigs