/[gentoo-x86]/net-misc/dhcp/dhcp-4.2.1_p1.ebuild
Gentoo

Contents of /net-misc/dhcp/dhcp-4.2.1_p1.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Fri Apr 15 21:40:50 2011 UTC (2 years, 1 month ago) by ulm
Branch: MAIN
Changes since 1.1: +1 -3 lines
Don't PROVIDE virtual/dhcpc, bug 358827.

(Portage version: 2.1.9.46/cvs/Linux x86_64)

1 # Copyright 1999-2011 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/net-misc/dhcp/dhcp-4.2.1_p1.ebuild,v 1.1 2011/04/07 23:48:36 vapier Exp $
4
5 EAPI="2"
6
7 inherit eutils
8
9 MY_PV="${PV//_alpha/a}"
10 MY_PV="${MY_PV//_beta/b}"
11 MY_PV="${MY_PV//_rc/rc}"
12 MY_PV="${MY_PV//_p/-P}"
13 MY_P="${PN}-${MY_PV}"
14 DESCRIPTION="ISC Dynamic Host Configuration Protocol (DHCP) client/server"
15 HOMEPAGE="http://www.isc.org/products/DHCP"
16 SRC_URI="ftp://ftp.isc.org/isc/dhcp/${MY_P}.tar.gz"
17
18 LICENSE="as-is BSD"
19 SLOT="0"
20 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~sparc-fbsd ~x86 ~x86-fbsd"
21 IUSE="+client ipv6 kernel_linux ldap selinux +server ssl vim-syntax"
22
23 DEPEND="selinux? ( sec-policy/selinux-dhcp )
24 kernel_linux? ( sys-apps/net-tools )
25 vim-syntax? ( app-vim/dhcpd-syntax )
26 ldap? (
27 net-nds/openldap
28 ssl? ( dev-libs/openssl )
29 )"
30
31 S="${WORKDIR}/${MY_P}"
32
33 src_prepare() {
34 # Gentoo patches - these will probably never be accepted upstream
35 # Fix some permission issues
36 epatch "${FILESDIR}"/${PN}-3.0-fix-perms.patch
37 # Enable dhclient to equery NTP servers
38 epatch "${FILESDIR}"/${PN}-4.0-dhclient-ntp.patch
39 # resolvconf support in dhclient-script
40 epatch "${FILESDIR}"/${PN}-4.2.1-dhclient-resolvconf.patch
41 # Stop downing the interface on Linux as that breaks link daemons
42 # such as wpa_supplicant and netplug
43 epatch "${FILESDIR}"/${PN}-3.0.3-dhclient-no-down.patch
44 epatch "${FILESDIR}"/${PN}-4.2.0-errwarn-message.patch
45 # Enable dhclient to get extra configuration from stdin
46 epatch "${FILESDIR}"/${PN}-4.0.1-dhclient-stdin-conf.patch
47 epatch "${FILESDIR}"/${PN}-4.2.1-nogateway.patch #265531
48
49 # NetworkManager support patches
50 # If they fail to apply to future versions they will be dropped
51 # Add dbus support to dhclient
52 epatch "${FILESDIR}"/${PN}-3.0.3-dhclient-dbus.patch
53
54 # Brand the version with Gentoo
55 sed -i \
56 -e "/VERSION=/s:'$: Gentoo-${PR}':" \
57 configure || die
58
59 # Change the hook script locations of the scripts
60 sed -i \
61 -e 's,/etc/dhclient-exit-hooks,/etc/dhcp/dhclient-exit-hooks,g' \
62 -e 's,/etc/dhclient-enter-hooks,/etc/dhcp/dhclient-enter-hooks,g' \
63 client/scripts/* || die
64
65 # No need for the linux script to force bash, #158540.
66 sed -i -e 's,#!/bin/bash,#!/bin/sh,' client/scripts/linux || die
67
68 # Quiet the freebsd logger a little
69 sed -i -e '/LOGGER=/ s/-s -p user.notice //g' client/scripts/freebsd || die
70
71 # Remove these options from the sample config
72 sed -i \
73 -e "/\(script\|host-name\|domain-name\) / d" \
74 client/dhclient.conf || die
75
76 if use client && ! use server ; then
77 sed -i -r \
78 -e '/^SUBDIRS/s:\<(dhcpctl|relay|server)\>::g' \
79 Makefile.in || die
80 elif ! use client && use server ; then
81 sed -i -r \
82 -e '/^SUBDIRS/s:\<client\>::' \
83 Makefile.in || die
84 fi
85
86 # Only install different man pages if we don't have en
87 if [[ " ${LINGUAS} " != *" en "* ]]; then
88 # Install Japanese man pages
89 if [[ " ${LINGUAS} " == *" ja "* && -d doc/ja_JP.eucJP ]]; then
90 einfo "Installing Japanese documention"
91 cp doc/ja_JP.eucJP/dhclient* client
92 cp doc/ja_JP.eucJP/dhcp* common
93 fi
94 fi
95 # Now remove the non-english docs so there are no errors later
96 rm -rf doc/ja_JP.eucJP
97 }
98
99 src_configure() {
100 econf \
101 --enable-paranoia \
102 --sysconfdir=/etc/dhcp \
103 --with-cli-pid-file=/var/run/dhcp/dhclient.pid \
104 --with-cli-lease-file=/var/lib/dhcp/dhclient.leases \
105 --with-cli6-pid-file=/var/run/dhcp/dhclient6.pid \
106 --with-cli6-lease-file=/var/lib/dhcp/dhclient6.leases \
107 --with-srv-pid-file=/var/run/dhcp/dhcpd.pid \
108 --with-srv-lease-file=/var/lib/dhcp/dhcpd.leases \
109 --with-srv6-pid-file=/var/run/dhcp/dhcpd6.pid \
110 --with-srv6-lease-file=/var/lib/dhcp/dhcpd6.leases \
111 --with-relay-pid-file=/var/run/dhcp/dhcrelay.pid \
112 $(use_enable ipv6 dhcpv6) \
113 $(use_with ldap) \
114 $(use ldap && use_with ssl ldapcrypto || echo --without-ldapcrypto)
115 }
116
117 src_install() {
118 emake install DESTDIR="${D}" || die
119
120 dodoc README RELNOTES doc/{api+protocol,IANA-arp-parameters}
121 dohtml doc/References.html
122
123 if [[ -e client/dhclient ]] ; then
124 # move the client to /
125 dodir /sbin
126 mv "${D}"/usr/sbin/dhclient "${D}"/sbin/ || die
127
128 exeinto /sbin
129 if use kernel_linux ; then
130 newexe "${S}"/client/scripts/linux dhclient-script || die
131 else
132 newexe "${S}"/client/scripts/freebsd dhclient-script || die
133 fi
134
135 insinto /etc/dhcp
136 doins client/dhclient.conf || die
137
138 keepdir /var/lib/dhclient
139 fi
140
141 if [[ -e server/dhcpd ]] ; then
142 if use ldap ; then
143 insinto /etc/openldap/schema
144 doins contrib/ldap/dhcp.* || die
145 dosbin contrib/ldap/dhcpd-conf-to-ldap || die
146 fi
147
148 newinitd "${FILESDIR}"/dhcpd.init3 dhcpd
149 newinitd "${FILESDIR}"/dhcrelay.init2 dhcrelay
150 newconfd "${FILESDIR}"/dhcpd.conf dhcpd
151 newconfd "${FILESDIR}"/dhcrelay.conf dhcrelay
152
153 insinto /etc/dhcp
154 doins server/dhcpd.conf || die
155
156 keepdir /var/{lib,run}/dhcp
157 fi
158 }
159
160 pkg_preinst() {
161 enewgroup dhcp
162 enewuser dhcp -1 -1 /var/lib/dhcp dhcp
163
164 # Keep the user files over the sample ones
165 local f
166 for f in dhclient dhcpd ; do
167 f="/etc/dhcp/${f}.conf"
168 if [ -e "${ROOT}"${f} ] ; then
169 cp -p "${ROOT}"${f} "${D}"${f}
170 fi
171 done
172 }
173
174 pkg_postinst() {
175 chown -R dhcp:dhcp "${ROOT}"/var/{lib,run}/dhcp
176
177 if [[ -e "${ROOT}"/etc/init.d/dhcp ]] ; then
178 ewarn
179 ewarn "WARNING: The dhcp init script has been renamed to dhcpd"
180 ewarn "/etc/init.d/dhcp and /etc/conf.d/dhcp need to be removed and"
181 ewarn "and dhcp should be removed from the default runlevel"
182 ewarn
183 fi
184
185 einfo "You can edit /etc/conf.d/dhcpd to customize dhcp settings."
186 einfo
187 einfo "If you would like to run dhcpd in a chroot, simply configure the"
188 einfo "DHCPD_CHROOT directory in /etc/conf.d/dhcpd and then run:"
189 einfo " emerge --config =${PF}"
190 }
191
192 pkg_config() {
193 local CHROOT="$(
194 sed -n -e 's/^[[:blank:]]\?DHCPD_CHROOT="*\([^#"]\+\)"*/\1/p' \
195 "${ROOT}"/etc/conf.d/dhcpd
196 )"
197
198 if [[ -z ${CHROOT} ]]; then
199 eerror "CHROOT not defined in /etc/conf.d/dhcpd"
200 return 1
201 fi
202
203 CHROOT="${ROOT}/${CHROOT}"
204
205 if [[ -d ${CHROOT} ]] ; then
206 ewarn "${CHROOT} already exists - aborting"
207 return 0
208 fi
209
210 ebegin "Setting up the chroot directory"
211 mkdir -m 0755 -p "${CHROOT}/"{dev,etc,var/lib,var/run/dhcp}
212 cp /etc/{localtime,resolv.conf} "${CHROOT}"/etc
213 cp -R /etc/dhcp "${CHROOT}"/etc
214 cp -R /var/lib/dhcp "${CHROOT}"/var/lib
215 ln -s ../../var/lib/dhcp "${CHROOT}"/etc/dhcp/lib
216 chown -R dhcp:dhcp "${CHROOT}"/var/{lib,run}/dhcp
217 eend 0
218
219 local logger="$(best_version virtual/logger)"
220 einfo "To enable logging from the dhcpd server, configure your"
221 einfo "logger (${logger}) to listen on ${CHROOT}/dev/log"
222 }

  ViewVC Help
Powered by ViewVC 1.1.13