# Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ EAPI="4" inherit eutils DESCRIPTION="Web content filtering via proxy" HOMEPAGE="http://dansguardian.org" SRC_URI="mirror://sourceforge/${PN}/${P}.tar.bz2" LICENSE="GPL-2" SLOT="0" KEYWORDS="~amd64 ~ppc ~ppc64 ~sparc ~x86" IUSE="avast backtrace clamav commandline debug email +fancydm icap kaspersky +lfs logrotate ntlm orig-ip +pcre static-libs trickledm" RDEPEND="sys-libs/zlib clamav? ( app-antivirus/clamav ) logrotate? ( app-admin/logrotate ) ntlm? ( virtual/libiconv ) pcre? ( dev-libs/libpcre )" DEPEND="${RDEPEND} virtual/pkgconfig" pkg_setup() { enewgroup dansguardian enewuser dansguardian -1 -1 /dev/null dansguardian } src_configure() { econf \ $(use_enable avast avastd) \ $(use_enable backtrace segv-backtrace) \ $(use_enable clamav clamd) \ $(use_enable commandline) \ $(use_with debug dgdebug) \ $(use_enable email) \ $(use_enable fancydm) \ $(use_enable icap) \ $(use_enable kaspersky kavd) \ $(use_enable lfs) \ --with-logdir=/var/log/dansguardian \ $(use_enable ntlm) \ $(use_enable orig-ip) \ $(use_enable pcre) \ --with-piddir=/var/run \ --with-proxygroup=dansguardian \ --with-proxyuser=dansguardian \ $(use_enable static-libs static-zlib) \ $(use_enable trickledm) } src_install() { # Default install command default # Edit config files for virus scanners chosen based on USE flags. if use avast; then sed -r -i -e 's/^#( *contentscanner *=.*avastdscan[.]conf.*)/\1/' "${D}/etc/dansguardian/dansguardian.conf" fi if use clamav; then sed -r -i -e 's/[ \t]+use dns/& clamd/' "${D}/etc/init.d/dansguardian" sed -r -i -e 's/^#( *contentscanner *=.*clamdscan[.]conf.*)/\1/' "${D}/etc/dansguardian/dansguardian.conf" fi if use commandline; then sed -r -i -e 's/^#( *contentscanner *=.*commandlinescan[.]conf.*)/\1/' "${D}/etc/dansguardian/dansguardian.conf" fi if use icap; then sed -r -i -e 's/^#( *contentscanner *=.*icapscan[.]conf.*)/\1/' "${D}/etc/dansguardian/dansguardian.conf" fi if use kaspersky; then sed -r -i -e 's/^#( *contentscanner *=.*kavdscan[.]conf.*)/\1/' "${D}/etc/dansguardian/dansguardian.conf" fi # Install Gentoo init script newinitd "${FILESDIR}/dansguardian.init" dansguardian # Install log rotation file. if use logrotate; then insinto /etc/logrotate.d newins "${FILESDIR}/dansguardian.logrotate" dansguardian else exeinto /etc/cron.weekly newexe data/scripts/logrotation dansguardian.cron fi keepdir /var/log/dansguardian fperms o-rwx /var/log/dansguardian } pkg_postinst() { local runas="dansguardian:dansguardian" if [ -d "${ROOT}/var/log/dansguardian" ] ; then chown -R ${runas} "${ROOT}/var/log/dansguardian" chmod o-rwx "${ROOT}/var/log/dansguardian" fi einfo "For assistance configuring DansGuardian, visit the wiki at http://contentfilter.futuragts.com/wiki/doku.php" }