| 1 |
# Copyright 1999-2012 Gentoo Foundation
|
| 2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
# $Header: /var/cvsroot/gentoo-x86/app-antivirus/clamav/clamav-0.97.5.ebuild,v 1.2 2012/06/24 20:07:37 radhermit Exp $
|
| 4 |
|
| 5 |
EAPI=4
|
| 6 |
|
| 7 |
inherit eutils flag-o-matic user
|
| 8 |
|
| 9 |
DESCRIPTION="Clam Anti-Virus Scanner"
|
| 10 |
HOMEPAGE="http://www.clamav.net/"
|
| 11 |
SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
|
| 12 |
|
| 13 |
LICENSE="GPL-2"
|
| 14 |
SLOT="0"
|
| 15 |
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd"
|
| 16 |
IUSE="bzip2 clamdtop iconv ipv6 milter selinux static-libs"
|
| 17 |
|
| 18 |
CDEPEND="bzip2? ( app-arch/bzip2 )
|
| 19 |
clamdtop? ( sys-libs/ncurses )
|
| 20 |
iconv? ( virtual/libiconv )
|
| 21 |
milter? ( || ( mail-filter/libmilter mail-mta/sendmail ) )
|
| 22 |
dev-libs/libtommath
|
| 23 |
>=sys-libs/zlib-1.2.2
|
| 24 |
sys-devel/libtool"
|
| 25 |
DEPEND="${CDEPEND}
|
| 26 |
virtual/pkgconfig"
|
| 27 |
RDEPEND="${CDEPEND}
|
| 28 |
selinux? ( sec-policy/selinux-clamav )"
|
| 29 |
|
| 30 |
RESTRICT="test"
|
| 31 |
|
| 32 |
DOCS=( AUTHORS BUGS ChangeLog FAQ INSTALL NEWS README UPGRADE )
|
| 33 |
|
| 34 |
PATCHES=(
|
| 35 |
"${FILESDIR}"/${PN}-0.97-nls.patch
|
| 36 |
)
|
| 37 |
|
| 38 |
pkg_setup() {
|
| 39 |
enewgroup clamav
|
| 40 |
enewuser clamav -1 -1 /dev/null clamav
|
| 41 |
}
|
| 42 |
|
| 43 |
src_prepare() {
|
| 44 |
use ppc64 && append-flags -mminimal-toc
|
| 45 |
}
|
| 46 |
|
| 47 |
src_configure() {
|
| 48 |
econf \
|
| 49 |
--disable-experimental \
|
| 50 |
--enable-id-check \
|
| 51 |
--with-dbdir=/var/lib/clamav \
|
| 52 |
--with-system-tommath \
|
| 53 |
$(use_enable bzip2) \
|
| 54 |
$(use_enable clamdtop) \
|
| 55 |
$(use_enable ipv6) \
|
| 56 |
$(use_enable milter) \
|
| 57 |
$(use_enable static-libs static) \
|
| 58 |
$(use_with iconv)
|
| 59 |
}
|
| 60 |
|
| 61 |
src_install() {
|
| 62 |
default
|
| 63 |
|
| 64 |
rm -rf "${ED}"/var/lib/clamav
|
| 65 |
newinitd "${FILESDIR}"/clamd.rc clamd
|
| 66 |
newconfd "${FILESDIR}"/clamd.conf clamd
|
| 67 |
|
| 68 |
keepdir /var/lib/clamav
|
| 69 |
fowners clamav:clamav /var/lib/clamav
|
| 70 |
keepdir /var/run/clamav
|
| 71 |
fowners clamav:clamav /var/run/clamav
|
| 72 |
keepdir /var/log/clamav
|
| 73 |
fowners clamav:clamav /var/log/clamav
|
| 74 |
|
| 75 |
dodir /etc/logrotate.d
|
| 76 |
insinto /etc/logrotate.d
|
| 77 |
newins "${FILESDIR}"/clamav.logrotate clamav
|
| 78 |
|
| 79 |
# Modify /etc/{clamd,freshclam}.conf to be usable out of the box
|
| 80 |
sed -i -e "s:^\(Example\):\# \1:" \
|
| 81 |
-e "s:.*\(PidFile\) .*:\1 /var/run/clamav/clamd.pid:" \
|
| 82 |
-e "s:.*\(LocalSocket\) .*:\1 /var/run/clamav/clamd.sock:" \
|
| 83 |
-e "s:.*\(User\) .*:\1 clamav:" \
|
| 84 |
-e "s:^\#\(LogFile\) .*:\1 /var/log/clamav/clamd.log:" \
|
| 85 |
-e "s:^\#\(LogTime\).*:\1 yes:" \
|
| 86 |
-e "s:^\#\(AllowSupplementaryGroups\).*:\1 yes:" \
|
| 87 |
"${ED}"/etc/clamd.conf
|
| 88 |
sed -i -e "s:^\(Example\):\# \1:" \
|
| 89 |
-e "s:.*\(PidFile\) .*:\1 /var/run/clamav/freshclam.pid:" \
|
| 90 |
-e "s:.*\(DatabaseOwner\) .*:\1 clamav:" \
|
| 91 |
-e "s:^\#\(UpdateLogFile\) .*:\1 /var/log/clamav/freshclam.log:" \
|
| 92 |
-e "s:^\#\(NotifyClamd\).*:\1 /etc/clamd.conf:" \
|
| 93 |
-e "s:^\#\(ScriptedUpdates\).*:\1 yes:" \
|
| 94 |
-e "s:^\#\(AllowSupplementaryGroups\).*:\1 yes:" \
|
| 95 |
"${ED}"/etc/freshclam.conf
|
| 96 |
|
| 97 |
if use milter ; then
|
| 98 |
# MilterSocket one to include ' /' because there is a 2nd line for
|
| 99 |
# inet: which we want to leave
|
| 100 |
dodoc "${FILESDIR}"/clamav-milter.README.gentoo
|
| 101 |
sed -i -e "s:^\(Example\):\# \1:" \
|
| 102 |
-e "s:.*\(PidFile\) .*:\1 /var/run/clamav/clamav-milter.pid:" \
|
| 103 |
-e "s+^\#\(ClamdSocket\) .*+\1 unix:/var/run/clamav/clamd.sock+" \
|
| 104 |
-e "s:.*\(User\) .*:\1 clamav:" \
|
| 105 |
-e "s+^\#\(MilterSocket\) /.*+\1 unix:/var/run/clamav/clamav-milter.sock+" \
|
| 106 |
-e "s:^\#\(AllowSupplementaryGroups\).*:\1 yes:" \
|
| 107 |
-e "s:^\#\(LogFile\) .*:\1 /var/log/clamav/clamav-milter.log:" \
|
| 108 |
"${ED}"/etc/clamav-milter.conf
|
| 109 |
cat > "${ED}"/etc/conf.d/clamd <<-EOF
|
| 110 |
MILTER_NICELEVEL=19
|
| 111 |
START_MILTER=no
|
| 112 |
EOF
|
| 113 |
fi
|
| 114 |
|
| 115 |
prune_libtool_files
|
| 116 |
}
|
| 117 |
|
| 118 |
pkg_postinst() {
|
| 119 |
if use milter ; then
|
| 120 |
elog "For simple instructions how to setup the clamav-milter read the"
|
| 121 |
elog "clamav-milter.README.gentoo in /usr/share/doc/${PF}"
|
| 122 |
fi
|
| 123 |
}
|