dhcpcd-6.11.3.ebuild 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=6
  4. if [[ ${PV} == "9999" ]]; then
  5. FOSSIL_URI="http://roy.marples.name/projects/dhcpcd"
  6. else
  7. MY_P="${P/_alpha/-alpha}"
  8. MY_P="${MY_P/_beta/-beta}"
  9. MY_P="${MY_P/_rc/-rc}"
  10. SRC_URI="http://roy.marples.name/downloads/${PN}/${MY_P}.tar.xz"
  11. KEYWORDS="alpha amd64 arm arm64 hppa ia64 ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux"
  12. S="${WORKDIR}/${MY_P}"
  13. fi
  14. inherit eutils systemd toolchain-funcs
  15. DESCRIPTION="A fully featured, yet light weight RFC2131 compliant DHCP client"
  16. HOMEPAGE="http://roy.marples.name/projects/dhcpcd/"
  17. LICENSE="BSD-2"
  18. SLOT="0"
  19. IUSE="elibc_glibc +embedded ipv6 kernel_linux +udev"
  20. COMMON_DEPEND="udev? ( virtual/udev )"
  21. DEPEND="${COMMON_DEPEND}"
  22. RDEPEND="${COMMON_DEPEND}"
  23. if [[ ${PV} == "9999" ]]; then
  24. DEPEND+=" dev-vcs/fossil"
  25. src_unpack()
  26. {
  27. local distdir=${PORTAGE_ACTUAL_DISTDIR:-${DISTDIR}}
  28. local repo=${distdir}/fossil/${PN}.fossil
  29. addwrite "${distdir}"
  30. if [[ -e "${repo}" ]]; then
  31. fossil pull "${FOSSIL_URI}" -R "${repo}" || die
  32. else
  33. mkdir -p "${distdir}/fossil" || die
  34. fossil clone "${FOSSIL_URI}" "${repo}" || die
  35. fi
  36. mkdir -p "${S}" || die
  37. cd "${S}" || die
  38. fossil open "${repo}" || die
  39. }
  40. fi
  41. src_configure()
  42. {
  43. local dev hooks rundir
  44. use udev || dev="--without-dev --without-udev"
  45. hooks="--with-hook=ntp.conf"
  46. use elibc_glibc && hooks="${hooks} --with-hook=yp.conf"
  47. use kernel_linux && rundir="--rundir=${EPREFIX}/run"
  48. econf \
  49. --prefix="${EPREFIX}" \
  50. --libexecdir="${EPREFIX}/lib/dhcpcd" \
  51. --dbdir="${EPREFIX}/var/lib/dhcpcd" \
  52. --localstatedir="${EPREFIX}/var" \
  53. ${rundir} \
  54. $(use_enable embedded) \
  55. $(use_enable ipv6) \
  56. ${dev} \
  57. CC="$(tc-getCC)" \
  58. ${hooks}
  59. }
  60. src_install()
  61. {
  62. default
  63. newinitd "${FILESDIR}"/${PN}.initd ${PN}
  64. systemd_dounit "${FILESDIR}"/${PN}.service
  65. }
  66. pkg_postinst()
  67. {
  68. # Upgrade the duid file to the new format if needed
  69. local old_duid="${ROOT}"/var/lib/dhcpcd/dhcpcd.duid
  70. local new_duid="${ROOT}"/etc/dhcpcd.duid
  71. if [ -e "${old_duid}" ] && ! grep -q '..:..:..:..:..:..' "${old_duid}"; then
  72. sed -i -e 's/\(..\)/\1:/g; s/:$//g' "${old_duid}"
  73. fi
  74. # Move the duid to /etc, a more sensible location
  75. if [ -e "${old_duid}" -a ! -e "${new_duid}" ]; then
  76. cp -p "${old_duid}" "${new_duid}"
  77. fi
  78. if [ -z "$REPLACING_VERSIONS" ]; then
  79. elog
  80. elog "dhcpcd has zeroconf support active by default."
  81. elog "This means it will always obtain an IP address even if no"
  82. elog "DHCP server can be contacted, which will break any existing"
  83. elog "failover support you may have configured in your net configuration."
  84. elog "This behaviour can be controlled with the noipv4ll configuration"
  85. elog "file option or the -L command line switch."
  86. elog "See the dhcpcd and dhcpcd.conf man pages for more details."
  87. elog
  88. elog "Dhcpcd has duid enabled by default, and this may cause issues"
  89. elog "with some dhcp servers. For more information, see"
  90. elog "https://bugs.gentoo.org/show_bug.cgi?id=477356"
  91. fi
  92. if ! has_version net-dns/bind-tools; then
  93. elog
  94. elog "If you activate the lookup-hostname hook to look up your hostname"
  95. elog "using the dns, you need to install net-dns/bind-tools."
  96. fi
  97. }