]> Pileus Git - ~andy/sunrise/blob - app-admin/blockhosts/blockhosts-2.5.1.ebuild
app-admin/blockhosts: Corrected for multiple PyABI installation, Version Bump
[~andy/sunrise] / app-admin / blockhosts / blockhosts-2.5.1.ebuild
1 # Copyright 1999-2011 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: $
4
5 EAPI="3"
6
7 PYTHON_DEPEND="2"
8 SUPPORT_PYTHON_ABIS="1"
9 RESTRICT_PYTHON_ABIS="3.*"
10
11 inherit python distutils
12
13 MY_P="BlockHosts-${PV}"
14 DESCRIPTION="Blocks abusive IP hosts which probe your services (such as sshd, proftpd)"
15 HOMEPAGE="http://www.aczoom.com/blockhosts/"
16 SRC_URI="http://www.aczoom.com/tools/${PN}/${MY_P}.tar.gz"
17
18 LICENSE="public-domain"
19 SLOT="0"
20 KEYWORDS="~amd64 ~x86"
21 IUSE="logrotate logwatch test"
22
23 DEPEND="dev-python/pyxml"
24 RDEPEND="${DEPEND}
25         logrotate? ( app-admin/logrotate )"
26
27 S="${WORKDIR}"/${MY_P}
28
29 pkg_setup() {
30         python_pkg_setup
31 }
32
33 src_prepare() {
34         python_convert_shebangs -r 2 .
35
36         # don't let setup.py install bhrss.py to /usr/bin
37         sed -i -e "s/,.*bhrss\.py'//" setup.py || die
38
39         # remove logrotate check if not in IUSE
40         if ! use logrotate; then
41                 sed -i -e "/^if/d ; /DATA_FILES\./d" setup.py || die
42         fi
43
44         distutils_src_prepare
45 }
46
47 src_test() {
48         testing() {
49                 $(PYTHON) test_blockhosts.py || die
50         }
51         python_execute_function testing
52 }
53
54 src_install() {
55         distutils_src_install
56
57         exeinto /usr/share/${PN}
58         doexe bhrss.py || die
59
60         # not tested, but should work
61         if use logwatch; then
62                 insinto /etc/log.d/conf/services/
63                 doins logwatch/blockhosts.conf || die
64
65                 exeinto /etc/log.d/scripts/services/
66                 doexe logwatch/blockhosts || die
67         fi
68
69         dohtml *.html || die
70 }
71
72 pkg_postinst() {
73         echo
74         elog "This package isn't configured properly."
75         elog "Please refer to the homepage to do this!"
76         echo
77         elog "See also: http://www.gentoo-wiki.info/BlockHosts"
78         echo
79         elog "bhrss.py cgi-script is in /usr/share/${PN}."
80         elog "If you want to use it, put it in your cgi-bin,"
81         echo
82 }