ppp-2.4.7-r4.ebuild 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. inherit eutils linux-info multilib pam toolchain-funcs
  5. PATCH_VER="5"
  6. DESCRIPTION="Point-to-Point Protocol (PPP)"
  7. HOMEPAGE="http://www.samba.org/ppp"
  8. SRC_URI="ftp://ftp.samba.org/pub/ppp/${P}.tar.gz
  9. https://dev.gentoo.org/~polynomial-c/${P}-patches-${PATCH_VER}.tar.xz
  10. http://www.netservers.net.uk/gpl/ppp-dhcpc.tgz"
  11. LICENSE="BSD GPL-2"
  12. SLOT="0/${PV}"
  13. KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
  14. IUSE="activefilter atm dhcp eap-tls gtk ipv6 libressl pam radius"
  15. DEPEND="activefilter? ( net-libs/libpcap )
  16. atm? ( net-dialup/linux-atm )
  17. pam? ( virtual/pam )
  18. gtk? ( x11-libs/gtk+:2 )
  19. eap-tls? (
  20. net-misc/curl
  21. !libressl? ( dev-libs/openssl:0 )
  22. libressl? ( dev-libs/libressl )
  23. )"
  24. RDEPEND="${DEPEND}"
  25. PDEPEND="net-dialup/ppp-scripts"
  26. src_prepare() {
  27. mv "${WORKDIR}/dhcp" "${S}/pppd/plugins" || die
  28. use eap-tls || EPATCH_EXCLUDE+=" 8?_all_eaptls-*"
  29. EPATCH_SUFFIX="patch" \
  30. epatch "${WORKDIR}"/patch
  31. if use atm ; then
  32. einfo "Enabling PPPoATM support"
  33. sed -i '/^#HAVE_LIBATM=yes/s:#::' \
  34. pppd/plugins/pppoatm/Makefile.linux || die
  35. fi
  36. if ! use activefilter ; then
  37. einfo "Disabling active filter"
  38. sed -i '/^FILTER=y/s:^:#:' pppd/Makefile.linux || die
  39. fi
  40. if use pam ; then
  41. einfo "Enabling PAM"
  42. sed -i '/^#USE_PAM=y/s:^#::' pppd/Makefile.linux || die
  43. fi
  44. if use ipv6 ; then
  45. einfo "Enabling IPv6"
  46. sed -i '/#HAVE_INET6/s:#::' pppd/Makefile.linux || die
  47. fi
  48. einfo "Enabling CBCP"
  49. sed -i '/^#CBCP=y/s:#::' pppd/Makefile.linux || die
  50. if use dhcp ; then
  51. einfo "Adding ppp-dhcp plugin files"
  52. sed -i \
  53. -e '/^SUBDIRS :=/s:$: dhcp:' \
  54. pppd/plugins/Makefile.linux || die
  55. fi
  56. # Set correct libdir
  57. sed -i -e "s:/lib/pppd:/$(get_libdir)/pppd:" \
  58. pppd/{pathnames.h,pppd.8} || die
  59. if use radius ; then
  60. #set the right paths in radiusclient.conf
  61. sed -i -e "s:/usr/local/etc:/etc:" \
  62. -e "s:/usr/local/sbin:/usr/sbin:" \
  63. pppd/plugins/radius/etc/radiusclient.conf || die
  64. #set config dir to /etc/ppp/radius
  65. sed -i -e "s:/etc/radiusclient:/etc/ppp/radius:g" \
  66. pppd/plugins/radius/{*.8,*.c,*.h} \
  67. pppd/plugins/radius/etc/* || die
  68. else
  69. einfo "Disabling radius"
  70. sed -i -e '/+= radius/s:^:#:' pppd/plugins/Makefile.linux || die
  71. fi
  72. epatch_user # 549588
  73. }
  74. src_compile() {
  75. tc-export AR CC
  76. emake COPTS="${CFLAGS} -D_GNU_SOURCE"
  77. # build pppgetpass
  78. cd contrib/pppgetpass || die
  79. if use gtk ; then
  80. emake -f Makefile.linux
  81. else
  82. emake pppgetpass.vt
  83. fi
  84. }
  85. src_install() {
  86. local i
  87. for i in chat pppd pppdump pppstats ; do
  88. doman ${i}/${i}.8
  89. dosbin ${i}/${i}
  90. done
  91. fperms u+s-w /usr/sbin/pppd
  92. # Install pppd header files
  93. emake -C pppd INSTROOT="${D}" install-devel
  94. dosbin pppd/plugins/rp-pppoe/pppoe-discovery
  95. dodir /etc/ppp/peers
  96. insinto /etc/ppp
  97. insopts -m0600
  98. newins etc.ppp/pap-secrets pap-secrets.example
  99. newins etc.ppp/chap-secrets chap-secrets.example
  100. insopts -m0644
  101. doins etc.ppp/options
  102. pamd_mimic_system ppp auth account session
  103. local PLUGINS_DIR="/usr/$(get_libdir)/pppd/${PV}"
  104. # closing " for syntax coloring
  105. insinto "${PLUGINS_DIR}"
  106. insopts -m0755
  107. doins pppd/plugins/minconn.so
  108. doins pppd/plugins/passprompt.so
  109. doins pppd/plugins/passwordfd.so
  110. doins pppd/plugins/winbind.so
  111. doins pppd/plugins/rp-pppoe/rp-pppoe.so
  112. doins pppd/plugins/pppol2tp/openl2tp.so
  113. doins pppd/plugins/pppol2tp/pppol2tp.so
  114. if use atm ; then
  115. doins pppd/plugins/pppoatm/pppoatm.so
  116. fi
  117. if use dhcp ; then
  118. doins pppd/plugins/dhcp/dhcpc.so
  119. fi
  120. if use radius ; then
  121. doins pppd/plugins/radius/rad{ius,attr,realms}.so
  122. #Copy radiusclient configuration files (#92878)
  123. insinto /etc/ppp/radius
  124. insopts -m0644
  125. doins pppd/plugins/radius/etc/{dictionary*,issue,port-id-map,radiusclient.conf,realms,servers}
  126. doman pppd/plugins/radius/pppd-rad{ius,attr}.8
  127. fi
  128. insinto /etc/modprobe.d
  129. insopts -m0644
  130. newins "${FILESDIR}/modules.ppp" ppp.conf
  131. dodoc PLUGINS README* SETUP Changes-2.3 FAQ
  132. dodoc "${FILESDIR}/README.mpls"
  133. dosbin scripts/p{on,off,log}
  134. doman scripts/pon.1
  135. # Adding misc. specialized scripts to doc dir
  136. insinto /usr/share/doc/${PF}/scripts/chatchat
  137. doins scripts/chatchat/*
  138. insinto /usr/share/doc/${PF}/scripts
  139. doins scripts/*
  140. if use gtk ; then
  141. dosbin contrib/pppgetpass/{pppgetpass.vt,pppgetpass.gtk}
  142. newsbin contrib/pppgetpass/pppgetpass.sh pppgetpass
  143. else
  144. newsbin contrib/pppgetpass/pppgetpass.vt pppgetpass
  145. fi
  146. doman contrib/pppgetpass/pppgetpass.8
  147. }
  148. pkg_postinst() {
  149. if linux-info_get_any_version && linux_config_src_exists ; then
  150. echo
  151. ewarn "If the following test report contains a missing kernel configuration option that you need,"
  152. ewarn "you should reconfigure and rebuild your kernel before running pppd."
  153. CONFIG_CHECK="~PPP ~PPP_ASYNC ~PPP_SYNC_TTY"
  154. local ERROR_PPP="CONFIG_PPP:\t missing PPP support (REQUIRED)"
  155. local ERROR_PPP_ASYNC="CONFIG_PPP_ASYNC:\t missing asynchronous serial line discipline (optional, but highly recommended)"
  156. local WARNING_PPP_SYNC_TTY="CONFIG_PPP_SYNC_TTY:\t missing synchronous serial line discipline (optional; used by 'sync' pppd option)"
  157. if use activefilter ; then
  158. CONFIG_CHECK="${CONFIG_CHECK} ~PPP_FILTER"
  159. local ERROR_PPP_FILTER="CONFIG_PPP_FILTER:\t missing PPP filtering support (REQUIRED)"
  160. fi
  161. CONFIG_CHECK="${CONFIG_CHECK} ~PPP_DEFLATE ~PPP_BSDCOMP ~PPP_MPPE"
  162. local ERROR_PPP_DEFLATE="CONFIG_PPP_DEFLATE:\t missing Deflate compression (optional, but highly recommended)"
  163. local ERROR_PPP_BSDCOMP="CONFIG_PPP_BSDCOMP:\t missing BSD-Compress compression (optional, but highly recommended)"
  164. local WARNING_PPP_MPPE="CONFIG_PPP_MPPE:\t missing MPPE encryption (optional, mostly used by PPTP links)"
  165. CONFIG_CHECK="${CONFIG_CHECK} ~PPPOE ~PACKET"
  166. local WARNING_PPPOE="CONFIG_PPPOE:\t missing PPPoE support (optional, needed by rp-pppoe plugin)"
  167. local WARNING_PACKET="CONFIG_PACKET:\t missing AF_PACKET support (optional, used by rp-pppoe and dhcpc plugins)"
  168. if use atm ; then
  169. CONFIG_CHECK="${CONFIG_CHECK} ~PPPOATM"
  170. local WARNING_PPPOATM="CONFIG_PPPOATM:\t missing PPPoA support (optional, needed by pppoatm plugin)"
  171. fi
  172. check_extra_config
  173. fi
  174. # create *-secrets files if not exists
  175. [ -f "${ROOT}/etc/ppp/pap-secrets" ] || \
  176. cp -pP "${ROOT}/etc/ppp/pap-secrets.example" "${ROOT}/etc/ppp/pap-secrets"
  177. [ -f "${ROOT}/etc/ppp/chap-secrets" ] || \
  178. cp -pP "${ROOT}/etc/ppp/chap-secrets.example" "${ROOT}/etc/ppp/chap-secrets"
  179. # lib name has changed
  180. sed -i -e "s:^pppoe.so:rp-pppoe.so:" "${ROOT}/etc/ppp/options" || die
  181. echo
  182. elog "Pon, poff and plog scripts have been supplied for experienced users."
  183. elog "Users needing particular scripts (ssh,rsh,etc.) should check out the"
  184. elog "/usr/share/doc/${PF}/scripts directory."
  185. }