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@gentoo.org>
EAPI=7
-inherit user
+inherit user systemd
DESCRIPTION="Download and install third-party clamav signatures"
HOMEPAGE="https://github.com/extremeshok/${PN}"
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() {
--- /dev/null
+#
+# 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
--- /dev/null
+#
+# 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