1. Make clamav-milter write its pidfile.

2. Shut down clamav daemons in the right order
   on uninstall (or else they may refuse to quit.)
3. Use rcorder(8) keywords to guarantee the right
   startup/shutdown order of the clamav services.

PR:		ports/75607
Approved by:	the maintainer
This commit is contained in:
Yaroslav Tykhiy 2005-01-12 17:57:58 +00:00
parent 9e8cf22af2
commit 07ea270434
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=126242
5 changed files with 16 additions and 12 deletions

View file

@ -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|' \

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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