- Udpate to 20030926

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.

PR:		57254
Submitted by:	rob@debank.tv
This commit is contained in:
Dirk Meyer
2003-09-26 17:34:19 +00:00
parent a0f1b3ae49
commit e2db2a73e4
4 changed files with 45 additions and 33 deletions

View File

@@ -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@debank.tv
COMMENT= Command line virus scanner written entirely in C
@@ -39,6 +38,11 @@ MAN1= clamscan.1 freshclam.1 sigtool.1 clamdscan.1 clamav-milter.1
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 @@ post-patch:
@${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)

View File

@@ -1 +1 @@
MD5 (clamav-20030829.tar.gz) = 2189904a13d126d02f166b1638e65bcd
MD5 (clamav-devel-20030926.tar.gz) = 7b8f32e8dc373c51e1cb1a2bda07bdad

View File

@@ -1,31 +1,39 @@
#!/bin/sh
if [ "$2" != "PRE-INSTALL" ]; then
chown -R clamav:clamav ${PKG_PREFIX}/share/clamav
if [ -z "${CLAMAVUSER}" ]; then
CLAMAVUSER=clamav
fi
USER=clamav
GROUP=clamav
if [ -z "${SPOOLDIR}" ]; then
SPOOLDIR=/var/clamd
fi
if ! pw groupshow "$GROUP" 2>/dev/null 1>&2; then
if pw groupadd $GROUP; then
echo "===> Added group \"$GROUP\"."
CLAMAVGROUP=${CLAMAVUSER}
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
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 \"${CLAMAVUSER}\"."
else
echo "===> Adding user \"${CLAMAVUSER}\" failed..."
exit 1
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"; \
then
echo "===> Added user \"$USER\"."
else
echo "===> Adding user \"$USER\" failed..."
exit 1
fi
fi
echo "===> Setting permissions..."
mkdir ${SPOOLDIR}
chown -R ${CLAMAVUSER}:${CLAMAVGROUP} ${PKG_PREFIX}/share/clamav ${SPOOLDIR}
exit 0

View File

@@ -13,6 +13,11 @@ lib/libclamav.so
lib/libclamav.la
lib/libclamav.a
share/clamav/mirrors.txt
@exec chown clamav share/clamav share/clamav/mirrors.txt share/clamav/viruses.db share/clamav/viruses.db2
@dirrm share/clamav
@unexec rmuser -y clamav
@unexec echo ""
@unexec echo "========================================================="
@unexec echo " If you want to deinstall this package permanently then"
@unexec echo " \"rmuser -y %%CLAMAVUSER%%\" "
@unexec echo " This will remove clamav's spool-directory and user "
@unexec echo "========================================================="
@unexec echo ""