pkgsrc-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
CVS commit: pkgsrc/security/clamav
Module Name: pkgsrc
Committed By: taca
Date: Mon Sep 14 16:54:35 UTC 2020
Modified Files:
pkgsrc/security/clamav: Makefile options.mk
Added Files:
pkgsrc/security/clamav/files: clamav-milter.sh
Log Message:
security/clamav: add clamav-milter startup script
Add clamav-milter startup script.
Bump PKGREVISION.
To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 pkgsrc/security/clamav/Makefile
cvs rdiff -u -r1.6 -r1.7 pkgsrc/security/clamav/options.mk
cvs rdiff -u -r0 -r1.1 pkgsrc/security/clamav/files/clamav-milter.sh
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: pkgsrc/security/clamav/Makefile
diff -u pkgsrc/security/clamav/Makefile:1.69 pkgsrc/security/clamav/Makefile:1.70
--- pkgsrc/security/clamav/Makefile:1.69 Fri Jul 17 04:48:32 2020
+++ pkgsrc/security/clamav/Makefile Mon Sep 14 16:54:35 2020
@@ -1,6 +1,7 @@
-# $NetBSD: Makefile,v 1.69 2020/07/17 04:48:32 taca Exp $
+# $NetBSD: Makefile,v 1.70 2020/09/14 16:54:35 taca Exp $
.include "Makefile.common"
+PKGREVISION= 1
COMMENT= Anti-virus toolkit
Index: pkgsrc/security/clamav/options.mk
diff -u pkgsrc/security/clamav/options.mk:1.6 pkgsrc/security/clamav/options.mk:1.7
--- pkgsrc/security/clamav/options.mk:1.6 Mon Aug 5 14:44:20 2019
+++ pkgsrc/security/clamav/options.mk Mon Sep 14 16:54:35 2020
@@ -1,4 +1,4 @@
-# $NetBSD: options.mk,v 1.6 2019/08/05 14:44:20 prlw1 Exp $
+# $NetBSD: options.mk,v 1.7 2020/09/14 16:54:35 taca Exp $
PKG_OPTIONS_VAR= PKG_OPTIONS.clamav
PKG_SUPPORTED_OPTIONS= milter clamav-experimental unit-test
@@ -17,6 +17,7 @@ CONFIGURE_ARGS+= --enable-milter
PLIST.milter= yes
CONF_SAMPLES+= clamav-milter.conf
SMF_INSTANCES+= clamav-milter
+RCD_SCRIPTS+= clamav-milter
.else
CONFIGURE_ARGS+= --disable-milter
# XXX --disable-milter doesn't work as expected, so we need this
Added files:
Index: pkgsrc/security/clamav/files/clamav-milter.sh
diff -u /dev/null pkgsrc/security/clamav/files/clamav-milter.sh:1.1
--- /dev/null Mon Sep 14 16:54:35 2020
+++ pkgsrc/security/clamav/files/clamav-milter.sh Mon Sep 14 16:54:35 2020
@@ -0,0 +1,76 @@
+#!@RCD_SCRIPTS_SHELL@
+#
+# $NetBSD: clamav-milter.sh,v 1.1 2020/09/14 16:54:35 taca Exp $
+#
+# clamav-milter provides milter socket for mail daemon
+#
+# PROVIDE: clamav_milter
+# REQUIRE: clamd
+# BEFORE: mail local
+# KEYWORD: shutdown
+
+if [ -f /etc/rc.subr ]; then
+ . /etc/rc.subr
+fi
+
+name="clamav_milter"
+rcvar=$name
+command="@PREFIX@/sbin/clamav-milter"
+required_files="@PKG_SYSCONFDIR@/clamav-milter.conf"
+start_precmd="clamd_precmd"
+stop_cmd="clamav_milter_stopcmd"
+
+if [ -f "${required_files}" ]; then
+ pidfile_=`@AWK@ '/^#/ {next}; /^PidFile[ ]/ {r = $2};
+ END {print r}' ${required_files}`
+ if [ -n "${pidfile_}" ]; then
+ pidfile=${pidfile_}
+ fi
+ logfile=`@AWK@ 'BEGIN {r = "/tmp/clamd.log"};
+ /^#/ {next}; /^LogFile[ ]/ {r = $2};
+ END {print r}' ${required_files}`
+ socket=`@AWK@ 'BEGIN {r = "/tmp/clamd"};
+ /^#/ {next}; /^LocalSocket[ ]/ {r = $2};
+ END {print r}' ${required_files}`
+ clamav_milter_user=`@AWK@ 'BEGIN {r = "@CLAMAV_USER@"};
+ /^#/ {next}; /^User[ ]/ {r = $2};
+ END {print r}' ${required_files}`
+fi
+
+clamav_milter_precmd()
+{
+ @RM@ -f ${socket}
+ if [ -n "${logfile}" ]; then
+ @TOUCH@ ${logfile}
+ @CHOWN@ ${clamav_milter_user} ${logfile}
+ fi
+ if [ -n "${pidfile}" ]; then
+ @TOUCH@ ${pidfile}
+ @CHOWN@ ${clamav_milter_user} ${pidfile}
+ fi
+}
+
+clamav_milter_stopcmd()
+{
+ # Workaround bug when clamd is built against pth by send TERM to
+ # clamd, then forcing it to start a worker thread that exits.
+ # This forces the main thread to awaken and realize that it's
+ # supposed to shutdown.
+ #
+ @ECHO@ "Stopping ${name}."
+ doit="@SU@ -m ${clamav_milter_user} -c \"kill -TERM $rc_pid\""
+ if ! eval $doit && [ -z "$rc_force" ]; then
+ return 1
+ fi
+ wait_for_pids $rc_pid
+}
+
+if [ -f /etc/rc.subr -a -f /etc/rc.conf \
+ -a -d /etc/rc.d -a -f /etc/rc.d/DAEMON ]; then
+ load_rc_config $name
+ run_rc_command "$1"
+else
+ @ECHO@ -n " ${name}"
+ eval ${start_precmd}
+ ${command} ${clamav_milter_flags} ${command_args}
+fi
Home |
Main Index |
Thread Index |
Old Index