aboutsummaryrefslogtreecommitdiff
path: root/security
diff options
context:
space:
mode:
authorDirk Meyer <dinoex@FreeBSD.org>2003-10-03 13:31:26 +0000
committerDirk Meyer <dinoex@FreeBSD.org>2003-10-03 13:31:26 +0000
commit8ebd5b645a36ea105a19011b515da8d8bcba85f6 (patch)
tree9f038e817bdfcf6b8220d881d797257ddb3fa75e /security
parenta03d2350c75527aa650de4d0504a037a5a8f1105 (diff)
downloadports-8ebd5b645a36ea105a19011b515da8d8bcba85f6.tar.gz
ports-8ebd5b645a36ea105a19011b515da8d8bcba85f6.zip
Notes
Diffstat (limited to 'security')
-rw-r--r--security/clamav-devel/Makefile44
-rw-r--r--security/clamav-devel/distinfo2
-rw-r--r--security/clamav-devel/files/clamav-clamd.sh69
-rw-r--r--security/clamav-devel/files/clamav-milter.sh68
-rw-r--r--security/clamav-devel/files/patch-zzip-conf.h11
-rw-r--r--security/clamav-devel/pkg-deinstall7
-rw-r--r--security/clamav-devel/pkg-install4
-rw-r--r--security/clamav-devel/pkg-plist12
8 files changed, 150 insertions, 67 deletions
diff --git a/security/clamav-devel/Makefile b/security/clamav-devel/Makefile
index 5fe5b074c228..7aca6dd50713 100644
--- a/security/clamav-devel/Makefile
+++ b/security/clamav-devel/Makefile
@@ -6,7 +6,7 @@
#
PORTNAME= clamav
-PORTVERSION= 20030930
+PORTVERSION= 20031001
CATEGORIES= security
MASTER_SITES= http://clamav.sourceforge.net/snapshot/
PKGNAMESUFFIX= -devel
@@ -41,12 +41,18 @@ MAN8= clamd.8
CLAMAVUSER?= clamav
CLAMAVGROUP?= clamav
+CLAMAV_CLAMD_SOCKET?= /var/run/clamav/clamd
+CLAMAV_MILTER_SOCKET?= /var/run/clmilter.sock
PLIST_SUB+= CLAMAVUSER="${CLAMAVUSER}"
PLIST_SUB+= CLAMAVGROUP="${CLAMAVGROUP}"
SED_SCRIPT= -e 's|%%PREFIX%%|${PREFIX}|g' \
- -e 's|%%DATADIR%%|${DATADIR}|g'
+ -e 's|%%DATADIR%%|${DATADIR}|g' \
+ -e 's|%%CLAMAVUSER%%|${CLAMAVUSER}|g' \
+ -e 's|%%CLAMAVGROUP%%|${CLAMAVGROUP}|g' \
+ -e 's|%%CLAMAV_CLAMD_SOCKET%%|${CLAMAV_CLAMD_SOCKET}|g' \
+ -e 's|%%CLAMAV_MILTER_SOCKET%%|${CLAMAV_MILTER_SOCKET}|g'
SED_CONF= -E -e 's|^\#?(Example)$$|\#\1|' \
-e 's|^\#?(LogFile) .*$$|\1 /var/log/clamav/clamd.log|' \
@@ -57,6 +63,15 @@ SED_CONF= -E -e 's|^\#?(Example)$$|\#\1|' \
.include <bsd.port.pre.mk>
+USE_RC_SUBR= yes
+RC_DIR= ${PREFIX}/etc/rc.d
+RC_SUFX= .sh
+SED_SCRIPT+= -e 's|%%RC_SUBR%%|${RC_SUBR}|g' \
+ -e 's|%%RC_DIR%%|${RC_DIR}|g' \
+ -e 's|%%RC_SUFX%%|${RC_SUFX}|g'
+PLIST_SUB+= RC_DIR=${RC_DIR} \
+ RC_SUFX=${RC_SUFX}
+
.if ${OSVERSION} < 501001
# compiles only with optimizer
CFLAGS+= -O
@@ -70,12 +85,6 @@ PLIST_SUB+= CLAMAV-MILTER:=""
PLIST_SUB+= CLAMAV-MILTER:="@comment "
.endif
-post-extract:
- @${SED} ${SED_SCRIPT} ${FILESDIR}/clamav-milter.sh \
- > ${WRKSRC}/clamav-milter.sh
- @${SED} ${SED_SCRIPT} ${FILESDIR}/clamav-clamd.sh \
- > ${WRKSRC}/clamav-clamd.sh
-
post-patch:
@${REINPLACE_CMD} -e 's|-pthread|${PTHREAD_LIBS}|g' ${WRKSRC}/configure
@${REINPLACE_CMD} -e 's|/usr/lib/sendmail|/usr/sbin/sendmail|g' \
@@ -88,21 +97,26 @@ pre-configure:
post-build:
@${SED} ${SED_CONF} ${BUILD_WRKSRC}/etc/clamav.conf \
- >${BUILD_WRKSRC}/etc/clamav.conf.default
+ > ${BUILD_WRKSRC}/etc/clamav.conf.default
+ @${SED} ${SED_SCRIPT} ${FILESDIR}/clamav-clamd.sh \
+ > ${WRKDIR}/clamav-clamd.sh
+ @${SED} ${SED_SCRIPT} ${FILESDIR}/clamav-milter.sh \
+ > ${WRKDIR}/clamav-milter.sh
pre-install:
${SETENV} PKG_PREFIX=${PREFIX} \
- ${SH} ${PKGINSTALL} ${PREFIX}
+ ${SH} ${PKGINSTALL} ${PREFIX} PRE-INSTALL
post-install:
@[ -f ${PREFIX}/etc/clamav.conf ] || \
- ${CP} ${PREFIX}/etc/clamav.conf.default ${PREFIX}/etc/clamav.conf
+ ${CP} ${PREFIX}/etc/clamav.conf.default \
+ ${PREFIX}/etc/clamav.conf
@${CHOWN} -R ${CLAMAVUSER}:${CLAMAVGROUP} ${DATADIR}
- ${INSTALL_SCRIPT} ${WRKSRC}/clamav-clamd.sh \
- ${LOCALBASE}/etc/rc.d/clamav-clamd.sh.sample
+ @${INSTALL_SCRIPT} ${WRKDIR}/clamav-clamd.sh \
+ ${RC_DIR}/clamav-clamd${RC_SUFX}
.if defined(WITH_MILTER)
- ${INSTALL_SCRIPT} ${WRKSRC}/clamav-milter.sh \
- ${LOCALBASE}/etc/rc.d/clamav-milter.sh.sample
+ @${INSTALL_SCRIPT} ${WRKDIR}/clamav-milter.sh \
+ ${RC_DIR}/clamav-milter${RC_SUFX}
.endif
.include <bsd.port.post.mk>
diff --git a/security/clamav-devel/distinfo b/security/clamav-devel/distinfo
index 06e127eea73e..13b5959725ff 100644
--- a/security/clamav-devel/distinfo
+++ b/security/clamav-devel/distinfo
@@ -1 +1 @@
-MD5 (clamav-devel-20030930.tar.gz) = 7c15623dc0750f64431ee692a0046d6e
+MD5 (clamav-devel-20031001.tar.gz) = cb4e13698fbe2d68b7c5e5f624e66737
diff --git a/security/clamav-devel/files/clamav-clamd.sh b/security/clamav-devel/files/clamav-clamd.sh
index e0ea51c02d01..add634772cea 100644
--- a/security/clamav-devel/files/clamav-clamd.sh
+++ b/security/clamav-devel/files/clamav-clamd.sh
@@ -1,18 +1,53 @@
#!/bin/sh
-PREFIX=%%PREFIX%%
-
-case "$1" in
-start)
- # remove old socket
- rm -f /tmp/clamd
- [ -x ${PREFIX}/sbin/clamd ] && ${PREFIX}/sbin/clamd > /dev/null && echo -n ' clamd'
- ;;
-stop)
- killall 'clamd' && echo -n ' clamd'
- ;;
-*)
- echo "Usage: ${0##*/} { start | stop }" >&2
- ;;
-esac
-
-exit 0
+#
+# $FreeBSD$
+#
+
+# PROVIDE: clamd
+# REQUIRE: LOGIN
+# BEFORE: mail
+# KEYWORD: FreeBSD shutdown
+
+#
+# Add the following lines to /etc/rc.conf to enable clamd:
+#
+#clamav_clamd_enable="YES"
+#
+# See clamd(8) for flags
+#
+
+. %%RC_SUBR%%
+
+name=clamav_clamd
+rcvar=`set_rcvar`
+
+command=%%PREFIX%%/sbin/clamd
+pidfile=/var/run/clamav/clamd.pid
+required_dirs=%%DATADIR%%
+required_files=%%PREFIX%%/etc/clamav.conf
+
+start_precmd=start_precmd
+
+start_precmd()
+{
+ if [ -S "$clamd_socket" ]; then
+ warn "Stale socket $clamd_socket removed."
+ rm "$clamd_socket"
+ fi
+}
+
+stop_postcmd=stop_postcmd
+
+stop_postcmd()
+{
+ rm -f $pidfile
+}
+
+# set defaults
+
+clamav_clamd_enable=${clamav_clamd_enable:-"NO"}
+clamav_clamd_flags=${clamav_clamd_flags:-""}
+clamav_clamd_socket=${clamav_clamd_socket:-"%%CLAMAV_CLAMD_SOCKET%%"}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/security/clamav-devel/files/clamav-milter.sh b/security/clamav-devel/files/clamav-milter.sh
index a60723250ab6..fa7cbfd693f7 100644
--- a/security/clamav-devel/files/clamav-milter.sh
+++ b/security/clamav-devel/files/clamav-milter.sh
@@ -1,28 +1,48 @@
#!/bin/sh
#
-# runs clamd and clamav-milter
+# $FreeBSD$
#
-case "$1" in
-'start')
- rm -f /tmp/clamd /var/run/clmilter.sock
- %%PREFIX%%/sbin/clamd && echo -n " clamd"
- %%PREFIX%%/sbin/clamav-milter \
- --local \
- --outgoing \
- --max-children=50 \
- /var/run/clmilter.sock &
- echo -n " clamav-milter"
- ;;
-'stop')
- killall 'clamav-milter'
- echo -n " clamav-milter"
- killall 'clamd'
- echo -n " clamad"
- ;;
-*)
- echo "Usage: ${0##*/} { start | stop }"
- ;;
-esac
-
-exit 0
+# PROVIDE: clamav-milter
+# REQUIRE: LOGIN
+# BEFORE: mail
+# KEYWORD: FreeBSD shutdown
+
+#
+# Add the following lines to /etc/rc.conf to enable clamd:
+#
+#clamav_milter="YES"
+#
+# See clamav-milter(1) for flags
+#
+
+. %%RC_SUBR%%
+
+name=clamav_milter
+rcvar=`set_rcvar`
+
+command=%%PREFIX%%/sbin/clamav-milter
+required_dirs=%%DATADIR%%
+required_files=%%PREFIX%%/etc/clamav.conf
+
+start_precmd=start_precmd
+
+start_precmd()
+{
+ if [ -S "$clamav_milter_socket" ]; then
+ warn "Stale socket $clamav_milter_socket removed."
+ rm "$clamav_milter_socket"
+ fi
+}
+
+# set defaults
+
+clamav_milter_enable=${clamav_milter_enable:-"NO"}
+clamav_milter_socket=${clamav_milter_socket:-"%%CLAMAV_MILTER_SOCKET%%"}
+clamav_milter_flags=${clamav_milter_flags:-"--postmaster-only --local --outgoing --max-children=50"}
+
+load_rc_config $name
+
+# add socket to any given argument
+clamav_milter_flags="${clamav_milter_flags} ${clamav_milter_socket}"
+run_rc_command "$1"
diff --git a/security/clamav-devel/files/patch-zzip-conf.h b/security/clamav-devel/files/patch-zzip-conf.h
new file mode 100644
index 000000000000..d518b5dfbc50
--- /dev/null
+++ b/security/clamav-devel/files/patch-zzip-conf.h
@@ -0,0 +1,11 @@
+--- libclamav/zziplib/zzip-conf.h.orig Mon Sep 29 13:44:52 2003
++++ libclamav/zziplib/zzip-conf.h Fri Oct 3 15:24:20 2003
+@@ -64,7 +64,7 @@
+ #ifdef ZZIP_ssize_t
+ #define _zzip_ssize_t ZZIP_ssize_t
+ #else
+-#define _zzip_ssize_t ssize_t
++#define _zzip_ssize_t size_t
+ #endif
+ #endif
+
diff --git a/security/clamav-devel/pkg-deinstall b/security/clamav-devel/pkg-deinstall
new file mode 100644
index 000000000000..f437ec16cb90
--- /dev/null
+++ b/security/clamav-devel/pkg-deinstall
@@ -0,0 +1,7 @@
+if [ ! "$2" = "POST-DEINSTALL" ]; then
+ exit 0
+fi
+echo "----------------------------------------------------------"
+echo " If you really want to remove this package, please remove"
+echo " the clamav-user and clean out log files "
+echo "----------------------------------------------------------"
diff --git a/security/clamav-devel/pkg-install b/security/clamav-devel/pkg-install
index 72596f16fc59..418e2e9bc8d5 100644
--- a/security/clamav-devel/pkg-install
+++ b/security/clamav-devel/pkg-install
@@ -1,5 +1,9 @@
#!/bin/sh
+if [ ! "$2" = "PRE-INSTALL" ]; then
+ exit 0
+fi
+
if [ -z "${CLAMAVUSER}" ]; then
CLAMAVUSER=clamav
fi
diff --git a/security/clamav-devel/pkg-plist b/security/clamav-devel/pkg-plist
index efc624f94139..820f593a4da3 100644
--- a/security/clamav-devel/pkg-plist
+++ b/security/clamav-devel/pkg-plist
@@ -1,10 +1,9 @@
-@exec mkdir -p share/clamav
bin/clamscan
bin/clamdscan
bin/freshclam
bin/sigtool
-etc/rc.d/clamav-clamd.sh.sample
-%%CLAMAV-MILTER:%%etc/rc.d/clamav-milter.sh.sample
+etc/rc.d/clamav-clamd%%RC_SUFX%%
+%%CLAMAV-MILTER:%%etc/rc.d/clamav-milter%%RC_SUFX%%
%%CLAMAV-MILTER:%%sbin/clamav-milter
sbin/clamd
include/clamav.h
@@ -21,10 +20,3 @@ etc/clamav.conf.default
@dirrm %%DATADIR%%
@unexec rmdir /var/run/clamav 2>/dev/null || true
@unexec rmdir /var/log/clamav 2>/dev/null || true
-@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 ""