summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrej Kacian <ticho@gentoo.org>2007-03-25 19:25:17 +0000
committerAndrej Kacian <ticho@gentoo.org>2007-03-25 19:25:17 +0000
commit8a56458497985b1ccbda9716585c321b76f79545 (patch)
tree43506097b6fc2a3b8e34984e2f6ef4ecf16b0dd8 /app-antivirus
parentRemove virtual/x11 depend (diff)
downloadgentoo-2-8a56458497985b1ccbda9716585c321b76f79545.tar.gz
gentoo-2-8a56458497985b1ccbda9716585c321b76f79545.tar.bz2
gentoo-2-8a56458497985b1ccbda9716585c321b76f79545.zip
Move logfile permission/ownership fix to separate logfix() function and call it from start(), and from logrotate script. Closes bug #170739, reported by Sergey Borodich <bor at univ.kiev.ua>. Remove bashism from the initscript, as suggested by Natanael Copa <natanael.copa at gmail.com> in bug #171755.
(Portage version: 2.1.2.2)
Diffstat (limited to 'app-antivirus')
-rw-r--r--app-antivirus/clamav/ChangeLog9
-rw-r--r--app-antivirus/clamav/files/clamav.logrotate6
-rw-r--r--app-antivirus/clamav/files/clamd.rc56
3 files changed, 45 insertions, 26 deletions
diff --git a/app-antivirus/clamav/ChangeLog b/app-antivirus/clamav/ChangeLog
index 4338e13fa984..c258946b063f 100644
--- a/app-antivirus/clamav/ChangeLog
+++ b/app-antivirus/clamav/ChangeLog
@@ -1,6 +1,13 @@
# ChangeLog for app-antivirus/clamav
# Copyright 2002-2007 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/app-antivirus/clamav/ChangeLog,v 1.215 2007/03/20 12:05:57 ticho Exp $
+# $Header: /var/cvsroot/gentoo-x86/app-antivirus/clamav/ChangeLog,v 1.216 2007/03/25 19:25:17 ticho Exp $
+
+ 25 Mar 2007; Andrej Kacian <ticho@gentoo.org> files/clamav.logrotate,
+ files/clamd.rc:
+ Move logfile permission/ownership fix to separate logfix() function and call
+ it from start(), and from logrotate script. Closes bug #170739, reported by
+ Sergey Borodich <bor at univ.kiev.ua>. Remove bashism from the initscript,
+ as suggested by Natanael Copa <natanael.copa at gmail.com> in bug #171755.
20 Mar 2007; Andrej Kacian <ticho@gentoo.org> -clamav-0.88.5.ebuild,
-clamav-0.88.6.ebuild, clamav-0.88.7.ebuild, clamav-0.90.ebuild,
diff --git a/app-antivirus/clamav/files/clamav.logrotate b/app-antivirus/clamav/files/clamav.logrotate
index e79ce6e77ee8..8c4916470b48 100644
--- a/app-antivirus/clamav/files/clamav.logrotate
+++ b/app-antivirus/clamav/files/clamav.logrotate
@@ -1,15 +1,13 @@
/var/log/clamav/clamd.log {
missingok
- create 640 clamav clamav
postrotate
- /bin/kill -HUP `cat /var/run/clamav/clamd.pid 2> /dev/null` 2>/dev/null || true
+ /etc/init.d/clamd logfix
endscript
}
/var/log/clamav/freshclam.log {
missingok
- create 640 clamav clamav
postrotate
- /bin/kill -HUP `cat /var/run/clamav/freshclam.pid 2> /dev/null` 2>/dev/null || true
+ /etc/init.d/clamd logfix
endscript
}
diff --git a/app-antivirus/clamav/files/clamd.rc b/app-antivirus/clamav/files/clamd.rc
index bed32bc0d49a..309a8fc8c924 100644
--- a/app-antivirus/clamav/files/clamd.rc
+++ b/app-antivirus/clamav/files/clamd.rc
@@ -1,7 +1,9 @@
#!/sbin/runscript
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/app-antivirus/clamav/files/clamd.rc,v 1.11 2007/03/15 13:25:25 ticho Exp $
+# $Header: /var/cvsroot/gentoo-x86/app-antivirus/clamav/files/clamd.rc,v 1.12 2007/03/25 19:25:17 ticho Exp $
+
+opts="logfix"
depend() {
use net
@@ -10,18 +12,10 @@ depend() {
start() {
local clamd_socket=`awk '$1 == "LocalSocket" { print $2 }' /etc/clamd.conf`
- if [ "${START_CLAMD}" = "yes" ]; then
- # fix clamd log permissions
- # (might be clobbered by logrotate or something)
- local logfile=`awk '$1 == "LogFile" { print $2 }' /etc/clamd.conf`
- local clamav_user=`awk '$1 == "User" { print $2 }' /etc/clamd.conf`
- if [[ -n "${logfile}" && -n "${clamav_user}" ]]; then
- if [ ! -f "${logfile}" ]; then
- touch ${logfile}
- fi
- chown ${clamav_user} ${logfile}
- fi
+ logfix
+
+ if [ "${START_CLAMD}" = "yes" ]; then
if [ -S "${clamd_socket:-/tmp/clamd}" ]; then
rm -f ${clamd_socket:-/tmp/clamd}
fi
@@ -34,15 +28,6 @@ start() {
if [ "${START_FRESHCLAM}" = "yes" ]; then
ebegin "Starting freshclam"
- # fix freshclam log permissions
- # (might be clobbered by logrotate or something)
- logfile=`awk '$1 == "UpdateLogFile" { print $2 }' /etc/freshclam.conf`
- if [[ -n "${logfile}" && -n "${clamav_user}" ]]; then
- if [ ! -f "${logfile}" ]; then
- touch ${logfile}
- fi
- chown ${clamav_user} ${logfile}
- fi
start-stop-daemon --start --quiet \
--exec /usr/bin/freshclam -- -d
retcode=$?
@@ -82,3 +67,32 @@ stop() {
eend $? "Failed to stop clamav-milter"
fi
}
+
+logfix() {
+ if [ "${START_CLAMD}" = "yes" ]; then
+ # fix clamd log permissions
+ # (might be clobbered by logrotate or something)
+ local logfile=`awk '$1 == "LogFile" { print $2 }' /etc/clamd.conf`
+ local clamav_user=`awk '$1 == "User" { print $2 }' /etc/clamd.conf`
+ if [ -n "${logfile}" ] && [ -n "${clamav_user}" ]; then
+ if [ ! -f "${logfile}" ]; then
+ touch ${logfile}
+ fi
+ chown ${clamav_user} ${logfile}
+ chmod 640 ${logfile}
+ fi
+ fi
+
+ if [ "${START_FRESHCLAM}" = "yes" ]; then
+ # fix freshclam log permissions
+ # (might be clobbered by logrotate or something)
+ logfile=`awk '$1 == "UpdateLogFile" { print $2 }' /etc/freshclam.conf`
+ if [[ -n "${logfile}" && -n "${clamav_user}" ]]; then
+ if [ ! -f "${logfile}" ]; then
+ touch ${logfile}
+ fi
+ chown ${clamav_user} ${logfile}
+ chmod 640 ${logfile}
+ fi
+ fi
+}