freebsd-ports/security/clamav-lts/files/clamav-clamd.in
Yasuhiro Kimura e761728685 security/clamav-lts: Add new port
* Add Long Term Support release of ClamAV
* Add CONFLICTS_INSTALL to security/clamav
* Add entry to UPDATING that explains
  - Upstream changed their end-of-life policy and LTS release is
    introduced
  - How to switch from regular release (security/clamav) to LTS
    release (security/clamav-lts)

Note about setting PORTEPOCH

In general new port should not set PORTEPOCH. But in this case it
should be set with following reason.

1. Recently upstream changed their end-of-life policy as following.
  - Regular feature release (= 0.xyz.0 release) is released more
    frequently, and life time of each feature release is shortened to
    about 4 months.
  - To compensate for the short lifetime of regular feature release,
    Long Term Support feature release is introduced and its life time
    is about 3 years.
2. First LTS starts with version 0.103.3 and it is same as current
   version of security/clamav.
3. Because of short lifetime of regular feature release, it is
   probable that not a few users of security/clamav want to switch to
   security/clamav-lts after the latter is connected (and the former
   is updated to 0.104.0).
3. For such users the entry is added to UPDATING about how to switch
   from security/clamav to security/clamav-lts. And binary package
   user is suggested to execute
   `pkg set -o security/clamav:security/clamav-lts`. This command
   changes the origin of already installed clamav packages. So user
   can switch to LTS version without reinstalling.
4. But if PORTEPOCH isn't set in security/clamav-lts, binary package
   user who executed above command will notice that version of
   installed package (0.103.3,1) succeeds to current version of
   security/clamav-lts (0.103.3). The situation doesn't change after
   new patch release (0.103.4 for example) is released and it causes
   the problem that installed package isn't properly upgraded with
   `pkg upgrade`.
5. So PORTEPOCH is set in  security/clamav-lts to prevent binary
   package user from suffering from such problem.
2021-10-07 17:52:06 +09:00

51 lines
1.1 KiB
Bash

#!/bin/sh
# PROVIDE: clamav_clamd
# REQUIRE: LOGIN
# BEFORE: mail
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable clamd:
#
# clamav_clamd_enable="YES"
# clamav_clamd_flags="<set as needed>"
#
# See clamd(8) for flags
#
. /etc/rc.subr
name=clamav_clamd
rcvar=clamav_clamd_enable
# read settings, set default values
load_rc_config "$name"
: ${clamav_clamd_enable:=NO}
: ${clamav_clamd_socket="%%CLAMAV_CLAMD_SOCKET%%"}
: ${clamav_clamd_pidfile="%%CLAMAV_CLAMD_PIDFILE%%"}
: ${clamav_clamd_user="%%CLAMAVUSER%%"}
command=%%PREFIX%%/sbin/clamd
required_dirs=%%DBDIR%%
required_files=%%PREFIX%%/etc/clamd.conf
start_precmd=clamav_clamd_precmd
extra_commands=reload
reload_cmd="%%PREFIX%%/bin/clamdscan --reload"
#clamav .93 won't start without a valid main.c[vl]d file
clamav_clamd_precmd()
{
local rundir=${clamav_clamd_pidfile%/*}
if [ ! -d $rundir ] ; then
install -d -m 0755 -o ${clamav_clamd_user} -g ${clamav_clamd_user} $rundir
fi
if [ ! -f %%DBDIR%%/main.cvd -a ! -f %%DBDIR%%/main.cld ];then
echo "Missing %%DBDIR%%/*.cvd or *.cld files. You must run freshclam first"
exit 1
fi
}
run_rc_command "$1"