]> gitweb.michael.orlitzky.com - mjo-overlay.git/blob - app-antivirus/clamav-unofficial-sigs/clamav-unofficial-sigs-3.7.2.ebuild
c5d235d192e633477ed7833b1b8ca9afddcf019e
[mjo-overlay.git] / app-antivirus / clamav-unofficial-sigs / clamav-unofficial-sigs-3.7.2.ebuild
1 # Copyright 1999-2013 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: $
4
5 EAPI=5
6
7 DESCRIPTION="Downloads and installs third-party clamav signatures"
8 HOMEPAGE="http://sourceforge.net/projects/unofficial-sigs"
9 SRC_URI="mirror://sourceforge/unofficial-sigs/${P}.tar.gz"
10
11 LICENSE="BSD"
12 SLOT="0"
13 KEYWORDS="~amd64"
14 IUSE=""
15
16 # We need its user/group.
17 DEPEND="app-antivirus/clamav"
18
19 # The script relies on either net-misc/socat, or Perl's
20 # IO::Socket::UNIX. We already depend on Perl, and Gentoo's Perl ships
21 # with IO::Socket::UNIX, so we can leave out net-misc/socat here.
22 RDEPEND="${DEPEND}
23 app-crypt/gnupg
24 dev-lang/perl
25 net-dns/bind-tools
26 net-misc/curl"
27
28 src_compile() {
29 # First, fix the paths contained in the configuration file. Eventually
30 # these should be moved under /run, but for now we keep them sync'ed
31 # with the default clamd.conf.
32 local pid_default="/var/run/clamd.pid"
33 local pid_gentoo="/var/run/clamav/clamd.pid"
34
35 # clamd listens on a local socket by default. The clamd_socket
36 # setting needs to be uncommented in the configuration file for it
37 # to take effect.
38 local socket_default="#clamd_socket=\"/var/run/clamd.socket\""
39 local socket_gentoo="clamd_socket=\"/var/run/clamav/clamd.sock\""
40
41 sed -i -e '$a\pkg_mgr="emerge"' \
42 -e "\$a\\pkg_rm=\"emerge -C ${PN}\"" \
43 -e "s~${socket_default}~${socket_gentoo}~" \
44 -e "s~${pid_default}~${pid_gentoo}~" \
45 "${PN}.conf" \
46 || die "failed to update paths in the ${PN}.conf file"
47
48 # Now, change the script's working directory to point to
49 # /var/lib/${PN}. We'll need to make this writable by the clamav
50 # user during src_install.
51 sed -i -e "s~/usr/unofficial-dbs~/var/lib/${PN}~" "${PN}.conf" \
52 || die "failed to update the work_dir variable in ${PN}.conf"
53
54 # Tell the script that it's been configured.
55 local cfged_default='user_configuration_complete="no"'
56 local cfged_gentoo='user_configuration_complete="yes"'
57 sed -i "s/${cfged_default}/${cfged_gentoo}/" "${PN}.conf" \
58 || die "failed to set user configuration completed in ${PN}.conf"
59 }
60
61 src_install() {
62 dosbin "${PN}.sh"
63
64 # We set the script's working directory to /var/lib/${PN} in
65 # src_compile, so make sure that the permissions are set correctly
66 # here. By default, it runs as clamav/clamav.
67 diropts -m 0755 -o clamav -g clamav
68 dodir "/var/lib/${PN}"
69
70 insinto /etc/logrotate.d
71 doins "${PN}-logrotate"
72
73 insinto /etc
74 doins "${PN}.conf"
75
76 doman "${PN}.8"
77 dodoc CHANGELOG INSTALL README
78 }
79
80 pkg_postinst() {
81 elog ''
82 elog "You will need to select databases in /etc/${PN}.conf."
83 elog "For details, please see the ${PN}(8) manual page."
84 elog ''
85 elog 'An up-to-date description of the available Sanesecurity'
86 elog 'databases is available at,'
87 elog ''
88 elog ' http://sanesecurity.com/usage/signatures/'
89 elog ''
90 }