commit:     3660c590ebed5b26bcb972d4feab4ecdb024aad1
Author:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Wed Nov  6 15:49:43 2019 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Wed Nov  6 15:56:57 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3660c590

app-antivirus/clamav-unofficial-sigs: new revision with systemd timer.

For the same reason we introduced an /etc/cron.d job in the previous
revision, it makes sense to include a systemd timer. The optimal
settings for the update script are a bit tricky to get right, and
since we run as the "clamav" user, they're both non-default and not
entirely under our control.

I haven't tested this (no systemd), but what could possibly go wrong?

Bug: https://bugs.gentoo.org/694120
Package-Manager: Portage-2.3.76, Repoman-2.3.16
Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>

 ...1-r1.ebuild => clamav-unofficial-sigs-6.0.1-r2.ebuild} |  7 ++++++-
 .../files/clamav-unofficial-sigs.service                  | 15 +++++++++++++++
 .../files/clamav-unofficial-sigs.timer                    | 12 ++++++++++++
 3 files changed, 33 insertions(+), 1 deletion(-)

diff --git 
a/app-antivirus/clamav-unofficial-sigs/clamav-unofficial-sigs-6.0.1-r1.ebuild 
b/app-antivirus/clamav-unofficial-sigs/clamav-unofficial-sigs-6.0.1-r2.ebuild
similarity index 89%
rename from 
app-antivirus/clamav-unofficial-sigs/clamav-unofficial-sigs-6.0.1-r1.ebuild
rename to 
app-antivirus/clamav-unofficial-sigs/clamav-unofficial-sigs-6.0.1-r2.ebuild
index 34c988c3a2f..eb1fdfbcc04 100644
--- 
a/app-antivirus/clamav-unofficial-sigs/clamav-unofficial-sigs-6.0.1-r1.ebuild
+++ 
b/app-antivirus/clamav-unofficial-sigs/clamav-unofficial-sigs-6.0.1-r2.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=7
 
-inherit user
+inherit user systemd
 
 DESCRIPTION="Download and install third-party clamav signatures"
 HOMEPAGE="https://github.com/extremeshok/${PN}";
@@ -52,6 +52,11 @@ src_install() {
        else
                dodoc "${FILESDIR}/${PN}.crond"
        fi
+
+       # Install the systemd service and timer unconditionally, because
+       # the timer is disabled by default (and won't annoy people until
+       # after they've configured the script).
+       systemd_dounit "${FILESDIR}/${PN}".{service,timer}
 }
 
 pkg_preinst() {

diff --git 
a/app-antivirus/clamav-unofficial-sigs/files/clamav-unofficial-sigs.service 
b/app-antivirus/clamav-unofficial-sigs/files/clamav-unofficial-sigs.service
new file mode 100644
index 00000000000..ed9fa7e9f04
--- /dev/null
+++ b/app-antivirus/clamav-unofficial-sigs/files/clamav-unofficial-sigs.service
@@ -0,0 +1,15 @@
+#
+# Service file corresponding to clamav-unofficial-sigs.timer.
+# Upstream provides a similar file, but with the wrong path
+# and running as root, so it's just less of a headache to
+# include our own.
+#
+
+[Unit]
+Description=ClamAV unofficial signature update service
+Documentation=man:clamav-unofficial-sigs(8)
+
+[Service]
+ExecStart=bash /usr/sbin/clamav-unofficial-sigs.sh
+User=clamav
+WorkingDirectory=/var/lib/clamav-unofficial-sigs

diff --git 
a/app-antivirus/clamav-unofficial-sigs/files/clamav-unofficial-sigs.timer 
b/app-antivirus/clamav-unofficial-sigs/files/clamav-unofficial-sigs.timer
new file mode 100644
index 00000000000..299ffd84132
--- /dev/null
+++ b/app-antivirus/clamav-unofficial-sigs/files/clamav-unofficial-sigs.timer
@@ -0,0 +1,12 @@
+#
+# Run clamav-unofficial-sigs.service every hour, at 45 minutes past the hour.
+# We do not include an [Install] section because this package does not
+# technically depend on clamav to function.
+#
+
+[Unit]
+Description=ClamAV unofficial signature update timer
+Documentation=man:clamav-unofficial-sigs(8)
+
+[Timer]
+OnCalendar=*-*-* *:45:00

Reply via email to