ports/93157: [PATCH] security/clamsmtp: add OPTIONS to depend on local clamav; improve rc.d script

Ion-Mihai IOnut Tetcu itetcu at people.tecnik93.com
Sat Feb 11 00:10:09 UTC 2006


>Number:         93157
>Category:       ports
>Synopsis:       [PATCH] security/clamsmtp: add OPTIONS to depend on local clamav; improve rc.d script
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat Feb 11 00:10:08 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Ion-Mihai "IOnut" Tetcu
>Release:        FreeBSD 6.0-STABLE i386
>Organization:
Tecnik'93 
>Environment:


System: FreeBSD 6.0-STABLE #1: Mon Jan 23 00:45:10 EET 2006



>Description:


As promised :)

Add WITH_LOCAL_CLAMAV[_DEVEL] to run-depend on security/clamav[-devel];
default LOCAL_CLAMAV on to restore the way port behaved until last update.
Depend on installed package rather that clamd to register depends correctly.

If one of the clam options is on, make rc.d script to REQUIRE: clamd
Actually use clamsmtp_debug var.
Also make rc.d script to look more like the example in PH.

Install example script in EXAMPLESDIR rather that DOCSDIR;
bump PORTREVISION for plist change.

Moved: pkg-message --> files/pkg-message.in

Drop USE_REINPLACE while here.

Tinderbox logs (and diff) at:
http://people.tecnik93.com/~itetcu/FreeBSD/others_ports/clamsmtp/


>How-To-Repeat:





>Fix:


--- clamsmtp.diff begins here ---
Index: Makefile
===================================================================
RCS file: /home/ncvs/ports/security/clamsmtp/Makefile,v
retrieving revision 1.19
diff -u -r1.19 Makefile
--- Makefile	13 Jan 2006 07:24:33 -0000	1.19
+++ Makefile	10 Feb 2006 23:44:30 -0000
@@ -7,6 +7,7 @@
 
 PORTNAME=	clamsmtp
 PORTVERSION=	1.6
+PORTREVISION=	1
 CATEGORIES=	security
 MASTER_SITES=	http://memberwebs.com/nielsen/software/clamsmtp/
 
@@ -15,9 +16,9 @@
 
 GNU_CONFIGURE=	yes
 USE_GMAKE=	yes
-USE_REINPLACE=	yes
 USE_RC_SUBR=	clamsmtpd.sh
 SUB_LIST=	CLAMAV_PID_DIR=${CLAMAV_PID_DIR}
+SUB_FILES+=	pkg-message
 
 CONFIGURE_TARGET=	--build=${MACHINE_ARCH}-portbld-freebsd${OSREL}
 
@@ -26,10 +27,31 @@
 MAN5=		clamsmtpd.conf.5
 MAN8=		clamsmtpd.8
 
-PORTDOCS=	*
+PORTDOCS=	README
 
-.if exists(${LOCALBASE}/sbin/clamd)
-RUN_DEPENDS+=	${LOCALBASE}/sbin/clamd:${PORTSDIR}/security/clamav
+OPTIONS=	LOCAL_CLAMAV "RUN_DEPEND on security/clamav" on
+OPTIONS+=	LOCAL_CLAMAV_DEVEL "RUN_DEPEND on security/clamav-devel" off
+
+.include <bsd.port.pre.mk>
+
+.if defined(WITH_LOCAL_CLAMAV)
+RUN_DEPENDS+=	clamav>=0:${PORTSDIR}/security/clamav
+.endif
+
+.if defined(WITH_LOCAL_CLAMAV_DEVEL)
+RUN_DEPENDS+=	clamav-devel>=0:${PORTSDIR}/security/clamav-devel
+.endif
+
+.if defined(WITH_LOCAL_CLAMAV) || defined(WITH_LOCAL_CLAMAV_DEVEL)
+SUB_LIST+=	CLAMD=clamd
+.else
+SUB_LIST+=	CLAMD=
+.endif
+
+pre-extract:
+.if defined(WITH_LOCAL_CLAMAV) && defined(WITH_LOCAL_CLAMAV_DEVEL)
+	@${ECHO_CMD} "Please select only one clamav port"
+	exit 1
 .endif
 
 post-patch:
@@ -40,8 +62,9 @@
 .if !defined(NOPORTDOCS)
 	@${MKDIR} ${DOCSDIR}
 	${INSTALL_DATA} ${WRKSRC}/README ${DOCSDIR}
-	${INSTALL_DATA} ${WRKSRC}/scripts/virus_action.sh ${DOCSDIR}
 .endif
-	@${SED} -e "s,%%PREFIX%%,${PREFIX},g" ${PKGMESSAGE}
+	@${MKDIR} ${EXAMPLESDIR}
+	${INSTALL_SCRIPT} ${WRKSRC}/scripts/virus_action.sh ${EXAMPLESDIR}
+	@${CAT} ${PKGMESSAGE}
 
