Bug 82423 - [PATCH] security/amavisd-new: several improvements
Summary: [PATCH] security/amavisd-new: several improvements
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Florent Thoumie
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-19 18:40 UTC by Petr Rehor
Modified: 2005-07-15 23:50 UTC (History)
1 user (show)

See Also:


Attachments
amavisd-new.diff (16.19 KB, patch)
2005-06-19 18:40 UTC, Petr Rehor
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Rehor 2005-06-19 18:40:08 UTC
[DESCRIBE CHANGES]

- Bump PORTREVISION to 1

- Install new command amavisd-agent

- Use USE_RCORDER to install rc.d scripts to /etc/rc.d on 5.x
  (requires rename amavisd.sh.tmpl and amavis-milter.sh.tmpl to
  amavisd.sh.in and amavis-milter.sh.in)

- Improve rc.d/amavisd.sh and rc.d/amavis-milter.sh scripts
  (set defaults before eating rc.conf, fix bug in BEFORE keyword in
   rc.d/amavis-milter.sh)

- Stop amamvisd and amavis-milter when package is deinstalling or upgrading

- Use SUB_FILES for pkg-* files building
  (requires rename INSTAL.tmpl, DEINSTALL.tmpl and MESSAGE.tmpl to
   pkg-install.in, pkg-deinstall.in and pkg-messages.in)

- Add WITH_MILTER options knob
  (when not selected, sbin/amavis-milter and rc.d/amavis-milter.sh are
   not installed)
Comment 1 Florent Thoumie freebsd_committer freebsd_triage 2005-06-19 22:48:51 UTC
State Changed
From-To: open->feedback

Forward PR to maintainer. 


Comment 2 Florent Thoumie freebsd_committer freebsd_triage 2005-06-19 22:48:51 UTC
Responsible Changed
From-To: freebsd-ports-bugs->flz

Ouh sexy !
Comment 3 Florent Thoumie freebsd_committer freebsd_triage 2005-06-19 22:53:50 UTC
	Dear maintainer, please have a look at :

	http://www.freebsd.org/cgi/query-pr.cgi?pr=82423

-- 
Florent Thoumie
flz@FreeBSD.org
Comment 4 Blaz Zupan 2005-06-27 17:55:08 UTC
> 	Dear maintainer, please have a look at :
> 	http://www.freebsd.org/cgi/query-pr.cgi?pr=82423

Excellent patch, please commit.
Comment 5 Blaz Zupan 2005-06-27 18:21:32 UTC
Oops, please hold off the upgrade. With the patch installed, amavisd does not 
start for me on 5.4. I'm still investigating what is going on.
Comment 6 Blaz Zupan 2005-06-27 18:46:26 UTC
Hmmm, this is strange. I have amavisd_enable="YES" set in /etc/rc.conf. I have 
also added rc_debug="YES" to help in debugging this situation.

When /etc/rc.d/amavisd is started from /etc/rc, the following is logged:

Jun 27 19:34:41 in-3 root: /etc/rc: INFO: checkyesno: amavisd_enable is set to NO.

If I manually run "/etc/rc.d/amavisd start" after fully booting up, I get 
this:

Jun 27 19:39:57 in-3 blaz: /etc/rc.d/amavisd: INFO: checkyesno: amavisd_enable 
is set to YES.
Jun 27 19:39:57 in-3 blaz: /etc/rc.d/amavisd: INFO: run_rc_command: _doit: 
/usr/local/sbin/amavisd -u vscan

and amavisd is correctly started. I have no idea what is going on here, but 
this needs to be fixed before the patch is commited. I currently have no time 
to investigate further.
Comment 7 Blaz Zupan 2005-06-30 09:14:11 UTC
Here is a fixed version of the patch. It includes the following additions to 
the original patch:

- updates the port to amavisd-new version 2.3.2 which fixes nasty problems
   with perl 5.8.7
- fixes the installation script so that it works on both 4.11 and 5.4.
   It installs into /etc/rc.d on 5.4 and /usr/local/etc/rc.d on 4.11.

Please commit this patch instead of the original one.

diff -urN amavisd-new.orig/Makefile amavisd-new/Makefile
--- amavisd-new.orig/Makefile	Sun Jun  5 17:49:16 2005
+++ amavisd-new/Makefile	Thu Jun 30 09:58:01 2005
@@ -7,7 +7,7 @@
  # Based on amavisd ports makefile.

  PORTNAME=	amavisd-new
