1 # Copyright 1999-2013 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
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"
16 # We need its user/group.
17 DEPEND="app-antivirus/clamav"
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.
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"
35 # clamd listens on a local socket by default. The clamd_socket
36 # setting needs to be uncommented in the configuration file for it
38 local socket_default="#clamd_socket=\"/var/run/clamd.socket\""
39 local socket_gentoo="clamd_socket=\"/var/run/clamav/clamd.sock\""
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}~" \
46 || die "failed to update paths in the ${PN}.conf file"
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"
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"
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}"
70 insinto /etc/logrotate.d
71 doins "${PN}-logrotate"
77 dodoc CHANGELOG INSTALL README
82 elog "You will need to select databases in /etc/${PN}.conf."
83 elog "For details, please see the ${PN}(8) manual page."
85 elog 'An up-to-date description of the available Sanesecurity'
86 elog 'databases is available at,'
88 elog ' http://sanesecurity.com/usage/signatures/'