summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app-antivirus/clamav/files/clamd.rc')
-rw-r--r--app-antivirus/clamav/files/clamd.rc56
1 files changed, 35 insertions, 21 deletions
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
+}