-PORTVERSION=	2.3.1
+PORTVERSION=	2.3.2
  PORTEPOCH=	1
  CATEGORIES=	security
  MASTER_SITES=	http://www.ijs.si/software/amavisd/ \
@@ -39,11 +39,6 @@
  		${LOCALBASE}/bin/rpm2cpio.pl:${PORTSDIR}/archivers/rpm2cpio

  USE_PERL5_RUN=	yes
-USE_RC_SUBR=	yes
-
-PKGINSTALL=	${WRKDIR}/INSTALL
-PKGDEINSTALL=	${WRKDIR}/DEINSTALL
-PKGMESSAGE=	${WRKDIR}/MESSAGE

  AMAVISUSER?=	vscan
  AMAVISGROUP?=	vscan
@@ -54,17 +49,45 @@

  OPTIONS=	MYSQL	"MySQL support"		off \
  		PGSQL	"PgSQL support"		off \
-		LDAP	"LDAP support"		off
+		LDAP	"LDAP support"		off \
+		MILTER	"sendmail milter support" on
+
+SUB_FILES=	pkg-install pkg-deinstall pkg-message
+
+SUB_LIST=	AMAVISUSER=${AMAVISUSER} \
+		AMAVISGROUP=${AMAVISGROUP} \
+		AMAVISDIR=${AMAVISDIR} \
+		AMAVISQUARANTINE=${AMAVISQUARANTINE} \
+		DOCSDIR=${DOCSDIR}

  .include <bsd.port.pre.mk>

+.if ${OSVERSION} >= 500037
+USE_RCORDER=	amavisd.sh
+RC_DIR=		/etc/rc.d
+RC_SUFX=
+.else
+USE_RC_SUBR+=	amavisd.sh
+RC_DIR=		${PREFIX}/etc/rc.d
+RC_SUFX=	.sh
+.endif
+
  .if !exists(/usr/lib/libmilter.a) && !exists(${PREFIX}/lib/libmilter.a)
+AMAVIS_NOAMAVIS="@comment "
+.endif
+
+.if defined(WITH_MILTER) && !defined(AMAVIS_NOAMAVIS)
+USE_RCORDER+=	amavis-milter.sh
+.else
  AMAVIS_NOMILTER="@comment "
  .endif

-PLIST_SUB+=	AMAVIS_NOMILTER=${AMAVIS_NOMILTER}
+PLIST_SUB+=	AMAVIS_NOMILTER=${AMAVIS_NOMILTER} \
+		AMAVIS_NOAMAVIS=${AMAVIS_NOAMAVIS} \
+		RC_DIR=${RC_DIR} \
+		RC_SUFX=${RC_SUFX}

-.if defined(AMAVIS_NOMILTER)
+.if defined(AMAVIS_NOAMAVIS)
  do-build:
  	@${ECHO} libmilter not available, not building amavis-milter and amavis
  .else
@@ -74,13 +97,7 @@
  BUILD_WRKSRC=	${WRKSRC}/helper-progs
  .endif

-SED_SCRIPT=	-e 's,%%AMAVISUSER%%,${AMAVISUSER},g' \
-		-e 's,%%AMAVISGROUP%%,${AMAVISGROUP},g' \
-		-e 's,%%AMAVISDIR%%,${AMAVISDIR},g' \
-		-e 's,%%AMAVISQUARANTINE%%,${AMAVISQUARANTINE},g' \
-		-e 's,%%DOCSDIR%%,${DOCSDIR},g' \
-		-e 's,%%PREFIX%%,${PREFIX},g' \
-		-e 's,%%RC_SUBR%%,${RC_SUBR},g'
+SED_SCRIPT=	${SUB_LIST:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/}

  .if defined(WITH_MYSQL)
  RUN_DEPENDS+=	${SITE_PERL}/${PERL_ARCH}/Mysql.pm:${PORTSDIR}/databases/p5-DBD-mysql
@@ -94,11 +111,8 @@
  RUN_DEPENDS+=	${SITE_PERL}/Net/LDAP.pm:${PORTSDIR}/net/p5-perl-ldap
  .endif

