1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
7 inherit eutils multilib toolchain-funcs linux-info pam
9 DESCRIPTION="Point-to-Point Protocol (PPP)"
10 HOMEPAGE="http://www.samba.org/ppp"
11 SRC_URI="ftp://ftp.samba.org/pub/ppp/${P}.tar.gz
12 mirror://gentoo/${P}-gentoo-20091116.tar.gz
13 dhcp? ( http://www.netservers.co.uk/gpl/ppp-dhcpc.tgz )"
17 KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 s390 sh sparc x86"
18 IUSE="activefilter atm dhcp eap-tls gtk ipv6 mppe-mppc pam radius"
20 DEPEND="activefilter? ( >=net-libs/libpcap-0.9.4 )
21 atm? ( net-dialup/linux-atm )
23 gtk? ( >=x11-libs/gtk+-2.8:2 )
24 eap-tls? ( net-misc/curl >=dev-libs/openssl-0.9.7 )"
28 if use mppe-mppc; then
30 ewarn "The mppe-mppc flag overwrites the pppd native MPPE support with MPPE-MPPC"
31 ewarn "patch developed by Jan Dubiec."
32 ewarn "The resulted pppd will work only with patched kernels with version <= 2.6.14."
33 ewarn "You could obtain the kernel patch from MPPE-MPPC homepage:"
34 ewarn " http://mppe-mppc.alphacron.de/"
35 ewarn "CAUTION: MPPC is a U.S. patented algorithm!"
36 ewarn "Ask yourself if you really need it and, if you do, consult your lawyer first."
42 epatch "${WORKDIR}/patch/make-vars.patch"
43 epatch "${WORKDIR}/patch/mpls.patch"
44 epatch "${WORKDIR}/patch/killaddr-smarter.patch"
45 epatch "${WORKDIR}/patch/wait-children.patch"
46 epatch "${WORKDIR}/patch/maxoctets-2Glimit.patch"
47 epatch "${WORKDIR}/patch/defaultgateway.patch"
48 epatch "${WORKDIR}/patch/mschapv2-initialize-response.patch"
49 epatch "${WORKDIR}/patch/linkpidfile.patch"
50 epatch "${WORKDIR}/patch/qa-fixes.patch"
51 epatch "${WORKDIR}/patch/kill-pg.patch"
52 epatch "${WORKDIR}/patch/auth-fail.patch"
53 epatch "${WORKDIR}/patch/defaultmetric.patch"
54 epatch "${WORKDIR}/patch/dev-ppp.patch"
55 epatch "${WORKDIR}/patch/gtk2.patch"
56 epatch "${WORKDIR}/patch/pppoe-lcp-timeout.patch"
57 epatch "${WORKDIR}/patch/passwordfd-read-early.patch"
58 epatch "${WORKDIR}/patch/pppd-usepeerwins.patch"
59 epatch "${WORKDIR}/patch/connect-errors.patch"
60 epatch "${WORKDIR}/patch/ppp-pppoe-mac.patch"
63 # see http://eaptls.spe.net/index.html for more info
64 einfo "Enabling EAP-TLS support"
65 epatch "${WORKDIR}/patch/eaptls-0.7-gentoo.patch"
66 use mppe-mppc || epatch "${WORKDIR}/patch/eaptls-mppe-0.7.patch"
70 einfo "Enabling MPPE-MPPC support"
71 epatch "${WORKDIR}/patch/mppe-mppc-1.1.patch"
72 use eap-tls && epatch "${WORKDIR}/patch/eaptls-mppe-0.7-with-mppc.patch"
76 einfo "Enabling PPPoATM support"
77 sed -i "s/^#HAVE_LIBATM=yes/HAVE_LIBATM=yes/" pppd/plugins/pppoatm/Makefile.linux
81 einfo "Disabling active filter"
82 sed -i "s/^FILTER=y/#FILTER=y/" pppd/Makefile.linux
87 sed -i "s/^#USE_PAM=y/USE_PAM=y/" pppd/Makefile.linux
92 sed -i "s/#HAVE_INET6/HAVE_INET6/" pppd/Makefile.linux
96 sed -i "s/^#CBCP=y/CBCP=y/" pppd/Makefile.linux
99 # copy the ppp-dhcp plugin files
100 einfo "Copying ppp-dhcp plugin files..."
101 tar -xzf "${DISTDIR}/ppp-dhcpc.tgz" -C pppd/plugins/ \
102 && sed -i -e 's/SUBDIRS := rp-pppoe/SUBDIRS := rp-pppoe dhcp/' pppd/plugins/Makefile.linux \
103 || die "ppp-dhcp plugin addition failed"
104 epatch "${WORKDIR}/patch/dhcp-make-vars.patch"
105 epatch "${WORKDIR}/patch/dhcp-sys_error_to_strerror.patch"
109 sed -i -e "s:/lib/pppd:/$(get_libdir)/pppd:" \
110 pppd/{pathnames.h,pppd.8}
113 #set the right paths in radiusclient.conf
114 sed -i -e "s:/usr/local/etc:/etc:" \
115 -e "s:/usr/local/sbin:/usr/sbin:" pppd/plugins/radius/etc/radiusclient.conf
116 #set config dir to /etc/ppp/radius
117 sed -i -e "s:/etc/radiusclient:/etc/ppp/radius:g" \
118 pppd/plugins/radius/{*.8,*.c,*.h} \
119 pppd/plugins/radius/etc/*
121 einfo "Disabling radius"
122 sed -i -e '/+= radius/s:^:#:' pppd/plugins/Makefile.linux
127 export CC="$(tc-getCC)"
128 export AR="$(tc-getAR)"
129 econf || die "econf failed"
133 emake COPTS="${CFLAGS} -D_GNU_SOURCE" || die "compile failed"
136 cd contrib/pppgetpass
138 emake -f Makefile.linux || die "failed to build pppgetpass"
140 emake pppgetpass.vt || die "failed to build pppgetpass"
146 for i in chat pppd pppdump pppstats ; do
148 dosbin ${i}/${i} || die
150 fperms u+s-w /usr/sbin/pppd
152 # Install pppd header files
153 pushd pppd >/dev/null
154 emake INSTROOT="${D}" install-devel || die
157 dosbin pppd/plugins/rp-pppoe/pppoe-discovery || die
162 newins etc.ppp/pap-secrets pap-secrets.example
163 newins etc.ppp/chap-secrets chap-secrets.example
166 doins etc.ppp/options
169 for i in ip-up ip-down ; do
170 doexe "${WORKDIR}/scripts/${i}" || die "failed to install ${i} script"
171 insinto /etc/ppp/${i}.d
172 use ipv6 && dosym ${i} /etc/ppp/${i/ip/ipv6}
173 doins "${WORKDIR}/scripts/${i}.d"/* || die "failed to install ${i}.d scripts"
176 pamd_mimic_system ppp auth account session
178 local PLUGINS_DIR=/usr/$(get_libdir)/pppd/$(awk -F '"' '/VERSION/ {print $2}' pppd/patchlevel.h)
179 #closing " for syntax coloring
180 insinto "${PLUGINS_DIR}"
182 doins pppd/plugins/minconn.so || die "minconn.so not build"
183 doins pppd/plugins/passprompt.so || die "passprompt.so not build"
184 doins pppd/plugins/passwordfd.so || die "passwordfd.so not build"
185 doins pppd/plugins/winbind.so || die "winbind.so not build"
186 doins pppd/plugins/rp-pppoe/rp-pppoe.so || die "rp-pppoe.so not build"
188 doins pppd/plugins/pppoatm/pppoatm.so || die "pppoatm.so not build"
191 doins pppd/plugins/dhcp/dhcpc.so || die "dhcpc.so not build"
194 doins pppd/plugins/radius/radius.so || die "radius.so not build"
195 doins pppd/plugins/radius/radattr.so || die "radattr.so not build"
196 doins pppd/plugins/radius/radrealms.so || die "radrealms.so not build"
198 #Copy radiusclient configuration files (#92878)
199 insinto /etc/ppp/radius
201 doins pppd/plugins/radius/etc/{dictionary*,issue,port-id-map,radiusclient.conf,realms,servers}
203 doman pppd/plugins/radius/pppd-radius.8
204 doman pppd/plugins/radius/pppd-radattr.8
207 insinto /etc/modprobe.d
209 newins "${FILESDIR}/modules.ppp" ppp.conf
210 if use mppe-mppc; then
211 sed -i -e 's/ppp_mppe/ppp_mppe_mppc/' "${D}/etc/modprobe.d/ppp.conf"
214 dodoc PLUGINS README* SETUP Changes-2.3 FAQ
215 dodoc "${FILESDIR}/README.mpls"
217 dosbin scripts/pon && \
218 dosbin scripts/poff && \
219 dosbin scripts/plog && \
220 doman scripts/pon.1 || die "failed to install pon&poff scripts"
222 # Adding misc. specialized scripts to doc dir
223 insinto /usr/share/doc/${PF}/scripts/chatchat
224 doins scripts/chatchat/* || die "failed to install chat scripts in doc dir"
225 insinto /usr/share/doc/${PF}/scripts
226 doins scripts/* || die "failed to install scripts in doc dir"
229 dosbin contrib/pppgetpass/{pppgetpass.vt,pppgetpass.gtk}
230 newsbin contrib/pppgetpass/pppgetpass.sh pppgetpass
232 newsbin contrib/pppgetpass/pppgetpass.vt pppgetpass
234 doman contrib/pppgetpass/pppgetpass.8
238 if linux-info_get_any_version && linux_config_src_exists; then
240 ewarn "If the following test report contains a missing kernel configuration option that you need,"
241 ewarn "you should reconfigure and rebuild your kernel before running pppd."
242 CONFIG_CHECK="~PPP ~PPP_ASYNC ~PPP_SYNC_TTY"
243 local ERROR_PPP="CONFIG_PPP:\t missing PPP support (REQUIRED)"
244 local ERROR_PPP_ASYNC="CONFIG_PPP_ASYNC:\t missing asynchronous serial line discipline (optional, but highly recommended)"
245 local WARNING_PPP_SYNC_TTY="CONFIG_PPP_SYNC_TTY:\t missing synchronous serial line discipline (optional; used by 'sync' pppd option)"
246 if use activefilter ; then
247 CONFIG_CHECK="${CONFIG_CHECK} ~PPP_FILTER"
248 local ERROR_PPP_FILTER="CONFIG_PPP_FILTER:\t missing PPP filtering support (REQUIRED)"
250 CONFIG_CHECK="${CONFIG_CHECK} ~PPP_DEFLATE ~PPP_BSDCOMP"
251 local ERROR_PPP_DEFLATE="CONFIG_PPP_DEFLATE:\t missing Deflate compression (optional, but highly recommended)"
252 local ERROR_PPP_BSDCOMP="CONFIG_PPP_BSDCOMP:\t missing BSD-Compress compression (optional, but highly recommended)"
253 if use mppe-mppc ; then
254 CONFIG_CHECK="${CONFIG_CHECK} ~PPP_MPPE_MPPC"
255 local WARNING_PPP_MPPE_MPPC="CONFIG_PPP_MPPE_MPPC:\t missing MPPE/MPPC encryption/compression (optional, mostly used by PPTP links)"
257 CONFIG_CHECK="${CONFIG_CHECK} ~PPP_MPPE"
258 local WARNING_PPP_MPPE="CONFIG_PPP_MPPE:\t missing MPPE encryption (optional, mostly used by PPTP links)"
260 CONFIG_CHECK="${CONFIG_CHECK} ~PPPOE ~PACKET"
261 local WARNING_PPPOE="CONFIG_PPPOE:\t missing PPPoE support (optional, needed by rp-pppoe plugin)"
262 local WARNING_PACKET="CONFIG_PACKET:\t missing AF_PACKET support (optional, used by rp-pppoe and dhcpc plugins)"
264 CONFIG_CHECK="${CONFIG_CHECK} ~PPPOATM"
265 local WARNING_PPPOATM="CONFIG_PPPOATM:\t missing PPPoA support (optional, needed by pppoatm plugin)"
270 if [ ! -e "${ROOT}/dev/.devfsd" ] && [ ! -e "${ROOT}/dev/.udev" ] && [ ! -e "${ROOT}/dev/ppp" ]; then
271 mknod "${ROOT}/dev/ppp" c 108 0
273 if [ "$ROOT" = "/" ]; then
274 if [ -x /sbin/update-modules ]; then
281 # create *-secrets files if not exists
282 [ -f "${ROOT}/etc/ppp/pap-secrets" ] || \
283 cp -pP "${ROOT}/etc/ppp/pap-secrets.example" "${ROOT}/etc/ppp/pap-secrets"
284 [ -f "${ROOT}/etc/ppp/chap-secrets" ] || \
285 cp -pP "${ROOT}/etc/ppp/chap-secrets.example" "${ROOT}/etc/ppp/chap-secrets"
287 # lib name has changed
288 sed -i -e "s:^pppoe.so:rp-pppoe.so:" "${ROOT}/etc/ppp/options"
290 if use radius && [[ $previous_less_than_2_4_3_r5 = 0 ]] ; then
292 ewarn "As of ${PN}-2.4.3-r5, the RADIUS configuration files have moved from"
293 ewarn " /etc/radiusclient to /etc/ppp/radius."
294 einfo "For your convenience, radiusclient directory was copied to the new location."
298 elog "Pon, poff and plog scripts have been supplied for experienced users."
299 elog "Users needing particular scripts (ssh,rsh,etc.) should check out the"
300 elog "/usr/share/doc/${PF}/scripts directory."
302 # move the old user-defined files into ip-{up,down}.d directories
303 # TO BE REMOVED AFTER SEPT 2008
305 for i in ip-up ip-down; do
306 if [ -f "${ROOT}"/etc/ppp/${i}.local ]; then
307 mv /etc/ppp/${i}.local /etc/ppp/${i}.d/90-local.sh && \
308 ewarn "/etc/ppp/${i}.local has been moved to /etc/ppp/${i}.d/90-local.sh"