summaryrefslogtreecommitdiff
path: root/mail/clamav/files
diff options
context:
space:
mode:
authorrecht <recht@pkgsrc.org>2004-02-02 00:00:48 +0000
committerrecht <recht@pkgsrc.org>2004-02-02 00:00:48 +0000
commit8db6be72655f3c357e6b8cd585997876073b203a (patch)
tree864f1fc702b3e2abfc8f702e0a900c84b3e03df3 /mail/clamav/files
parent947db73758a8c831cc50b583a93ad4dd1f3d6b1e (diff)
downloadpkgsrc-8db6be72655f3c357e6b8cd585997876073b203a.tar.gz
Add clamd rc start script.
Somewhat based upon PR 24294 by Eric Schnoebelen. While at it also fix configure to always install the example config file to "examples". Bump PKGREVISION to 1.
Diffstat (limited to 'mail/clamav/files')
-rw-r--r--mail/clamav/files/clamd.sh52
1 files changed, 52 insertions, 0 deletions
diff --git a/mail/clamav/files/clamd.sh b/mail/clamav/files/clamd.sh
new file mode 100644
index 00000000000..be5630a752d
--- /dev/null
+++ b/mail/clamav/files/clamd.sh
@@ -0,0 +1,52 @@
+#!/bin/sh
+#
+# $NetBSD: clamd.sh,v 1.1 2004/02/02 00:00:48 recht Exp $
+#
+# clamd does anti-virus checking.
+#
+## only for NetBSD
+# PROVIDE: clamd
+# REQUIRE: LOGIN
+## only because it might be used by mimedefang
+# BEFORE: mail
+# KEYWORD: shutdown
+##
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin:@PREFIX@/sbin:@PREFIX@/bin
+export PATH
+
+if [ -f /etc/rc.subr ]
+then
+ . /etc/rc.subr
+fi
+
+name="clamd"
+rcvar=$name
+required_files="@PKG_SYSCONFDIR@/clamav.conf"
+command="@PREFIX@/sbin/${name}"
+pidfile=$(@AWK@ '/^#/ {next}; /PidFile/ {print $2}' ${required_files})
+socket=$(@AWK@ '/^#/ {next}; /LocalSocket/ {print $2}' ${required_files})
+clamd_user=$(@AWK@ '/^#/ {next}; /User/ {print $2}' ${required_files})
+
+start_precmd="clamd_precmd"
+stop_postcmd="clamd_postcmd"
+
+clamd_precmd()
+{
+ @TOUCH@ ${pidfile}
+ @CHOWN@ ${clamd_user} ${pidfile}
+}
+
+clamd_postcmd()
+{
+ if [ -f "${pidfile}" ]; then
+ @RM@ -f ${pidfile}
+ fi
+
+ if [ -e "${socket}" ]; then
+ @RM@ -f ${socket}
+ fi
+}
+
+load_rc_config $name
+run_rc_command "$1"