-pre-build:
-	for f in amavisd.sh amavis-milter.sh INSTALL DEINSTALL MESSAGE; do \
-		${SED} ${SED_SCRIPT} < ${FILESDIR}/$${f}.tmpl > ${WRKDIR}/$${f}; \
-	done
-	for f in amavisd.conf amavisd.conf-sample amavisd amavisd-nanny; do \
+post-patch:
+	@for f in amavisd.conf amavisd.conf-sample amavisd amavisd-agent amavisd-nanny; do \
  		${SED} ${SED_SCRIPT} < ${WRKSRC}/$${f} > ${WRKDIR}/$${f}; \
  	done

@@ -106,12 +120,14 @@
  	@${SH} ${PKGINSTALL} ${DISTNAME} PRE-INSTALL

  do-install:
-.if !defined(AMAVIS_NOMILTER)
+.if !defined(AMAVIS_NOAMAVIS)
  	${INSTALL_PROGRAM} ${WRKSRC}/helper-progs/amavis ${PREFIX}/sbin
+.endif
+.if !defined(AMAVIS_NOMILTER)
  	${INSTALL_PROGRAM} ${WRKSRC}/helper-progs/amavis-milter ${PREFIX}/sbin
-	${INSTALL_SCRIPT} ${WRKDIR}/amavis-milter.sh ${PREFIX}/etc/rc.d
  .endif
  	${INSTALL_SCRIPT} ${WRKDIR}/amavisd ${PREFIX}/sbin
+	${INSTALL_SCRIPT} ${WRKDIR}/amavisd-agent ${PREFIX}/sbin
  	${INSTALL_SCRIPT} ${WRKDIR}/amavisd-nanny ${PREFIX}/sbin
  	${INSTALL_SCRIPT} ${WRKDIR}/amavisd.conf ${PREFIX}/etc/amavisd.conf-dist
  .if !exists(${PREFIX}/etc/amavisd.conf)
@@ -119,7 +135,6 @@
  .endif
  	${INSTALL_SCRIPT} ${WRKDIR}/amavisd.conf-sample ${PREFIX}/etc/amavisd.conf-sample
  	${INSTALL_SCRIPT} ${WRKSRC}/amavisd.conf-default ${PREFIX}/etc/amavisd.conf-default
