1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
7 inherit eutils linux-info
9 DESCRIPTION="GNU Virtual Private Ethernet"
10 HOMEPAGE="http://savannah.gnu.org/projects/gvpe"
11 SRC_URI="mirror://gnu/${PN}/${P}.tar.gz"
15 KEYWORDS="~amd64 ~x86"
16 IUSE="nls tcp +compression dns icmp http-proxy
17 cipher-aes-128 cipher-aes-192 +cipher-aes-256 cipher-blowfish
18 digset-sha512 digset-sha256 digset-sha1 +digset-ripemd160 digset-md5 digset-md4-insecure"
20 DEPEND="dev-libs/libev
21 >=dev-libs/openssl-0.9.7c
22 nls? ( sys-devel/gettext )
23 virtual/linux-sources"
24 RDEPEND=">=dev-libs/openssl-0.9.7c"
27 #Since gvpe does not support more than 1 cipher and more then 1 digset
28 #here we do some not so clever checks to ensure that only one is selected
31 use cipher-aes-256 && myEnc="aes-256" && encCnt=$((encCnt+1))
32 use cipher-aes-192 && myEnc="aes-192" && encCnt=$((encCnt+1))
33 use cipher-aes-128 && myEnc="aes-128" && encCnt=$((encCnt+1))
34 use cipher-blowfish && myEnc="bf" && encCnt=$((encCnt+1))
36 if [[ $encCnt<1 ]]; then
37 eerror "An encryption alogotithm have to be selected.\nAdd one of cipher-aes-256, cipher-aes-192, cipher-aes-128 or cipher-blowfish to your USE variable."
39 elif [[ $encCnt>1 ]]; then
40 eerror "More then one ecryption alogorithm selected.\nRemove all but one of cipher-aes-256, cipher-aes-192, cipher-aes-128 or cipher-blowfish flags from your USE variable."
46 use digset-sha512 && myDigset="sha512" && encCnt=$((encCnt+1))
47 use digset-sha256 && myDigset="sha256" && encCnt=$((encCnt+1))
48 use digset-sha1 && myDigset="sha1" && encCnt=$((encCnt+1))
49 use digset-ripemd160 && myDigset="ripemd160" && encCnt=$((encCnt+1))
50 use digset-md5 && myDigset="md5" && encCnt=$((encCnt+1))
51 use digset-md4-insecure && myDigset="md4" && encCnt=$((encCnt+1))
52 if [[ $encCnt<1 ]]; then
53 eerror "A digset algorithm have to be selected.\nAdd one of digset-sha512, digset-sha256, digset-sha1, digset-ripemd160, digset-md5 or digset-md4-insecure to your USE variable."
55 elif [[ $encCnt>1 ]]; then
56 eerror "More then one digset alogorithm selected.\nRemove all but one of digset-sha512, digset-sha256, digset-sha1, digset-ripemd160, digset-md5 or digset-md4-insecure flags from your USE variable."
60 #add proper support for --disable in the configure scrip
61 epatch "${FILESDIR}/configure.${P}.patch"
63 #the hmac and rand flags are hardcoded this is not so good because
64 #it leaves the system more predictable. But I don't think that adding
65 #24 more use flags is a good idea too.
66 econf $(use_enable nls) \
67 $(use_enable compression) \
70 $(use_enable http-proxy) \
72 --enable-hmac-length=16 --enable-rand-length=8 --enable-cipher=$myEnc \
73 --enable-digest=$myDigset
78 emake DESTDIR="${D}" install || die
79 dodoc AUTHORS NEWS README TODO || die
80 newinitd "${FILESDIR}/gvpe.rc" gvpe || die
81 newconfd "${FILESDIR}/gvpe.confd" gvpe || die
83 doins "${FILESDIR}/gvpe.conf.example" || die
85 doexe "${FILESDIR}/if-up" || die
89 linux_chkconfig_present TUN || ewarn "This package requires the tun/tap kernel device."
90 einfo "Edit /etc/conf.d/gvpe and /etc/gvpe/gvpe.conf"
91 ewarn "All nodes in your VPN have to use the same combination of digset and cipher!"