summaryrefslogtreecommitdiff
blob: 57f8721234c9b826a5545c3fe2be28b1d73d2382 (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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-p2p/bitflu/bitflu-1.37.ebuild,v 1.4 2011/09/04 10:13:26 maekke Exp $

EAPI=3

inherit eutils

DESCRIPTION="Bitflu is a BitTorrent client, written in Perl and is designed to run as a daemon"
HOMEPAGE="http://bitflu.workaround.ch"
SRC_URI="http://bitflu.workaround.ch/bitflu/${P}.tgz"

LICENSE="Artistic-2"
SLOT="0"
KEYWORDS="amd64 x86"
IUSE=""

DEPEND="dev-perl/Danga-Socket
	dev-perl/Sys-Syscall"
RDEPEND="${DEPEND}"

pkg_setup() {
	enewgroup bitflu
	enewuser bitflu -1 -1 /var/lib/bitflu bitflu
}

src_prepare() {
	epatch "${FILESDIR}/${PN}-add-pidfile.patch"
}

src_compile() {
:
}

PLUGINS="/usr/lib/bitflu"
HOMEDIR="/var/lib/bitflu"
CONFDIR="/etc/bitflu"
LOGDIR="/var/log/bitflu"

src_install() {
	# executable daemon
	exeinto /usr/sbin
	doexe bitflu.pl

	# plugins
	dodir "${PLUGINS}"
	insinto "${PLUGINS}"
	doins -r plugins

	# working dir
	dodir "${HOMEDIR}"
	fowners bitflu:bitflu "${HOMEDIR}"
	fperms 775 "${HOMEDIR}"

	# config file
	dodir "${CONFDIR}"
	fowners bitflu:bitflu "${CONFDIR}"
	fperms 775 "${CONFDIR}"
	insinto "${CONFDIR}"
	doins "${FILESDIR}"/bitflu.config
	fowners bitflu:bitflu "${CONFDIR}"/bitflu.config
	fperms 664 "${CONFDIR}"/bitflu.config

	# log file
	dodir "${LOGDIR}"
	fowners bitflu:bitflu "${LOGDIR}"
	fperms 775 "${LOGDIR}"

	# docs
	dodoc bitflu.config.example ChangeLog.txt CONTRIBUTING README_IPv6.txt \
		README.txt Documentation/bitflu-internals.txt

	newinitd "${FILESDIR}"/bitflu.initd bitflu
}

pkg_postinst() {
	ewarn "Note: At startup, or at the user's request, ${PN} (re)reads its"
	ewarn "configuration file and overwrites it with its own sanitized"
	ewarn "version.  A backup is created in the configuration directory,"
	ewarn "/etc/${PN}, but that file will subseqently be overwritten if"
	ewarn "a further backup is made.  You may want to keep your own backup."
	ewarn "A prestine example with comments may be found in /usr/share/doc/${P}."
}