Skip to content

Commit

Permalink
app-antivirus/clamav: new logrotate files for v0.103.0.
Browse files Browse the repository at this point in the history
Now that each ClamAV daemon has its own OpenRC service, we
separate the logrotate entries as well. This fixes an old
bug where we relied on the service manager being OpenRC.

Closes: https://bugs.gentoo.org/508520
Closes: https://bugs.gentoo.org/709780
Package-Manager: Portage-3.0.4, Repoman-3.0.1
Signed-off-by: Michael Orlitzky <[email protected]>
  • Loading branch information
orlitzky committed Sep 23, 2020
1 parent 20979a5 commit 7662242
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app-antivirus/clamav/clamav-0.103.0.ebuild
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,10 @@ src_install() {
fi

insinto /etc/logrotate.d
newins "${FILESDIR}"/clamav.logrotate clamav
newins "${FILESDIR}/clamd.logrotate" clamd
newins "${FILESDIR}/freshclam.logrotate" freshclam
use milter && \
newins "${FILESDIR}/clamav-milter.logrotate" clamav-milter

# Modify /etc/{clamd,freshclam}.conf to be usable out of the box
sed -i -e "s:^\(Example\):\# \1:" \
Expand Down
25 changes: 25 additions & 0 deletions app-antivirus/clamav/files/clamav-milter.logrotate
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# This script is intended to rotate the logs for clamav-milter in its
# default configuration on Gentoo, where clamav-milter writes to its
# own log file but does not rotate that file itself. The clamav-milter
# daemon is capable of rotating its own logs; if you have "LogRotate
# yes" in clamav-milter.conf then you do not need this script (and
# should disable it). Likewise, if you are logging to syslog
# (LogSyslog yes), this is redundant.
#
# This is more complicated than the clamd/freshclam scripts because
# the milter doesn't yet reopen its log files when it receives a
# SIGHUP. See https://bugzilla.clamav.net/show_bug.cgi?id=12615
# for that. Instead we have to attempt OpenRC/systemd service
# restarts on (only) the machines that support them.
/var/log/clamav/clamav-milter.log {
su clamav clamav
missingok
postrotate
if command -v rc-service 2>/dev/null; then
rc-service clamav-milter status 2>/dev/null 1>&2 && rc-service clamav-milter restart 1>/dev/null
fi
if command -v systemctl 2>/dev/null; then
systemctl try-restart clamav-milter
fi
endscript
}
17 changes: 17 additions & 0 deletions app-antivirus/clamav/files/clamd.logrotate
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# This script is intended to rotate the logs for clamd in its default
# configuration on Gentoo, where clamd writes to its own log file but
# does not rotate that file itself. The clamd daemon is capable of
# rotating its own logs; if you have "LogRotate yes" in clamd.conf
# then you do not need this script (and should disable it). Likewise,
# if you are logging to syslog (LogSyslog yes), this is redundant.
/var/log/clamav/clamd.log {
su clamav clamav
missingok
postrotate
if test -f /run/clamd.pid; then
/bin/kill -HUP $(cat /run/clamd.pid)
else
true
fi
endscript
}
17 changes: 17 additions & 0 deletions app-antivirus/clamav/files/freshclam.logrotate
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# This script is intended to rotate the logs for freshclam in its default
# configuration on Gentoo, where freshclam writes to its own log file but
# does not rotate that file itself. The freshclam daemon is capable of
# rotating its own logs; if you have "LogRotate yes" in freshclam.conf
# then you do not need this script (and should disable it). Likewise,
# if you are logging to syslog (LogSyslog yes), this is redundant.
/var/log/clamav/freshclam.log {
su clamav clamav
missingok
postrotate
if test -f /run/freshclam.pid; then
/bin/kill -HUP $(cat /run/freshclam.pid)
else
true
fi
endscript
}

0 comments on commit 7662242

Please sign in to comment.