-	${INSTALL_SCRIPT} ${WRKDIR}/amavisd.sh ${PREFIX}/etc/rc.d
  .if !defined(NOPORTDOCS)
  	@${MKDIR} ${DOCSDIR}
  .for FILE in AAAREADME.first INSTALL LDAP.schema LICENSE RELEASE_NOTES README_FILES/*
diff -urN amavisd-new.orig/distinfo amavisd-new/distinfo
--- amavisd-new.orig/distinfo	Thu May 19 17:20:09 2005
+++ amavisd-new/distinfo	Thu Jun 30 09:06:14 2005
@@ -1,2 +1,2 @@
-MD5 (amavisd-new-2.3.1.tar.gz) = 5260e01b6ec94b66dc9160ce7bbb8ebc
-SIZE (amavisd-new-2.3.1.tar.gz) = 780829
+MD5 (amavisd-new-2.3.2.tar.gz) = 4af47f7e0b2aaf71bd5783dc26a576a8
+SIZE (amavisd-new-2.3.2.tar.gz) = 786156
diff -urN amavisd-new.orig/files/DEINSTALL.tmpl amavisd-new/files/DEINSTALL.tmpl
--- amavisd-new.orig/files/DEINSTALL.tmpl	Sun Apr 20 12:02:44 2003
+++ amavisd-new/files/DEINSTALL.tmpl	Thu Jan  1 01:00:00 1970
@@ -1,28 +0,0 @@
-#!/bin/sh
-#
-#	$FreeBSD: ports/security/amavisd-new/files/DEINSTALL.tmpl,v 1.3 2003/04/20 10:02:44 leeym Exp $
-#
-
-USER=%%AMAVISUSER%%
-GROUP=%%AMAVISGROUP%%
-DIR=%%AMAVISDIR%%
-QUARANTINE=%%AMAVISQUARANTINE%%
-
-if [ "$2" = "POST-DEINSTALL" ]; then
-
-    if /usr/sbin/pw group show "${GROUP}" 2>&1 >/dev/null; then
-	echo "You should manually remove the \"${GROUP}\" group."
-    fi
-
-    if /usr/sbin/pw user show "${USER}" 2>&1 >/dev/null; then
-	echo "You should manually remove the \"${USER}\" user."
-    fi
-
-    if [ -e ${DIR} ]; then
-	echo "You should manually remove the \"${DIR}\" directory."
-    fi
- 
-    if [ -e ${QUARANTINE} ]; then
-      echo "You should manually remove the \"${QUARANTINE}\" directory."
-    fi
-fi
diff -urN amavisd-new.orig/files/INSTALL.tmpl amavisd-new/files/INSTALL.tmpl
--- amavisd-new.orig/files/INSTALL.tmpl	Mon Feb 14 04:51:45 2005
+++ amavisd-new/files/INSTALL.tmpl	Thu Jan  1 01:00:00 1970
@@ -1,51 +0,0 @@
-#!/bin/sh
-#
-#	$FreeBSD: ports/security/amavisd-new/files/INSTALL.tmpl,v 1.6 2005/02/14 03:51:45 leeym Exp $
-#
-
-USER=%%AMAVISUSER%%
-GROUP=%%AMAVISGROUP%%
-DIR=%%AMAVISDIR%%
-QUARANTINE=%%AMAVISQUARANTINE%%
-
-if [ "$2" = "PRE-INSTALL" ]; then
-
-    if /usr/sbin/pw groupshow "${GROUP}" 2>/dev/null; then
-	echo "You already have a group \"${GROUP}\", so I will use it."
-    else
-	if /usr/sbin/pw groupadd ${GROUP} -h - -g 110
-	then
-	    echo "Added group \"${GROUP}\"."
-	else
-	    echo "Adding group \"${GROUP}\" failed..."
-	    echo "Please create it, and try again."
-	    exit 1
-	fi
-    fi
-
-    if /usr/sbin/pw user show "${USER}" 2>/dev/null; then
-	echo "You already have a user \"${USER}\", so I will use it."
-    else
-	if /usr/sbin/pw useradd ${USER} -g ${GROUP} -h - \
-	   -d ${DIR} \
-	   -s /bin/sh \
-	   -c "Scanning Virus Account" \
-	   -u 110
-	then
-	    echo "Added user \"${USER}\"."
-	else
-	    echo "Adding user \"${USER}\" failed..."
-	    echo "Please create it, and try again."
-	    exit 1
-	fi
-    fi
-
-    /usr/bin/install -o ${USER} -g ${GROUP} -m 750 -d ${DIR}
-    echo "Created \"${DIR}\" directory."
-    /usr/bin/install -o ${USER} -g ${GROUP} -m 750 -d ${DIR}/db
-    echo "Created \"${DIR}/db\" directory."
-    /usr/bin/install -o ${USER} -g ${GROUP} -m 750 -d ${DIR}/tmp
-    echo "Created \"${DIR}/tmp\" directory."
-    /usr/bin/install -o ${USER} -g ${GROUP} -m 750 -d ${QUARANTINE}
-    echo "Created \"${QUARANTINE}\" directory." 
-fi
diff -urN amavisd-new.orig/files/MESSAGE.tmpl amavisd-new/files/MESSAGE.tmpl
--- amavisd-new.orig/files/MESSAGE.tmpl	Thu Aug 12 00:45:57 2004
+++ amavisd-new/files/MESSAGE.tmpl	Thu Jan  1 01:00:00 1970
@@ -1,25 +0,0 @@
-
-*******************************************************************
- To use amavisd-new, you need to install at least one virus scanner.
- The following virus scanners are available in the FreeBSD ports
- collection:
- 
- /usr/ports/security/vscan	McAfee VirusScan
- /usr/ports/security/clamav	Clam Antivirus
- /usr/ports/security/f-prot	F-Prot Antivirus
- /usr/ports/security/drweb	DrWeb antivirus suite
-
- Enable amavisd-new in /etc/rc.conf with the following line:
-
-    amavisd_enable="YES"
-
- If you want to use the amavis sendmail milter interface,
- you need the following additional line in /etc/rc.conf
-
-    amavis_milter_enable="YES"
-
- Configuration templates are available in %%PREFIX%%/etc
- as amavisd.conf-dist, amavisd.conf-sample and amavisd.conf-default.
- Documentation is available in %%DOCSDIR%%.
-*******************************************************************
-
diff -urN amavisd-new.orig/files/amavis-milter.sh.in amavisd-new/files/amavis-milter.sh.in
--- amavisd-new.orig/files/amavis-milter.sh.in	Thu Jan  1 01:00:00 1970
+++ amavisd-new/files/amavis-milter.sh.in	Thu Jun 30 09:32:18 2005
@@ -0,0 +1,32 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: amavis_milter
+# REQUIRE: amavisd
+# BEFORE: mail
+# KEYWORD: FreeBSD shutdown
+
+#
+# Add the following lines to /etc/rc.conf to enable amavis-milter:
+#
+#amavis_milter_enable="YES"
+#
+
+. %%RC_SUBR%%
+
+name=amavis_milter
+rcvar=`set_rcvar`
+
+command=%%PREFIX%%/sbin/amavis-milter
+required_files=%%PREFIX%%/etc/amavisd.conf
+
+# set defaults
+
+amavis_milter_enable=${amavis_milter_enable:-"NO"}
+amavis_milter_flags=${amavis_milter_flags:-"-D -p %%AMAVISDIR%%/amavis-milter.sock"}
+amavis_milter_user=${amavis_milter_user:-"%%AMAVISUSER%%"}
+
+load_rc_config $name
+run_rc_command "$1"
diff -urN amavisd-new.orig/files/amavis-milter.sh.tmpl amavisd-new/files/amavis-milter.sh.tmpl
--- amavisd-new.orig/files/amavis-milter.sh.tmpl	Thu Nov 20 12:00:19 2003
+++ amavisd-new/files/amavis-milter.sh.tmpl	Thu Jan  1 01:00:00 1970
@@ -1,34 +0,0 @@
-#!/bin/sh
-#
-# $FreeBSD: ports/security/amavisd-new/files/amavis-milter.sh.tmpl,v 1.1 2003/11/20 11:00:19 jeh Exp $
-#
-
-# PROVIDE: amavis_milter
-# REQUIRE: amavisd
-# BEFORE: amavisd
-# KEYWORD: FreeBSD shutdown
-
-#
-# Add the following lines to /etc/rc.conf to enable amavis-milter:
-#
-#amavis_milter_enable="YES"
-#
-
-. %%RC_SUBR%%
-
-name=amavis_milter
-rcvar=`set_rcvar`
-
-command=%%PREFIX%%/sbin/amavis-milter
-
-amavis_milter_user=%%AMAVISUSER%%
-
-required_files=%%PREFIX%%/etc/amavisd.conf
-
-# set defaults
-
-amavis_milter_enable=${amavis_milter_enable:-"NO"}
-amavis_milter_flags=${amavis_milter_flags:-"-D -p %%AMAVISDIR%%/amavis-milter.sock"}
-
-load_rc_config $name
-run_rc_command "$1"
diff -urN amavisd-new.orig/files/amavisd.sh.in amavisd-new/files/amavisd.sh.in
--- amavisd-new.orig/files/amavisd.sh.in	Thu Jan  1 01:00:00 1970
+++ amavisd-new/files/amavisd.sh.in	Thu Jun 30 09:18:30 2005
@@ -0,0 +1,39 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: amavisd
+# REQUIRE: LOGIN
+# BEFORE: mail
+# KEYWORD: FreeBSD shutdown
+
+#
+# Add the following lines to /etc/rc.conf to enable amavisd:
+#
+#amavisd_enable="YES"
+#
+
+. %%RC_SUBR%%
+
+name=amavisd
+rcvar=`set_rcvar`
+
+command=%%PREFIX%%/sbin/amavisd > /dev/null 2>&1
+pidfile=%%AMAVISDIR%%/amavisd.pid
+required_files=%%PREFIX%%/etc/amavisd.conf
+
+stop_postcmd=stop_postcmd
+
+stop_postcmd()
+{
+  rm -f $pidfile
+}
+
+# set defaults
+
+amavisd_enable=${amavisd_enable:-"NO"}
+amavisd_flags=${amavisd_flags:-"-u %%AMAVISUSER%%"}
+
+load_rc_config $name
+run_rc_command "$1"
diff -urN amavisd-new.orig/files/amavisd.sh.tmpl amavisd-new/files/amavisd.sh.tmpl
--- amavisd-new.orig/files/amavisd.sh.tmpl	Sun Jul 18 12:05:50 2004
+++ amavisd-new/files/amavisd.sh.tmpl	Thu Jan  1 01:00:00 1970
@@ -1,42 +0,0 @@
-#!/bin/sh
-#
-# $FreeBSD: ports/security/amavisd-new/files/amavisd.sh.tmpl,v 1.7 2004/07/18 10:05:50 vanilla Exp $
-#
-
-# PROVIDE: amavisd
-# REQUIRE: LOGIN
-# BEFORE: mail
-# KEYWORD: FreeBSD shutdown
-
-#
-# Add the following lines to /etc/rc.conf to enable amavisd:
-#
-#amavisd_enable="YES"
-#
-
-. %%RC_SUBR%%
-
-name=amavisd
-rcvar=`set_rcvar`
-
-command=%%PREFIX%%/sbin/amavisd > /dev/null 2>&1
-
-amavisd_flags="-u %%AMAVISUSER%%"
-
-pidfile=%%AMAVISDIR%%/amavisd.pid
-required_files=%%PREFIX%%/etc/amavisd.conf
-
-stop_postcmd=stop_postcmd
-
-stop_postcmd()
-{
-  rm -f $pidfile
-}
-
-# set defaults
-
-amavisd_enable=${amavisd_enable:-"NO"}
-amavisd_flags=${amavisd_flags:-""}
-
-load_rc_config $name
-run_rc_command "$1"
diff -urN amavisd-new.orig/files/patch-amavisd-agent amavisd-new/files/patch-amavisd-agent
--- amavisd-new.orig/files/patch-amavisd-agent	Thu Jan  1 01:00:00 1970
+++ amavisd-new/files/patch-amavisd-agent	Thu Jun 30 09:04:52 2005
@@ -0,0 +1,11 @@
+--- amavisd-agent.orig	Sun Jun 19 18:26:43 2005
++++ amavisd-agent	Sun Jun 19 18:28:04 2005
+@@ -107,7 +107,7 @@
+ # main program starts here
+   $SIG{INT} = sub { die "\n" };  # do the END code block
+   my($env) = BerkeleyDB::Env->new(
+-    '-Home'=>'/var/amavis/db', '-Flags'=> DB_INIT_CDB | DB_INIT_MPOOL);
++    '-Home'=>'%%AMAVISDIR%%/db', '-Flags'=> DB_INIT_CDB | DB_INIT_MPOOL);
+   defined $env or die "BDB no env: $BerkeleyDB::Error $!";
+   my($db) = BerkeleyDB::Hash->new(
+     '-Filename'=>'snmp.db', '-Flags'=>DB_RDONLY, '-Env'=>$env );
diff -urN amavisd-new.orig/files/pkg-deinstall.in amavisd-new/files/pkg-deinstall.in
--- amavisd-new.orig/files/pkg-deinstall.in	Thu Jan  1 01:00:00 1970
+++ amavisd-new/files/pkg-deinstall.in	Thu Jun 30 09:04:52 2005
@@ -0,0 +1,28 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+USER=%%AMAVISUSER%%
+GROUP=%%AMAVISGROUP%%
+DIR=%%AMAVISDIR%%
+QUARANTINE=%%AMAVISQUARANTINE%%
+
+if [ "$2" = "POST-DEINSTALL" ]; then
+
+    if /usr/sbin/pw group show "${GROUP}" 2>&1 >/dev/null; then
+	echo "You should manually remove the \"${GROUP}\" group."
+    fi
+
+    if /usr/sbin/pw user show "${USER}" 2>&1 >/dev/null; then
+	echo "You should manually remove the \"${USER}\" user."
+    fi
+
+    if [ -e ${DIR} ]; then
+	echo "You should manually remove the \"${DIR}\" directory."
+    fi
+ 
+    if [ -e ${QUARANTINE} ]; then
+      echo "You should manually remove the \"${QUARANTINE}\" directory."
+    fi
+fi
diff -urN amavisd-new.orig/files/pkg-install.in amavisd-new/files/pkg-install.in
--- amavisd-new.orig/files/pkg-install.in	Thu Jan  1 01:00:00 1970
+++ amavisd-new/files/pkg-install.in	Thu Jun 30 09:04:52 2005
@@ -0,0 +1,51 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+USER=%%AMAVISUSER%%
+GROUP=%%AMAVISGROUP%%
+DIR=%%AMAVISDIR%%
+QUARANTINE=%%AMAVISQUARANTINE%%
+
+if [ "$2" = "PRE-INSTALL" ]; then
+
+    if /usr/sbin/pw groupshow "${GROUP}" 2>/dev/null; then
+	echo "You already have a group \"${GROUP}\", so I will use it."
+    else
+	if /usr/sbin/pw groupadd ${GROUP} -h - -g 110
+	then
+	    echo "Added group \"${GROUP}\"."
+	else
+	    echo "Adding group \"${GROUP}\" failed..."
+	    echo "Please create it, and try again."
+	    exit 1
+	fi
+    fi
+
+    if /usr/sbin/pw user show "${USER}" 2>/dev/null; then
+	echo "You already have a user \"${USER}\", so I will use it."
+    else
+	if /usr/sbin/pw useradd ${USER} -g ${GROUP} -h - \
+	   -d ${DIR} \
+	   -s /bin/sh \
+	   -c "Scanning Virus Account" \
+	   -u 110
+	then
+	    echo "Added user \"${USER}\"."
+	else
+	    echo "Adding user \"${USER}\" failed..."
+	    echo "Please create it, and try again."
+	    exit 1
+	fi
+    fi
+
+    /usr/bin/install -o ${USER} -g ${GROUP} -m 750 -d ${DIR}
+    echo "Created \"${DIR}\" directory."
+    /usr/bin/install -o ${USER} -g ${GROUP} -m 750 -d ${DIR}/db
+    echo "Created \"${DIR}/db\" directory."
+    /usr/bin/install -o ${USER} -g ${GROUP} -m 750 -d ${DIR}/tmp
+    echo "Created \"${DIR}/tmp\" directory."
+    /usr/bin/install -o ${USER} -g ${GROUP} -m 750 -d ${QUARANTINE}
+    echo "Created \"${QUARANTINE}\" directory." 
+fi
diff -urN amavisd-new.orig/files/pkg-message.in amavisd-new/files/pkg-message.in
--- amavisd-new.orig/files/pkg-message.in	Thu Jan  1 01:00:00 1970
+++ amavisd-new/files/pkg-message.in	Thu Jun 30 09:04:52 2005
@@ -0,0 +1,25 @@
+
+*******************************************************************
+ To use amavisd-new, you need to install at least one virus scanner.
+ The following virus scanners are available in the FreeBSD ports
+ collection:
+ 
+ /usr/ports/security/vscan	McAfee VirusScan
+ /usr/ports/security/clamav	Clam Antivirus
+ /usr/ports/security/f-prot	F-Prot Antivirus
+ /usr/ports/security/drweb	DrWeb antivirus suite
+
+ Enable amavisd-new in /etc/rc.conf with the following line:
+
+    amavisd_enable="YES"
+
+ If you want to use the amavis sendmail milter interface,
+ you need the following additional line in /etc/rc.conf
+
+    amavis_milter_enable="YES"
+
+ Configuration templates are available in %%PREFIX%%/etc
+ as amavisd.conf-dist, amavisd.conf-sample and amavisd.conf-default.
+ Documentation is available in %%DOCSDIR%%.
+*******************************************************************
+
diff -urN amavisd-new.orig/pkg-plist amavisd-new/pkg-plist
--- amavisd-new.orig/pkg-plist	Mon Apr 25 16:51:44 2005
+++ amavisd-new/pkg-plist	Thu Jun 30 10:01:32 2005
@@ -1,3 +1,6 @@
+@comment $FreeBSD$
+%%AMAVIS_NOMILTER%%@unexec %%RC_DIR%%/amavis-milter%%RC_SUFX%% stop > /dev/null 2>&1 || true
+@unexec %%RC_DIR%%/amavisd%%RC_SUFX%% stop > /dev/null 2>&1 || true
  %%PORTDOCS%%%%DOCSDIR%%/AAAREADME.first
  %%PORTDOCS%%%%DOCSDIR%%/INSTALL
  %%PORTDOCS%%%%DOCSDIR%%/LDAP.schema
@@ -30,9 +33,8 @@
  etc/amavisd.conf-dist
  @exec [ ! -f %B/amavisd.conf ] && cp %B/%f %B/amavisd.conf
  etc/amavisd.conf-sample
-%%AMAVIS_NOMILTER%%etc/rc.d/amavis-milter.sh
-etc/rc.d/amavisd.sh
-%%AMAVIS_NOMILTER%%sbin/amavis
+%%AMAVIS_NOAMAVIS%%sbin/amavis
  %%AMAVIS_NOMILTER%%sbin/amavis-milter
  sbin/amavisd
+sbin/amavisd-agent
  sbin/amavisd-nanny
Comment 8 Florent Thoumie freebsd_committer freebsd_triage 2005-06-30 09:34:56 UTC
	Are you sure it's written against latest version of the port.
	The patch doesn't apply correctly for 3 files (Makefile,
	pkg-plist and files/DEINSTALL.tmpl).

-- 
Florent Thoumie
flz@FreeBSD.org
Comment 9 Blaz Zupan 2005-07-04 13:26:42 UTC
> 	Are you sure it's written against latest version of the port.
> 	The patch doesn't apply correctly for 3 files (Makefile,
> 	pkg-plist and files/DEINSTALL.tmpl).

Yes, it applies cleanly against a fresh checkout of the port from the latest 
repository.
Comment 10 Florent Thoumie freebsd_committer freebsd_triage 2005-07-06 09:52:34 UTC
State Changed
From-To: feedback->closed

Committed, thanks! 

Sorry again for the delay.
Comment 11 Dominic Marks 2005-07-15 00:30:38 UTC
Why is the rc.d script now being installed into /etc/rc.d/amavisd ?

I am referring to this section of the Makefile:

.if ${OSVERSION} >= 500037
USE_RCORDER=    amavisd.sh
RC_DIR=         /etc/rc.d
RC_SUFX=
.else
USE_RC_SUBR+=   amavisd.sh
RC_DIR=         ${PREFIX}/etc/rc.d
RC_SUFX=        .sh
.endif

Has their been some sort of policy change? Why is amavisd-new
doing this when no other ports (that I know of anyway) are? This
seems wrong to me.

If there is a good reason for it, I'd be happy to hear it.

Thanks,
-- 
Dominic Marks
Comment 12 Scot Hetzel 2005-07-15 20:07:10 UTC
On 7/14/05, Dominic Marks <dom@goodforbusiness.co.uk> wrote:
> Why is the rc.d script now being installed into /etc/rc.d/amavisd ?
>=20
> I am referring to this section of the Makefile:
>=20
> .if ${OSVERSION} >=3D 500037
> USE_RCORDER=3D    amavisd.sh
> RC_DIR=3D         /etc/rc.d
> RC_SUFX=3D
> .else
> USE_RC_SUBR+=3D   amavisd.sh
> RC_DIR=3D         ${PREFIX}/etc/rc.d
> RC_SUFX=3D        .sh
> .endif
>=20
> Has their been some sort of policy change? Why is amavisd-new
> doing this when no other ports (that I know of anyway) are? This
> seems wrong to me.
>=20
> If there is a good reason for it, I'd be happy to hear it.
>=20

I beleive the port maintainers reason for this is so that sendmail
won't complain that it can't talk to the amavisd milter dameon upon
startup.

Placing the startup script in to /etc/rc.d ensures that amavisd starts
before sendmail starts.

Scot
--=20
DISCLAIMER:
No electrons were mamed while sending this message. Only slightly bruised.
Comment 13 Dominic Marks 2005-07-15 23:43:25 UTC
On Friday 15 July 2005 20:07, Scot Hetzel wrote:
> On 7/14/05, Dominic Marks <dom@goodforbusiness.co.uk> wrote:
> > Why is the rc.d script now being installed into /etc/rc.d/amavisd ?
> >
> > I am referring to this section of the Makefile:
> >
> > .if ${OSVERSION} >= 500037
> > USE_RCORDER=    amavisd.sh
> > RC_DIR=         /etc/rc.d
> > RC_SUFX=
> > .else
> > USE_RC_SUBR+=   amavisd.sh
> > RC_DIR=         ${PREFIX}/etc/rc.d
> > RC_SUFX=        .sh
> > .endif
> >
> > Has their been some sort of policy change? Why is amavisd-new
> > doing this when no other ports (that I know of anyway) are? This
> > seems wrong to me.
> >
> > If there is a good reason for it, I'd be happy to hear it.
>
> I beleive the port maintainers reason for this is so that sendmail
> won't complain that it can't talk to the amavisd milter dameon upon
> startup.
>
> Placing the startup script in to /etc/rc.d ensures that amavisd
> starts before sendmail starts.
>
> Scot

I see. Perhaps I am being pedantic here, but it would be nice
if this behaviour was skipped for those of us who don't use
sendmail.

Of course, it is the port maintainer's decision...

Thanks for the explaination Scot!

-- 
Dominic Marks