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
commit69db236189b4ff0480b24d1d22b2b14612b783ed (patch)
treeb8ee842a16200bb2429495e1081779b67ac9b8a5 /app-antivirus/clamav/files
parentAdd ~ia64 (diff)
downloadhistorical-69db236189b4ff0480b24d1d22b2b14612b783ed.tar.gz
historical-69db236189b4ff0480b24d1d22b2b14612b783ed.tar.bz2
historical-69db236189b4ff0480b24d1d22b2b14612b783ed.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.
Package-Manager: portage-2.1.2.2
Diffstat (limited to 'app-antivirus/clamav/files')
-rw-r--r--app-antivirus/clamav/files/clamav.logrotate6
-rw-r--r--app-antivirus/clamav/files/clamd.rc56
2 files changed, 37 insertions, 25 deletions
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
+}