ports/57254: Upgrade security/clamav-devel port

Rob Evers rob at debank.tv
Fri Sep 26 16:50:17 UTC 2003


>Number:         57254
>Category:       ports
>Synopsis:       Upgrade security/clamav-devel port
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          maintainer-update
>Submitter-Id:   current-users
>Arrival-Date:   Fri Sep 26 09:50:11 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     Rob Evers
>Release:        FreeBSD 4.9-PRERELEASE i386
>Organization:
>Environment:
System: FreeBSD haha.debank.tv 4.9-PRERELEASE FreeBSD 4.9-PRERELEASE #0: Thu Sep 18 16:37:14 CEST 2003 rob at haha.debank.tv:/usr/obj/usr/src/sys/HAHA i386


	
>Description:
Upgrade security/clamav-devel port, add a few switches for spooldir and user
The clamav-user doesn't get deinstalled by default (easy when upgrading),
after deinstall a message is presented to remove the clamav-user if neccesary.

>How-To-Repeat:
>Fix:


--- clamav-devel.patch begins here ---
diff -ruN clamav-devel.orig/Makefile clamav-devel/Makefile
--- clamav-devel.orig/Makefile	Fri Sep 26 15:08:02 2003
+++ clamav-devel/Makefile	Fri Sep 26 18:34:47 2003
@@ -6,12 +6,11 @@
 #
 
 PORTNAME=	clamav
-PORTVERSION=	20030829
-PORTREVISION=	1
+PORTVERSION=	20030926
 CATEGORIES=	security
 MASTER_SITES=	http://clamav.sourceforge.net/snapshot/
 PKGNAMESUFFIX=	-devel
-DISTNAME=	${PORTNAME}-${PORTVERSION}
+DISTNAME=	${PORTNAME}${PKGNAMESUFFIX}-${PORTVERSION}
 
 MAINTAINER=	rob at debank.tv
 COMMENT=	Command line virus scanner written entirely in C
@@ -39,6 +38,11 @@
 MAN5=		clamav.conf.5
 MAN8=		clamd.8
 
+CLAMAVUSER?=	clamav
+SPOOLDIR?=	/var/clamd
+PLIST_SUB+=	SPOOLDIR="${SPOOLDIR}"
+PLIST_SUB+=	CLAMAVUSER="${CLAMAVUSER}"
+
 .include <bsd.port.pre.mk>
 
 .if ${OSVERSION} < 510001
@@ -65,14 +69,9 @@
 	@${REINPLACE_CMD} -e 's|/usr/lib/sendmail|/usr/sbin/sendmail|g' \
 		${WRKSRC}/clamav-milter/clamav-milter.c
 
-pre-install:
-	@${ECHO} "===>  Creating custom user to run clamav..."
-	${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
-
 post-install:
-	@${ECHO} "===>  Setting permissions..."
-	@${SETENV} PKG_PREFIX=${PREFIX} \
-	${SH} ${PKGINSTALL} ${PREFIX} POST-INSTALL
+	${SETENV} PKG_PREFIX=${PREFIX} \
+		${SH} ${PKGINSTALL} ${PREFIX}
 	${INSTALL_SCRIPT} ${WRKSRC}/clamav-clamd.sh \
 		${LOCALBASE}/etc/rc.d/clamav-clamd.sh.sample
 .if defined(WITH_MILTER)
diff -ruN clamav-devel.orig/distinfo clamav-devel/distinfo
--- clamav-devel.orig/distinfo	Fri Sep 26 15:08:02 2003
+++ clamav-devel/distinfo	Fri Sep 26 15:12:05 2003
@@ -1 +1 @@
-MD5 (clamav-20030829.tar.gz) = 2189904a13d126d02f166b1638e65bcd
+MD5 (clamav-devel-20030926.tar.gz) = 7b8f32e8dc373c51e1cb1a2bda07bdad
diff -ruN clamav-devel.orig/pkg-install clamav-devel/pkg-install
--- clamav-devel.orig/pkg-install	Fri Sep 26 15:08:02 2003
+++ clamav-devel/pkg-install	Fri Sep 26 18:36:23 2003
@@ -1,31 +1,39 @@
 #!/bin/sh
 
+if [ -z "${CLAMAVUSER}" ]; then
+	CLAMAVUSER=clamav
+fi
 
-if [ "$2" != "PRE-INSTALL" ]; then
-    chown -R clamav:clamav ${PKG_PREFIX}/share/clamav
+if [ -z "${SPOOLDIR}" ]; then
+	SPOOLDIR=/var/clamd
 fi
 
-USER=clamav
-GROUP=clamav
+CLAMAVGROUP=${CLAMAVUSER}
 
-if ! pw groupshow "$GROUP" 2>/dev/null 1>&2; then
-	if pw groupadd $GROUP; then
-		echo "===> Added group \"$GROUP\"."
+echo "===> Adding user \"${CLAMAVUSER}\" if necessary."
+if ! pw groupshow "${CLAMAVGROUP}" 2>/dev/null 1>&2; then
+	if pw groupadd ${CLAMAVGROUP}; then
+		echo "===> Added group \"${CLAMAVGROUP}\"."
 	else
-                echo "===> Adding group \"$GROUP\" failed..."
+                echo "===> Adding group \"${CLAMAVGROUP}\" failed..."
                 exit 1
-        fi
+	fi
 fi
 
-if ! pw usershow "$USER" 2>/dev/null 1>&2; then
-        if pw useradd $USER -g $GROUP -h - \
-                -s "/sbin/nologin" -d "/nonexistent" \
-                -c "Clam Antivirus"; \
+if ! pw usershow "${CLAMAVUSER}" 2>/dev/null 1>&2; then
+	if pw useradd ${CLAMAVUSER} -g ${CLAMAVGROUP} -h - \
+		-s "/usr/sbin/nologin" -d "${SPOOLDIR}" \
+		-c "Clam Antivirus"; \
         then
-                echo "===> Added user \"$USER\"."
+                echo "===> Added user \"${CLAMAVUSER}\"."
         else
-                echo "===> Adding user \"$USER\" failed..."
+                echo "===> Adding user \"${CLAMAVUSER}\" failed..."
                 exit 1
         fi
 fi
+
+echo "===> Setting permissions..."
+mkdir ${SPOOLDIR}
+chown -R ${CLAMAVUSER}:${CLAMAVGROUP} ${PKG_PREFIX}/share/clamav ${SPOOLDIR}
+
 exit 0
diff -ruN clamav-devel.orig/pkg-plist clamav-devel/pkg-plist
--- clamav-devel.orig/pkg-plist	Fri Sep 26 15:08:02 2003
+++ clamav-devel/pkg-plist	Fri Sep 26 18:30:46 2003
@@ -13,6 +13,11 @@
 lib/libclamav.la
 lib/libclamav.a
 share/clamav/mirrors.txt
- at exec chown clamav share/clamav share/clamav/mirrors.txt share/clamav/viruses.db share/clamav/viruses.db2
 @dirrm share/clamav
- at unexec rmuser -y clamav
+ at unexec echo ""
+ at unexec echo "========================================================="
+ at unexec echo " If you want to deinstall this package permanently then"
+ at unexec echo "               \"rmuser -y %%CLAMAVUSER%%\" "
+ at unexec echo " This will remove clamav's spool-directory and user "
+ at unexec echo "========================================================="
+ at unexec echo ""
--- clamav-devel.patch ends here ---


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



More information about the freebsd-ports-bugs mailing list