blob: f15ff403fa8c6c788aded1ba88e22238080eb6e7 (
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI=3
inherit eutils linux-info
DESCRIPTION="Userspace tools for kernel L2TP implementation."
HOMEPAGE="http://openl2tp.sourceforge.net"
SRC_URI="mirror://sourceforge/openl2tp/${P}.tar.gz"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="+client doc examples pppd rpc server -stats"
CDEPEND="net-dialup/ppp
sys-libs/readline
"
DEPEND="${CDEPEND}
sys-devel/bison
sys-devel/flex
"
RDEPEND="${CDEPEND}
rpc? ( || (
net-nds/rpcbind
net-nds/portmap
) )"
CONFIG_CHECK="~PPPOL2TP"
pkg_setup() {
# check for sane USE flags
if ! use server && ! use client; then
eerror
eerror "You have disabled both server and client parts!"
eerror "At least one of them must be enabled. ;)"
eerror
die "bad USE flags"
fi
# kernel requirements
linux-info_pkg_setup
if kernel_is -lt 2 6 23; then
eerror
eerror "Your kernel is too old. At least 2.6.23 is required to work with this program."
eerror
die "kernel is too old"
fi
}
src_prepare() {
# disable -Werror, as warnings may occur on different CFLAGS
epatch "${FILESDIR}/${P}-werror.patch"
# use system LDFLAGS
epatch "${FILESDIR}/${P}-ldflags.patch"
# let ebuild to control pppd plugins support
epatch "${FILESDIR}/${P}-pppd.patch"
# do not gzip man pages, let portage to compress them
epatch "${FILESDIR}/${PN}-1.7-man.patch"
# install l2tpconfig to /usr/sbin with 0700 permissions
# to make it at least a bit more secure
epatch "${FILESDIR}/${PN}-1.7-l2tpconfig.patch"
}
src_configure() {
myconf="" # not local, should be used at src_compile()
use client || myconf+="L2TP_FEATURE_LAC_SUPPORT=n \
L2TP_FEATURE_LAIC_SUPPORT=n \
L2TP_FEATURE_LAOC_SUPPORT=n "
use server || myconf+="L2TP_FEATURE_LNS_SUPPORT=n \
L2TP_FEATURE_LNIC_SUPPORT=n \
L2TP_FEATURE_LNOC_SUPPORT=n "
use rpc || myconf+="L2TP_FEATURE_RPC_MANAGEMENT=n "
use stats && myconf+="L2TP_FEATURE_LOCAL_STAT_FILE=y "
# pppd plugin is only needed for pppd < 2.4.5
unset PPPD_SUBDIR
if use pppd; then
export PPPD_VERSION=$( gawk '{
if ($2=="VERSION") {
gsub("\"","",$3);
print $3
}
}' /usr/include/pppd/patchlevel.h ) || die "gawk failed"
einfo "Building for pppd version $PPPD_VERSION"
# convert version to comparable format
local ver=$( echo $PPPD_VERSION | gawk -F "." '{
print lshift($1,16) + lshift($2,8) + $3
}' )
if [[ $ver -lt $(( (2<<16) + (4<<8) + 5)) ]]; then
export PPPD_SUBDIR="pppd"
else
ewarn
ewarn "openl2tp plugins are already integrated in >=net-dialup/ppp-2.4.5"
fi
fi
}
src_compile() {
# upstream use OPT_CFLAGS for optimizations
export OPT_CFLAGS=${CFLAGS}
emake ${myconf} || die "emake failed"
}
src_install() {
emake ${myconf} DESTDIR="${D}" install || die "emake install failed"
dodoc CHANGES INSTALL README
if use examples; then
dodoc doc/*.c
fi
if use doc; then
dodoc doc/*.txt doc/README.event_sock "${FILESDIR}"/openl2tpd.conf.sample
newdoc plugins/README README.plugins
use pppd && newdoc pppd/README README.pppd
docinto ipsec
dodoc ipsec/*
fi
newinitd "${FILESDIR}"/openl2tpd.initd openl2tpd
# init.d script is quite different for RPC and non-RPC versions.
use rpc || sed -i s/userpc=\"yes\"/userpc=\"no\"/ "${D}/etc/init.d/openl2tpd" || die "sed failed"
newconfd "${FILESDIR}"/openl2tpd.confd openl2tpd
}
pkg_postinst() {
if use rpc; then
ewarn
ewarn "RPC control does not provide any auth checks for control connection."
ewarn "By default localhost only is allowed and l2tpconfig is installed"
ewarn "accessible only by root, but local users may install or compile binary"
ewarn "on they own if not prohibited by system administrator."
ewarn
ewarn "Therefore DO NOT USE RPC IN INSECURE ENVIRONMENTS!"
else
ewarn
ewarn "Without RPC support you won't be able to use l2tpconfig."
ewarn "If you are using numerical strings (e.g. login name containing only"
ewarn "digits) or special characters in password, please use double quotes"
ewarn "to enclose them."
fi
if use stats; then
ewarn
ewarn "To enable status files openl2tpd must be started with -S option."
ewarn "Upstream warns about runtime overhead with status files enabled."
fi
}
|