blob: 4f0ff26eb145f966016e29dadf57b279e2d044a4 (
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
84
85
|
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI="1"
inherit eutils
DESCRIPTION="A validating, recursive and caching DNS resolver"
HOMEPAGE="http://unbound.net"
SRC_URI="http://unbound.net/downloads/${P}.tar.gz"
LICENSE="BSD"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="+chroot debug libevent python static threads"
RDEPEND="dev-libs/openssl
>=net-libs/ldns-1.5.1
libevent? ( dev-libs/libevent )"
DEPEND="${RDEPEND}
python? ( dev-lang/swig )"
pkg_setup() {
enewgroup unbound
enewuser unbound -1 -1 -1 unbound
}
src_compile() {
econf \
--with-conf-file=/etc/unbound/unbound.conf \
--with-pidfile=/var/run/unbound.pid \
--with-run-dir=/etc/unbound \
--with-username=unbound \
$(use_enable debug) \
$(use_enable debug lock-checks) \
$(use_enable debug alloc-checks) \
$(use_enable static static-exe) \
$(use_with libevent) \
$(use_with threads pthreads) \
$(use_with python pyunbound) \
$(use_with python pythonmodule)
emake || die "emake failed"
}
src_install() {
emake DESTDIR="${D}" install || die "emake install failed"
newinitd "${FILESDIR}/unbound.initd" unbound || die "newinitd failed"
newconfd "${FILESDIR}/unbound.confd" unbound || die "newconfd failed"
dodoc doc/{README,CREDITS,TODO,Changelog,FEATURES} || die "dodoc failed"
insinto /usr/share/${PN}
insopts -m755
doins contrib/{update-anchor.sh,update-itar.sh} || die "doins failed"
# enable remote control for our rc script
sed -i 's:^\t# control-enable\: no:\tcontrol-enable\: yes:g' "${D}/etc/unbound/unbound.conf" || die "sed failed"
# disable chroot when requested
if ! use chroot; then
sed -i 's:^\t# chroot\: "/etc/unbound":\tchroot\: "":g' "${D}/etc/unbound/unbound.conf" || die "sed failed"
fi
}
pkg_postinst() {
local key_dir="${ROOT}etc/unbound"
# unbound-control-setup tests for *.key existance, so copy that behaviour
if ! test -f ${key_dir}/unbound_server.key && ! test -f ${key_dir}/unbound_control.key; then
ewarn "Since unbound-1.3.0, we use a new initd script based on unbound-contol."
ewarn "The initd script needs SSL keys. To generate these, please run the"
ewarn "following command before (re)starting Unbound:"
ewarn "emerge --config =${PF}"
fi
}
pkg_config() {
local key_dir="${ROOT}etc/unbound"
ebegin "Generating SSL keys for unbound-control"
/usr/sbin/unbound-control-setup -d ${key_dir}
eend $?
}
|