summaryrefslogtreecommitdiff
blob: 50d4fcf46980ae2eb2d10baab148ff29acd6dede (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-misc/dhcpcd/dhcpcd-3.2.2.ebuild,v 1.1 2008/02/20 20:48:51 welp Exp $

inherit toolchain-funcs

DESCRIPTION="A DHCP client"
HOMEPAGE="http://roy.marples.name/dhcpcd"
SRC_URI="http://roy.marples.name/${PN}/${P}.tar.bz2"
LICENSE="BSD-2"

KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~sparc-fbsd ~x86 ~x86-fbsd"

SLOT="0"
IUSE="vram zeroconf"

DEPEND=""
PROVIDE="virtual/dhcpc"

src_unpack() {
	unpack ${A}
	cd "${S}"

	if use zeroconf; then
		elog "ZeroConf support enabled"
	else
		elog "Disabling zeroconf support"
		{
			echo
			echo "/* User indicated no zeroconf support */"
			echo "#undef ENABLE_IPV4LL"
		} >> config.h
	fi

	# Disable DUID support if we have volatile storage.
	# LiveCD's *should* enable this USE flag
	if use vram; then
		elog "Disabling DUID support"
		{
			echo
			echo "/* User indicated volatile ram storage */"
			echo "#undef ENABLE_DUID"
		} >> config.h
	else
		elog "DUID support enabled"
	fi
}

src_compile() {
	emake CC="$(tc-getCC)" INFODIR=/var/lib/dhcpcd || die
}

src_install() {
	emake DESTDIR="${D}" install || die
}

pkg_postinst() {
	# Upgrade the duid file to the new format if needed
	local duid="${ROOT}"/var/lib/dhcpcd/dhcpcd.duid
	if [ -e "${duid}" ] && ! grep -q '..:..:..:..:..:..' "${duid}"; then
		sed -i -e 's/\(..\)/\1:/g; s/:$//g' "${duid}"
	fi

	if use zeroconf; then
		elog "You have installed dhcpcd with zeroconf support."
		elog "This means that it will always obtain an IP address even if no"
		elog "DHCP server can be contacted, which will break any existing"
		elog "failover support you may have configured in your net configuration."
		elog "This behaviour can be controlled with the -L flag."
		elog "See the dhcpcd man page for more details."
	fi

	if ! use vram; then
		use zeroconf && echo
		elog "You have installed dhcpcd with DUID support."
		elog "This means that we will generate a DUID in /var/lib/dhcpcd/dhcpcd.duid"
		elog "This is generated from a MAC address of the card and a timestamp."
		elog "It will be used in every subsequent DHCP transaction, along with a IAID"
		elog "in the ClientID option. This is required by RFC 4361."
		echo
		elog "Some DHCP server implementations require a MAC address only in the"
		elog "ClientID field. These DHCP servers should be updated to be RFC"
		elog "conformant. If you cannot do this, you can revert to the old"
		elog "behaviour by using the -I '' option OR building dhcpcd with the"
		elog "vram USE flag enabled."
	fi
}