summaryrefslogtreecommitdiff
blob: 62698770183a18fbd98c7fbb1cd042cd30207e53 (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
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-p2p/entropy_rsa/entropy_rsa-0.9.1.439.ebuild,v 1.3 2006/11/23 17:29:58 vivo Exp $

inherit eutils

MY_PV_BUILD=${PV##*.}
MY_PV=${PV%.*}
DESCRIPTION="A p2p-node to share your files, infos, philosophy ... anonymously"
HOMEPAGE="http://entropy.stop1984.com/"
SRC_URI="http://entropy.stop1984.com/files/entropy_rsa-${MY_PV}-${MY_PV_BUILD}.tgz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~ppc ~x86"
IUSE="mysql"

DEPEND="mysql? ( virtual/mysql )"
RDEPEND="${DEPEND}
	app-admin/sudo"

S=${WORKDIR}/${PN}-${MY_PV}

pkg_setup() {
	enewgroup entropy
	enewuser entropy -1 -1 /var/entropy entropy
}

src_compile() {
	[[ $(gcc-major-version) == "4" ]] && die "Sorry, entropy must be compiled with gcc-3.x"

	local myconf=""
	use mysql \
		&& myconf="--with-mysql=/usr" \
		|| myconf="--with-tree"
	econf ${myconf} || die
	emake || die
}

src_install() {
	dobin entropy_rsa monoopt storechg || die
	dodoc README TODO CODINGRULES entropy_rsa.conf-dist seed.txt-dist
	dohtml ENTROPY.html
	use mysql && dodoc README.MySQL

	newinitd "${FILESDIR}"/entropy_rsa.rc entropy_rsa
	local STORE_TYPE="tree"
	use mysql && STORE_TYPE="mysql"
	echo "ENTROPY_USER=entropy" > entropy_rsa.conf.d
	echo "STORE_TYPE=${STORE_TYPE}" >> entropy_rsa.conf.d
	newconfd entropy_rsa.conf.d entropy_rsa

	diropts -o entropy -g entropy
	insopts -o entropy -g entropy -m0644
	dodir /var/entropy/{de,chat,node,store,tmp}
	insinto /var/entropy
	doins -r de node chat || die

	# setup config file
	sed -e "3,$ s:#::g" seed.txt-dist > seed.txt
	sed \
		-e "s:seednodes=seed.txt:seednodes=/var/entropy/seed.txt:g" \
		-e "s:logfile=./entropy_rsa.log:logfile=/var/entropy/entropy_rsa.log:g" \
		-e "s:storepath=store:storepath=/var/entropy/store:g" \
		-e "s:temppath=tmp:temppath=/var/entropy/tmp:g" \
		-e "s:runpath=:runpath=/var/entropy/:g" \
		entropy_rsa.conf-dist > entropy_rsa.conf
	use mysql && cat "${FILESDIR}"/mysql.conf >> entropy_rsa.conf
	insinto /etc
	doins entropy_rsa.conf
	dosym /etc/entropy_rsa.conf /var/entropy/entropy_rsa.conf

	insinto /var/entropy
	doins ${CONFIG} seed.txt
}