summaryrefslogtreecommitdiff
path: root/packages/clamav/clamav_0.88.4.bb
blob: 46322bd8cd3d8a01da9615604c66409465e39fb0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
DESCRIPTION = "Clam AntiVirus is a GPL anti-virus toolkit for UNIX. The main \
purpose of this software is the integration with mail servers (attachment \
scanning)."
DESCRIPTION_${PN}-lib = "The dynamic library that is shared between all of \
the Clam AntiVirus components"
DESCRIPTION_${PN}-freshclam = "An automatic virus signature update \
application for Clam AntiVirus"
DESCRIPTION_${PN}-data = "Static antivirus signature database for Clam AntiVirus"
DESCRIPTION_${PN}-daemon = "An on-demand file scanning service for Clam AntiVirus"
HOMEPAGE = "http://www.clamav.net/"
SECTION = "network"
MAINTAINER = "Jamie Lenehan <lenehan@twibble.org>"
LICENSE = "GPL"
DEPENDS = "zlib bzip2 gmp"
RDEPENDS_${PN} = "${PN}-data"
RDEPENDS_${PN}-daemon = "${PN}-data"
RRECOMMENDS_${PN} = "${PN}-freshclam"
RRECOMMENDS_${PN}-daemon = "${PN}-freshclam"
PR = "r2"

SRC_URI = "${SOURCEFORGE_MIRROR}/clamav/clamav-${PV}.tar.gz \
          file://cross-compile-fix.patch;patch=1 \
          file://libtool-fix.patch;patch=1 \
          file://clamav-daemon.init \
          file://clamav-freshclam.init \
          file://clamav-daemon.default \
          file://clamd.conf \
          file://freshclam.conf"

inherit autotools update-rc.d binconfig

# Don't check for clamav uid/gid - they don't exist on the host
# Put virus definitions in /var/lib not /usr/lib
EXTRA_OECONF = "--disable-clamav \
                --with-dbdir=${localstatedir}/lib/clamav"

do_install_append() {
        install -m 0755 -d ${D}${sysconfdir}/default ${D}${sysconfdir}/init.d \
                           ${D}${docdir}/clamav
        # Save the installed clamd.conf in the doc dir and then install our new one
        install -m 0755 ${D}${sysconfdir}/clamd.conf ${D}${docdir}/clamav/clamd.conf.example
        install -m 0755 ${WORKDIR}/clamd.conf ${D}${sysconfdir}/clamd.conf
        # Save the installed freshclam.conf in the doc dir and then install our new one
        install -m 0755 ${D}${sysconfdir}/freshclam.conf ${D}${docdir}/clamav/freshclam.conf.example
        # Install our config files and init scripts
        install -m 0755 ${WORKDIR}/freshclam.conf ${D}${sysconfdir}/freshclam.conf
        install -m 0755 ${WORKDIR}/clamav-daemon.default ${D}${sysconfdir}/default/clamav-daemon
        install -m 0755 ${WORKDIR}/clamav-daemon.init ${D}${sysconfdir}/init.d/clamav-daemon
        install -m 0755 ${WORKDIR}/clamav-freshclam.init ${D}${sysconfdir}/init.d/clamav-freshclam
}
do_stage () {
	oe_libinstall -a -so libclamav ${STAGING_LIBDIR}
	install -m 0644 libclamav/clamav.h ${STAGING_INCDIR}
}

PACKAGES += "${PN}-freshclam ${PN}-daemon ${PN}-data ${PN}-lib"

FILES_${PN} = "${bindir}/clamscan ${bindir}/sigtool ${bindir}/clamdscan"
FILES_${PN}-lib = "${libdir}/libclamav.so.*"
FILES_${PN}-freshclam = "${bindir}/freshclam \
                         ${sysconfdir}/freshclam.conf \
                         ${sysconfdir}/init.d/clamav-freshclam"
FILES_${PN}-daemon = "${sysconfdir}/clamd.conf \
                      ${sbindir}/clamd \
                      ${sysconfdir}/init.d/clamav-daemon \
                      ${sysconfdir}/default/clamav-daemon"
FILES_${PN}-data = "${localstatedir}/lib/clamav/main.cvd \
                    ${localstatedir}/lib/clamav/daily.cvd"
FILES_${PN}-dev += "${bindir}/clamav-config"

# Add clamav's user and groups
pkg_postinst_${PN}-freshclam () {
        grep -q clamav: /etc/group || addgroup clamav
        grep -q clamav: /etc/passwd || adduser --disabled-password --home=/var/lib/clamav/ \
                                               --ingroup clamav -g "ClamAV" clamav
}
pkg_postinst_${PN}-daemon () {
        grep -q clamav: /etc/group || addgroup clamav
        grep -q clamav: /etc/passwd || adduser --disabled-password --home=/var/lib/clamav/ \
                                               --ingroup clamav -g "ClamAV" clamav
}
pkg_postinst_${PN}-data () {
        grep -q clamav: /etc/group || addgroup clamav
        grep -q clamav: /etc/passwd || adduser --disabled-password --home=/var/lib/clamav/ \
                                               --ingroup clamav --no-create-home -g "ClamAV" clamav
        chown clamav:clamav \
            ${localstatedir}/lib/clamav \
            ${localstatedir}/lib/clamav/main.cvd \
            ${localstatedir}/lib/clamav/daily.cvd
}

# Indicate that the default files are configuration files
CONFFILES_${PN}-daemon = "${sysconfdir}/clamd.conf \
                          ${sysconfdir}/default/clamav-daemon"
CONFFILES_${PN}-freshclam = "${sysconfdir}/freshclam.conf"
# Mark the database as conffiles so that newer data file won't replace
# updates generated by freshclam
CONFFILES_${PN}-data = "${localstatedir}/lib/clamav/main.cvd \
                        ${localstatedir}/lib/clamav/daily.cvd"

INITSCRIPT_PACKAGES = "${PN}-daemon ${PN}-freshclam"
INITSCRIPT_NAME_${PN}-daemon = "clamav-daemon"
INITSCRIPT_NAME_${PN}-freshclam = "clamav-freshclam"
INITSCRIPT_PARAMS_${PN}-daemon = "defaults 50 50"
INITSCRIPT_PARAMS_${PN}-freshclam = "defaults 50 50"