Files @ 32434a92d02a
Branch filter:

Location: ohnobinki_overlay/app-antivirus/clamav/files/freshclam.rc

binki
Fixed clamav-0.95.2.ebuild from Portage. Made initscripts modular.

Also added userflag clamdtop to metadata.xml, made misc. improvements IMO ;-)
#!/sbin/runscript
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

depend() {
    use net
}

start() {
    logfix
    
    ebegin "Starting freshclam"
    start-stop-daemon --start --quiet \
	--nicelevel ${FRESHCLAM_NICELEVEL:-0} \
	--exec /usr/bin/freshclam -- -d
    retcode=$?
    if [ ${retcode} = 1 ]; then
	eend 0
	einfo "Virus database already up to date."
    else
	eend ${retcode}
    fi
}

stop() {
    ebegin "Stopping freshclam"
    start-stop-daemon --stop --quiet --exec /usr/bin/freshclam
    eend $?
}

logfix() {
    # fix freshclam log permissions
    # (might be clobbered by logrotate or something)
    logfile=`awk '$1 == "UpdateLogFile" { print $2 }' /etc/freshclam.conf`
    local freshclam_user=`awk '$1 == "DatabaseOwner" { print $2 }' /etc/freshclam.conf`
    if [ -n "${logfile}" -a -n "${clamav_user}" ]; then
        if [ ! -f "${logfile}" ]; then
            touch ${logfile}
        fi
        chown ${freshclam_user} ${logfile}
        chmod 640 ${logfile}
    fi
}