Skip to content

Commit

Permalink
* openl2tp: new version
Browse files Browse the repository at this point in the history
  • Loading branch information
l29ah committed Jun 3, 2011
1 parent b35b2d5 commit fa27fae
Show file tree
Hide file tree
Showing 2 changed files with 147 additions and 0 deletions.
2 changes: 2 additions & 0 deletions net-dialup/openl2tp/Manifest
Expand Up @@ -7,4 +7,6 @@ AUX openl2tpd.conf.sample 622 RMD160 8eb39d46f62653626cc10fdb12333eeaf273c081 SH
AUX openl2tpd.confd 627 RMD160 c98ef7bdcca067cab855b43f4c28d7db5651dbee SHA1 ab72ca17e0f3b1d8839bc1a644c11f160529bc9d SHA256 9bea610cf2614bdd6c2f371987f98f8c9b854dd8332d33647505c895ae9a7314
AUX openl2tpd.initd 1320 RMD160 ef518c2f2c2438b05ada262bcb82b04ebd5d78de SHA1 7f4d5a5f891d69651129e2bcb61bd4147008f393 SHA256 a93f3c06f3639793ff015c5b518c55f3581b81dab308ca485f761dfa5b89e18e
DIST openl2tp-1.7.tar.gz 501698 RMD160 5a85297060338fc24230582fc3674638d1778634 SHA1 f79e5229b8501664e98bac8229a6d8547b43467b SHA256 f6ae19e19340144ba28c31c55f4667fb180b61ee76ccef2bf63fa62f297ca9da
DIST openl2tp-1.8.tar.gz 491160 RMD160 29913730809f7ea670c994c175551f31f2ba1e6f SHA1 314a8bb70f9f06bac840200fac0916e80d8d06b3 SHA256 1c97704d4b963a87fbc0e741668d4530933991515ae9ab0dffd11b5444f4860f
EBUILD openl2tp-1.7.ebuild 4016 RMD160 7b545663bcd18780c040b8a0a12591e597ac1c95 SHA1 72d46668b4bfd1c91a1da026492be1d1123f82fa SHA256 82aca2d1704dba515c95116365e7e6ae323106bf78c794259adcd08746a035f3
EBUILD openl2tp-1.8.ebuild 3967 RMD160 cea69ff122c3644237234c873e064d8d4b726f70 SHA1 4472b5efcdcd856eeb6b8368f439e295bd5724c7 SHA256 d76f763b923f1ac71fa838fecc98624321c2a59828c56231a826548624eb03bb
145 changes: 145 additions & 0 deletions net-dialup/openl2tp/openl2tp-1.8.ebuild
@@ -0,0 +1,145 @@
# Copyright 1999-2008 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="doc +client 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
sed -i -e 's/-Werror//' cli/Makefile usl/Makefile Makefile
# use system LDFLAGS
epatch "${FILESDIR}/${PN}-1.7-ldflags.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 doc; then
dodoc doc/*.txt "${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."
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
}

0 comments on commit fa27fae

Please sign in to comment.