summaryrefslogtreecommitdiff
blob: e1a18e3c39c7d1b75f0c353218156e4ece636e2c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-admin/denyhosts/denyhosts-1.1.2-r1.ebuild,v 1.1 2005/11/11 10:23:53 strerror Exp $

inherit distutils eutils

my_PN="DenyHosts"
my_P="${my_PN}-${PV}"
DESCRIPTION="DenyHosts is a utility to help sys admins thwart ssh hackers"
HOMEPAGE="http://denyhosts.sourceforge.net/"
SRC_URI="mirror://sourceforge/${PN}/${my_P}.tar.gz"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~alpha ~x86 ~amd64"
IUSE=""
DEPEND=">=dev-lang/python-2.3"
S="${WORKDIR}/${my_P}"

src_unpack() {
	unpack ${A}
	cd "${S}"
	# changes default file installations
	epatch "${FILESDIR}"/${PN}-gentoo.patch
	sed -i -e 's:#!/usr/bin/env python:#!/usr/bin/python:' \
		denyhosts.py || die "sed failed"
}

src_install() {
	distutils_src_install

	insinto /etc
	insopts -m0640
	newins denyhosts.cfg-dist denyhosts.conf

	newinitd "${FILESDIR}"/denyhosts.init denyhosts

	exeinto /usr/bin
	newexe denyhosts.py denyhosts

	dodoc CHANGELOG.txt README.txt

	keepdir /var/lib/denyhosts
}

pkg_postinst() {
	if [ ! -f /etc/hosts.deny ]
	then
		touch /etc/hosts.deny
	fi

	einfo "You can configure DenyHosts to run as a daemon by running:"
	einfo
	einfo "rc-update add denyhosts default"
	einfo
	einfo "or as a cronjob, by adding the following to /etc/crontab"
	einfo "# run DenyHosts every 10 minutes"
	einfo "*/10  *  * * *	root	python /usr/bin/denyhosts -c /etc/denyhosts.conf"
	einfo
	einfo "More information can be found at http://denyhosts.sourceforge.net/faq.html"
	einfo
	ewarn "Modify /etc/denyhosts.conf to suit your environment system."
}