-.include <bsd.port.mk>
+.include <bsd.port.post.mk>
Index: pkg-message
===================================================================
RCS file: pkg-message
diff -N pkg-message
--- pkg-message	4 Mar 2005 03:12:53 -0000	1.3
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,14 +0,0 @@
-/* ================================================================= */
-Edit /etc/rc.conf and set
-
-clamsmtpd_enable="YES"
-
-to enable clamsmtpd. 
-
-Also, there is a clamsmtpd.conf-sample in %%PREFIX%%/etc/, 
-rename to clamsmtpd.conf, otherwise specify -f option to your
-config file. 
-
-To work with postfix, See also
-http://memberwebs.com/nielsen/software/clamsmtp/postfix.html
-/* ================================================================= */
Index: pkg-plist
===================================================================
RCS file: /home/ncvs/ports/security/clamsmtp/pkg-plist,v
retrieving revision 1.3
diff -u -r1.3 pkg-plist
--- pkg-plist	13 Jan 2006 07:24:33 -0000	1.3
+++ pkg-plist	10 Feb 2006 23:44:30 -0000
@@ -2,3 +2,5 @@
 @unexec [ ! -f %%CLAMAV_PID_DIR%%/clamsmtpd.pid ] || %%PREFIX%%/etc/rc.d/clamsmtpd.sh stop || true
 sbin/clamsmtpd
 etc/clamsmtpd.conf-sample
+%%EXAMPLESDIR%%/virus_action.sh
+ at dirrm %%EXAMPLESDIR%%
Index: files/clamsmtpd.sh.in
===================================================================
RCS file: /home/ncvs/ports/security/clamsmtp/files/clamsmtpd.sh.in,v
retrieving revision 1.1
diff -u -r1.1 clamsmtpd.sh.in
--- files/clamsmtpd.sh.in	13 Jan 2006 07:24:34 -0000	1.1
+++ files/clamsmtpd.sh.in	10 Feb 2006 23:44:30 -0000
@@ -3,31 +3,32 @@
 # $FreeBSD: ports/security/clamsmtp/files/clamsmtpd.sh.in,v 1.1 2006/01/13 07:24:34 clsung Exp $
 #
 # PROVIDE: clamsmtpd
-# REQUIRE: DAEMON
+# REQUIRE: DAEMON %%CLAMD%%
 # KEYWORD: FreeBSD
 #
-# Add the fellowing line to /etc/rc.conf to enable clamsmtpd:
+# Add the fellowing line to /etc/rc.conf.local or /etc/rc.conf
+# to enable clamsmtpd:
 #
 # clamsmtpd_enable="YES"
 #
+# Set clamsmtpd_debug to something other that 0 if you need
+#
 
 . %%RC_SUBR%%
 
 name="clamsmtpd"
-rcvar=`set_rcvar`
+rcvar=${name}_enable
 
 command=%%PREFIX%%/sbin/${name}
+command_args="-f ${clamsmtpd_conf} -p ${clamsmtpd_pid} -d ${clamsmtpd_debug}"
+pidfile=${clamsmtpd_pid}
 sig_stop=-KILL
 
 load_rc_config ${name}
 
-clamsmtpd_enable=${clamsmtpd_enable-"NO"}
-clamsmtpd_conf=${clamsmtpd_conf-"%%PREFIX%%/etc/clamsmtpd.conf"}
-clamsmtpd_pid=${clamsmtpd_pid-"%%CLAMAV_PID_DIR%%/clamsmtpd.pid"}
-clamsmtpd_debug=${clamsmtpd_debug-"0"}
-
-command_args="-f ${clamsmtpd_conf} -p ${clamsmtpd_pid}"
-
-pidfile=${clamsmtpd_pid}
+: ${clamsmtpd_enable="NO"}
+: ${clamsmtpd_conf="%%PREFIX%%/etc/clamsmtpd.conf"}
+: ${clamsmtpd_pid="%%CLAMAV_PID_DIR%%/clamsmtpd.pid"}
+: ${clamsmtpd_debug="0"}
 
 run_rc_command "$1"
Index: files/pkg-message.in
===================================================================
RCS file: files/pkg-message.in
diff -N files/pkg-message.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/pkg-message.in	10 Feb 2006 23:44:30 -0000
@@ -0,0 +1,14 @@
+/* ================================================================= */
+Edit /etc/rc.conf and set
+
+clamsmtpd_enable="YES"
+
+to enable clamsmtpd. 
+
+Also, there is a clamsmtpd.conf-sample in %%PREFIX%%/etc/, 
+rename to clamsmtpd.conf, otherwise specify -f option to your
+config file. 
+
+To work with postfix, See also
+http://memberwebs.com/nielsen/software/clamsmtp/postfix.html
+/* ================================================================= */
--- clamsmtp.diff ends here ---



>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list