New port: clamav-server, launchdaemons for clamav (https://trac.macports.org/ticket/23777)

git-svn-id: https://svn.macports.org/repository/macports/trunk/dports@68364 d073be05-634f-4543-b044-5fe20cf6d1d6
This commit is contained in:
Joshua Root
2010-06-02 01:48:49 +00:00
parent ce3dc048a6
commit 3fa9f479c4
3 changed files with 145 additions and 0 deletions
+104
View File
@@ -0,0 +1,104 @@
# $Id$
PortSystem 1.0
name clamav-server
version 0.95.3
homepage http://www.clamav.net/
categories sysutils
platforms darwin
if {[info exists supported_archs]} {
supported_archs noarch
}
maintainers pixilla.com:brad
license BSD
distfiles
description \
launchdaemons for clamav antivirus software
long_description \
Clam AntiVirus is a GPL anti-virus toolkit for UNIX. The \
main purpose of this software is the integration with mail \
servers (attachment scanning). This port installs launchdaemons \
that can be used to manage clamav.
depends_run \
port:clamav
if {"darwin" == ${os.platform} && ${os.major} > 8} {
set clamavuser _clamav
} else {
set clamavuser clamav
}
use_configure no
build {}
set dataPath ${prefix}/var/clamav
set logPath ${prefix}/var/log/clamav
set runPath ${prefix}/var/run/clamav
destroot {
addgroup ${clamavuser}
set gid [existsgroup ${clamavuser}]
adduser ${clamavuser} gid=${gid} realname=clamav
set LaunchDaemonsPath ${destroot}/Library/LaunchDaemons
xinstall -d ${LaunchDaemonsPath}
xinstall -m 0644 -W ${filespath} \
org.macports.clamd.plist \
org.macports.freshclam.plist \
${LaunchDaemonsPath}
reinplace "s|__PREFIX__|${prefix}|g" \
${LaunchDaemonsPath}/org.macports.clamd.plist \
${LaunchDaemonsPath}/org.macports.freshclam.plist
xinstall -m 0755 -o ${clamavuser} -g ${clamavuser} -d \
${destroot}${dataPath} \
${destroot}${logPath} \
${destroot}${runPath}
touch ${destroot}${logPath}/clamav.log
destroot.keepdirs \
${destroot}${dataPath} \
${destroot}${runPath}
}
notes "******************************************************
* To configure clamd and freshclam look for the following files
* ${prefix}/etc/clamd.conf
* ${prefix}/etc/freshclam.conf
**
* If these files do not exist copy do the following to copy these files into place
cp ${prefix}/etc/example-clamd.conf ${prefix}/etc/clamd.conf
cp ${prefix}/etc/example-freshclam.conf ${prefix}/etc/freshclam.conf
**
* Alter/Add the following lines to your ${prefix}/etc/clamd.conf
* Comment out 'Example' near the top like so '#Example'
* LogFile ${logPath}/clamd.log
* PidFile ${runPath}/clamd.pid
* LocalSocket ${runPath}/clamd.socket
**
* Alter/Add the following lines to your ${prefix}/etc/freshclam.conf
* Comment out 'Example' near the top like so '#Example'
* UpdateLogFile ${logPath}/freshclam.log
* PidFile ${runPath}/freshclam.pid
* NotifyClamd ${prefix}/etc/clamd.conf
**
* Two launchd startup items have been installed
**
* To load clamd and freshclam do the following
launchctl load -w /Library/LaunchDaemons/org.macports.clamd.plist
launchctl load -w /Library/LaunchDaemons/org.macports.freshclam.plist
**
* To unload clamd and freshclam do the following
launchctl unload -w /Library/LaunchDaemons/org.macports.clamd.plist
launchctl unload -w /Library/LaunchDaemons/org.macports.freshclam.plist
**
* To try things out do
freshclam
* If all is well you should see your clamav database being updated
******************************************************"
livecheck.type regex
livecheck.url http://sourceforge.net/projects/clamav/files
livecheck.regex clamav-(\\d+.\\d+.\\d+)${extract.suffix}
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>GroupName</key>
<string>_clamav</string>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>org.macports.clamd</string>
<key>OnDemand</key>
<true/>
<key>ProgramArguments</key>
<array>
<string>__PREFIX__/sbin/clamd</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>UserName</key>
<string>root</string>
</dict>
</plist>
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>GroupName</key>
<string>_clamav</string>
<key>Label</key>
<string>org.macports.freshclam</string>
<key>ProgramArguments</key>
<array>
<string>__PREFIX__/bin/freshclam</string>
</array>
<key>StartInterval</key>
<integer>21600</integer>
<key>UserName</key>
<string>_clamav</string>
</dict>
</plist>