diff --git a/security/clamav/Makefile b/security/clamav/Makefile index 83495835e79c..e905e8de09a3 100644 --- a/security/clamav/Makefile +++ b/security/clamav/Makefile @@ -40,7 +40,8 @@ PKGDEINSTALL= ${WRKDIR}/pkg-deinstall PORTDOCS= NEWS ChangeLog html DBDIR= /var/db/clamav -PLIST_SUB+= DBDIR=${DBDIR} +RUNDIR= /var/run/clamav +PLIST_SUB+= DBDIR=${DBDIR} RUNDIR=${RUNDIR} CONFIGURE_ARGS= --with-dbdir=${DBDIR} \ --disable-clamuko \ @@ -63,11 +64,12 @@ CONFLICTS= clamav-devel-[0-9]* CLAMAVUSER?= clamav CLAMAVGROUP?= clamav -CLAMAV_CLAMD_SOCKET?= /var/run/clamav/clamd -CLAMAV_MILTER_SOCKET?= /var/run/clamav/clmilter.sock +CLAMAV_CLAMD_SOCKET?= ${RUNDIR}/clamd +CLAMAV_MILTER_SOCKET?= ${RUNDIR}/clmilter.sock SED_SCRIPT= -e 's|%%PREFIX%%|${PREFIX}|g' \ -e 's|%%DBDIR%%|${DBDIR}|g' \ + -e 's|%%RUNDIR%%|${RUNDIR}|g' \ -e 's|%%CLAMAVUSER%%|${CLAMAVUSER}|g' \ -e 's|%%CLAMAVGROUP%%|${CLAMAVGROUP}|g' \ -e 's|%%CLAMAV_CLAMD_SOCKET%%|${CLAMAV_CLAMD_SOCKET}|g' \ @@ -75,7 +77,7 @@ SED_SCRIPT= -e 's|%%PREFIX%%|${PREFIX}|g' \ SED_CONF= -E -e 's|^\#?(Example)$$|\#\1|' \ -e 's|^\#?((Update)?LogFile) .*/([a-z]+\.log)$$|\1 /var/log/clamav/\3|' \ - -e 's|^\#?(PidFile) .*/([a-z]+\.pid)$$|\1 /var/run/clamav/\2|' \ + -e 's|^\#?(PidFile) .*/([a-z]+\.pid)$$|\1 ${RUNDIR}/\2|' \ -e 's|^\#?(LocalSocket) .*$$|\1 ${CLAMAV_CLAMD_SOCKET}|' \ -e 's|^\#?(User) .*$$|\1 ${CLAMAVUSER}|' \ -e 's|^\#?(AllowSupplementaryGroups)$$|\1|' \ diff --git a/security/clamav/files/clamav-clamd.sh b/security/clamav/files/clamav-clamd.sh index ae1abb416814..c9019a8e3ac9 100644 --- a/security/clamav/files/clamav-clamd.sh +++ b/security/clamav/files/clamav-clamd.sh @@ -22,7 +22,7 @@ name=clamav_clamd rcvar=`set_rcvar` command=%%PREFIX%%/sbin/clamd -pidfile=/var/run/clamav/clamd.pid +pidfile=%%RUNDIR%%/clamd.pid required_dirs=%%DBDIR%% required_files=%%PREFIX%%/etc/clamd.conf diff --git a/security/clamav/files/clamav-freshclam.sh b/security/clamav/files/clamav-freshclam.sh index 35e6ea2b226a..3ade51a5f538 100644 --- a/security/clamav/files/clamav-freshclam.sh +++ b/security/clamav/files/clamav-freshclam.sh @@ -4,7 +4,7 @@ # # PROVIDE: freshclam -# REQUIRE: LOGIN +# REQUIRE: LOGIN clamd # BEFORE: mail # KEYWORD: FreeBSD shutdown @@ -22,7 +22,7 @@ name=clamav_freshclam rcvar=`set_rcvar` command=%%PREFIX%%/bin/freshclam -pidfile=/var/run/clamav/freshclam.pid +pidfile=%%RUNDIR%%/freshclam.pid command_args="--daemon" required_dirs=%%DBDIR%% required_files=%%PREFIX%%/etc/freshclam.conf diff --git a/security/clamav/files/clamav-milter.sh b/security/clamav/files/clamav-milter.sh index bd09f7ec0ac5..a69f974848c9 100644 --- a/security/clamav/files/clamav-milter.sh +++ b/security/clamav/files/clamav-milter.sh @@ -4,7 +4,7 @@ # # PROVIDE: clamav-milter -# REQUIRE: LOGIN +# REQUIRE: LOGIN clamd # BEFORE: mail # KEYWORD: FreeBSD shutdown @@ -22,6 +22,7 @@ name=clamav_milter rcvar=`set_rcvar` command=%%PREFIX%%/sbin/clamav-milter +pidfile=%%RUNDIR%%/clamav-milter.pid required_dirs=%%DBDIR%% required_files=%%PREFIX%%/etc/clamd.conf @@ -33,7 +34,7 @@ start_precmd() warn "Stale socket $clamav_milter_socket removed." rm "$clamav_milter_socket" fi - rc_flags="${flags:-$clamav_milter_flags} $clamav_milter_socket" + rc_flags="--pidfile ${pidfile} ${flags:-$clamav_milter_flags} $clamav_milter_socket" } # read settings, set default values diff --git a/security/clamav/pkg-plist b/security/clamav/pkg-plist index a9a4485f7b61..5c5fb5dcfc6b 100644 --- a/security/clamav/pkg-plist +++ b/security/clamav/pkg-plist @@ -1,6 +1,7 @@ @comment $FreeBSD$ -@unexec [ ! -f /var/run/clamav/clamd.pid ] || %%RC_DIR%%/clamav-clamd%%RC_SUFX%% stop || true -@unexec [ ! -f /var/run/clamav/freshclam.pid ] || %%RC_DIR%%/clamav-freshclam%%RC_SUFX%% stop || true +%%CLAMAV-MILTER%%@unexec [ ! -f %%RUNDIR%%/clamav-milter.pid ] || %%RC_DIR%%/clamav-milter%%RC_SUFX%% stop || true +@unexec [ ! -f %%RUNDIR%%/freshclam.pid ] || %%RC_DIR%%/clamav-freshclam%%RC_SUFX%% stop || true +@unexec [ ! -f %%RUNDIR%%/clamd.pid ] || %%RC_DIR%%/clamav-clamd%%RC_SUFX%% stop || true bin/clamav-config bin/clamscan bin/clamdscan @@ -25,5 +26,5 @@ etc/freshclam.conf.default @unexec [ ! -f %%DBDIR%%/daily.cvd ] || rm -f %%DBDIR%%/daily.cvd || true @unexec [ ! -f %%DBDIR%%/main.cvd ] || rm -f %%DBDIR%%/main.cvd || true @unexec rmdir %%DBDIR%% -@unexec rmdir /var/run/clamav 2>/dev/null || true +@unexec rmdir %%RUNDIR%% 2>/dev/null || true @unexec rmdir /var/log/clamav 2>/dev/null || true