| 1 |
# Copyright 1999-2012 Gentoo Foundation |
| 2 |
# Distributed under the terms of the GNU General Public License v2 |
| 3 |
# $Header: /var/cvsroot/gentoo-x86/net-misc/dhcpcd/dhcpcd-5.5.2.ebuild,v 1.1 2012/02/03 16:21:35 williamh Exp $ |
| 4 |
|
| 5 |
EAPI=4 |
| 6 |
|
| 7 |
inherit eutils systemd |
| 8 |
|
| 9 |
MY_P="${P/_alpha/-alpha}" |
| 10 |
MY_P="${MY_P/_beta/-beta}" |
| 11 |
MY_P="${MY_P/_rc/-rc}" |
| 12 |
S="${WORKDIR}/${MY_P}" |
| 13 |
|
| 14 |
DESCRIPTION="A fully featured, yet light weight RFC2131 compliant DHCP client" |
| 15 |
HOMEPAGE="http://roy.marples.name/projects/dhcpcd/" |
| 16 |
SRC_URI="http://roy.marples.name/downloads/${PN}/${MY_P}.tar.bz2" |
| 17 |
LICENSE="BSD-2" |
| 18 |
|
| 19 |
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd ~x86-linux" |
| 20 |
|
| 21 |
SLOT="0" |
| 22 |
IUSE="+zeroconf elibc_glibc" |
| 23 |
|
| 24 |
DEPEND="" |
| 25 |
RDEPEND="" |
| 26 |
|
| 27 |
src_prepare() { |
| 28 |
if ! use zeroconf; then |
| 29 |
elog "Disabling zeroconf support" |
| 30 |
{ |
| 31 |
echo |
| 32 |
echo "# dhcpcd ebuild requested no zeroconf" |
| 33 |
echo "noipv4ll" |
| 34 |
} >> dhcpcd.conf |
| 35 |
fi |
| 36 |
} |
| 37 |
|
| 38 |
src_configure() { |
| 39 |
local hooks="--with-hook=ntp.conf" |
| 40 |
use elibc_glibc && hooks="${hooks} --with-hook=yp.conf" |
| 41 |
econf \ |
| 42 |
--prefix="${EPREFIX}" \ |
| 43 |
--libexecdir="${EPREFIX}/lib/dhcpcd" \ |
| 44 |
--dbdir="${EPREFIX}/var/lib/dhcpcd" \ |
| 45 |
--localstatedir="${EPREFIX}/var" \ |
| 46 |
${hooks} |
| 47 |
} |
| 48 |
|
| 49 |
src_install() { |
| 50 |
default |
| 51 |
newinitd "${FILESDIR}"/${PN}.initd ${PN} |
| 52 |
systemd_dounit "${FILESDIR}"/${PN}.service |
| 53 |
} |
| 54 |
|
| 55 |
pkg_postinst() { |
| 56 |
# Upgrade the duid file to the new format if needed |
| 57 |
local old_duid="${ROOT}"/var/lib/dhcpcd/dhcpcd.duid |
| 58 |
local new_duid="${ROOT}"/etc/dhcpcd.duid |
| 59 |
if [ -e "${old_duid}" ] && ! grep -q '..:..:..:..:..:..' "${old_duid}"; then |
| 60 |
sed -i -e 's/\(..\)/\1:/g; s/:$//g' "${old_duid}" |
| 61 |
fi |
| 62 |
|
| 63 |
# Move the duid to /etc, a more sensible location |
| 64 |
if [ -e "${old_duid}" -a ! -e "${new_duid}" ]; then |
| 65 |
cp -p "${old_duid}" "${new_duid}" |
| 66 |
fi |
| 67 |
|
| 68 |
if use zeroconf; then |
| 69 |
elog "You have installed dhcpcd with zeroconf support." |
| 70 |
elog "This means that it will always obtain an IP address even if no" |
| 71 |
elog "DHCP server can be contacted, which will break any existing" |
| 72 |
elog "failover support you may have configured in your net configuration." |
| 73 |
elog "This behaviour can be controlled with the -L flag." |
| 74 |
elog "See the dhcpcd man page for more details." |
| 75 |
fi |
| 76 |
|
| 77 |
elog |
| 78 |
elog "Users upgrading from 4.0 series should pay attention to removal" |
| 79 |
elog "of compat useflag. This changes behavior of dhcp in wide manner:" |
| 80 |
elog "dhcpcd no longer sends a default ClientID for ethernet interfaces." |
| 81 |
elog "This is so we can re-use the address the kernel DHCP client found." |
| 82 |
elog "To retain the old behaviour of sending a default ClientID based on the" |
| 83 |
elog "hardware address for interface, simply add the keyword clientid" |
| 84 |
elog "to dhcpcd.conf or use commandline parameter -I ''" |
| 85 |
elog |
| 86 |
elog "Also, users upgrading from 4.0 series should be aware that" |
| 87 |
elog "the -N, -R and -Y command line options no longer exist." |
| 88 |
elog "These are controled now by nohook options in dhcpcd.conf." |
| 89 |
|
| 90 |
# Mea culpa, feel free to remove that after some time --mgorny. |
| 91 |
if [[ -e "${ROOT}"/etc/systemd/system/network.target.wants/${PN}.service ]] |
| 92 |
then |
| 93 |
ebegin "Moving ${PN}.service to multi-user.target" |
| 94 |
mv "${ROOT}"/etc/systemd/system/network.target.wants/${PN}.service \ |
| 95 |
"${ROOT}"/etc/systemd/system/multi-user.target.wants/ |
| 96 |
eend ${?} \ |
| 97 |
"Please try to re-enable dhcpcd.service" |
| 98 |
fi |
| 99 |
} |