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

Contents of /net-misc/dhcp/dhcp-4.2.5_p1-r1.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download)
Sat Sep 28 11:50:41 2013 UTC (6 years, 2 months ago) by vapier
Branch: MAIN
CVS Tags: HEAD
Import patch from Fedora for IPv6 interface binding #471142 by Jaak Ristioja.  Fix path to iproute2 ip program #480636 by cyberbat.

(Portage version: 2.2.0/cvs/Linux x86_64, signed Manifest commit with key FB7C4156)

1 # Copyright 1999-2013 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.5_p1.ebuild,v 1.12 2013/04/14 11:44:39 ago Exp $
4
5 EAPI="4"
6
7 inherit eutils toolchain-funcs user
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 ftp://ftp.isc.org/isc/dhcp/${MY_PV}/${MY_P}.tar.gz"
18
19 LICENSE="ISC BSD SSLeay GPL-2" # GPL-2 only for init script
20 SLOT="0"
21 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
22 IUSE="+client ipv6 kernel_linux ldap selinux +server ssl vim-syntax"
23
24 DEPEND="selinux? ( sec-policy/selinux-dhcp )
25 client? (
26 kernel_linux? (
27 ipv6? ( sys-apps/iproute2 )
28 sys-apps/net-tools
29 )
30 )
31 ldap? (
32 net-nds/openldap
33 ssl? ( dev-libs/openssl )
34 )"
35 RDEPEND="${DEPEND}
36 vim-syntax? ( app-vim/dhcpd-syntax )"
37
38 S="${WORKDIR}/${MY_P}"
39
40 src_unpack() {
41 unpack ${A}
42 # handle local bind hell
43 cd "${S}"/bind
44 unpack ./bind.tar.gz
45 }
46
47 src_prepare() {
48 # Gentoo patches - these will probably never be accepted upstream
49 # Fix some permission issues
50 epatch "${FILESDIR}"/${PN}-3.0-fix-perms.patch
51 # Enable dhclient to equery NTP servers
52 epatch "${FILESDIR}"/${PN}-4.0-dhclient-ntp.patch
53 # resolvconf support in dhclient-script
54 epatch "${FILESDIR}"/${PN}-4.2.2-dhclient-resolvconf.patch
55 # Stop downing the interface on Linux as that breaks link daemons
56 # such as wpa_supplicant and netplug
57 epatch "${FILESDIR}"/${PN}-3.0.3-dhclient-no-down.patch
58 epatch "${FILESDIR}"/${PN}-4.2.0-errwarn-message.patch
59 # Enable dhclient to get extra configuration from stdin
60 epatch "${FILESDIR}"/${PN}-4.2.2-dhclient-stdin-conf.patch
61 epatch "${FILESDIR}"/${PN}-4.2.2-nogateway.patch #265531
62 epatch "${FILESDIR}"/${PN}-4.2.4-quieter-ping.patch #296921
63 epatch "${FILESDIR}"/${PN}-4.2.4-always-accept-4.patch #437108
64 epatch "${FILESDIR}"/${PN}-4.2.5-iproute2-path.patch #480636
65 epatch "${FILESDIR}"/${PN}-4.2.5-bindtodevice-inet6.patch #471142
66
67 # Brand the version with Gentoo
68 sed -i \
69 -e "/VERSION=/s:'$: Gentoo-${PR}':" \
70 configure || die
71
72 # Change the hook script locations of the scripts
73 sed -i \
74 -e 's,/etc/dhclient-exit-hooks,/etc/dhcp/dhclient-exit-hooks,g' \
75 -e 's,/etc/dhclient-enter-hooks,/etc/dhcp/dhclient-enter-hooks,g' \
76 client/scripts/* || die
77
78 # No need for the linux script to force bash #158540
79 sed -i -e 's,#!/bin/bash,#!/bin/sh,' client/scripts/linux || die
80
81 # Quiet the freebsd logger a little
82 sed -i -e '/LOGGER=/ s/-s -p user.notice //g' client/scripts/freebsd || die
83
84 # Remove these options from the sample config
85 sed -i -r \
86 -e "/(script|host-name|domain-name) /d" \
87 client/dhclient.conf.example || die
88
89 if use client && ! use server ; then
90 sed -i -r \
91 -e '/^SUBDIRS/s:\<(dhcpctl|relay|server)\>::g' \
92 Makefile.in || die
93 elif ! use client && use server ; then
94 sed -i -r \
95 -e '/^SUBDIRS/s:\<client\>::' \
96 Makefile.in || die
97 fi
98
99 # Only install different man pages if we don't have en
100 if [[ " ${LINGUAS} " != *" en "* ]]; then
101 # Install Japanese man pages
102 if [[ " ${LINGUAS} " == *" ja "* && -d doc/ja_JP.eucJP ]]; then
103 einfo "Installing Japanese documention"
104 cp doc/ja_JP.eucJP/dhclient* client
105 cp doc/ja_JP.eucJP/dhcp* common
106 fi
107 fi
108 # Now remove the non-english docs so there are no errors later
109 rm -rf doc/ja_JP.eucJP
110
111 # make the bind build work
112 binddir=${S}/bind
113 cd "${binddir}" || die
114 cat <<-EOF > bindvar.tmp
115 binddir=${binddir}
116 GMAKE=${MAKE:-gmake}
117 EOF
118 epatch "${FILESDIR}"/${PN}-4.2.2-bind-disable.patch
119 cd bind-*/
120 epatch "${FILESDIR}"/${PN}-4.2.2-bind-parallel-build.patch #380717
121 epatch "${FILESDIR}"/${PN}-4.2.2-bind-build-flags.patch
122 }
123
124 src_configure() {
125 # bind defaults to stupid `/usr/bin/ar`
126 tc-export AR BUILD_CC
127 export ac_cv_path_AR=${AR}
128
129 # this is tested for by the bind build system, and can cause trouble
130 # when cross-building; since dhcp itself doesn't make use of libcap,
131 # simply disable it.
132 export ac_cv_lib_cap_cap_set_proc=no
133
134 # Use FHS sane paths ... some of these have configure options,
135 # but not all, so just do it all here.
136 local e="/etc/dhcp" r="/var/run/dhcp" l="/var/lib/dhcp"
137 cat <<-EOF >> includes/site.h
138 #define _PATH_DHCPD_CONF "${e}/dhcpd.conf"
139 #define _PATH_DHCLIENT_CONF "${e}/dhclient.conf"
140 #define _PATH_DHCPD_DB "${l}/dhcpd.leases"
141 #define _PATH_DHCPD6_DB "${l}/dhcpd6.leases"
142 #define _PATH_DHCLIENT_DB "${l}/dhclient.leases"
143 #define _PATH_DHCLIENT6_DB "${l}/dhclient6.leases"
144 #define _PATH_DHCPD_PID "${r}/dhcpd.pid"
145 #define _PATH_DHCPD6_PID "${r}/dhcpd6.pid"
146 #define _PATH_DHCLIENT_PID "${r}/dhcpclient.pid"
147 #define _PATH_DHCLIENT6_PID "${r}/dhcpclient6.pid"
148 #define _PATH_DHCRELAY_PID "${r}/dhcrelay.pid"
149 #define _PATH_DHCRELAY6_PID "${r}/dhcrelay6.pid"
150 EOF
151
152 econf \
153 --enable-paranoia \
154 --enable-early-chroot \
155 --sysconfdir=${e} \
156 $(use_enable ipv6 dhcpv6) \
157 $(use_with ldap) \
158 $(use ldap && use_with ssl ldapcrypto || echo --without-ldapcrypto)
159
160 # configure local bind cruft. symtable option requires
161 # perl and we don't want to require that #383837.
162 cd bind/bind-*/ || die
163 eval econf \
164 $(sed -n '/ [.].configure /{s:^[^-]*::;s:>.*::;p}' ../Makefile) \
165 --disable-symtable \
166 --without-make-clean
167 }
168
169 src_compile() {
170 # build local bind cruft first
171 emake -C bind/bind-*/lib/export install
172 # then build standard dhcp code
173 emake AR="$(tc-getAR)"
174 }
175
176 src_install() {
177 default
178
179 dodoc README RELNOTES doc/{api+protocol,IANA-arp-parameters}
180 dohtml doc/References.html
181
182 if [[ -e client/dhclient ]] ; then
183 # move the client to /
184 dodir /sbin
185 mv "${D}"/usr/sbin/dhclient "${D}"/sbin/ || die
186
187 exeinto /sbin
188 if use kernel_linux ; then
189 newexe "${S}"/client/scripts/linux dhclient-script
190 else
191 newexe "${S}"/client/scripts/freebsd dhclient-script
192 fi
193 fi
194
195 if [[ -e server/dhcpd ]] ; then
196 if use ldap ; then
197 insinto /etc/openldap/schema
198 doins contrib/ldap/dhcp.*
199 dosbin contrib/ldap/dhcpd-conf-to-ldap
200 fi
201
202 newinitd "${FILESDIR}"/dhcpd.init5 dhcpd
203 newconfd "${FILESDIR}"/dhcpd.conf2 dhcpd
204 newinitd "${FILESDIR}"/dhcrelay.init3 dhcrelay
205 newconfd "${FILESDIR}"/dhcrelay.conf dhcrelay
206 newinitd "${FILESDIR}"/dhcrelay.init3 dhcrelay6
207 newconfd "${FILESDIR}"/dhcrelay6.conf dhcrelay6
208
209 sed -i "s:#@slapd@:$(usex ldap slapd ''):" "${ED}"/etc/init.d/* || die #442560
210 fi
211
212 # the default config files aren't terribly useful #384087
213 local f
214 for f in "${ED}"/etc/dhcp/*.conf.example ; do
215 mv "${f}" "${f%.example}" || die
216 done
217 sed -i '/^[^#]/s:^:#:' "${ED}"/etc/dhcp/*.conf || die
218 }
219
220 pkg_preinst() {
221 enewgroup dhcp
222 enewuser dhcp -1 -1 /var/lib/dhcp dhcp
223
224 # Keep the user files over the sample ones. The
225 # hashing is to ignore the crappy defaults #384087.
226 local f h
227 for f in dhclient:da7c8496a96452190aecf9afceef4510 dhcpd:10979e7b71134bd7f04d2a60bd58f070 ; do
228 h=${f#*:}
229 f="/etc/dhcp/${f%:*}.conf"
230 if [ -e "${EROOT}"${f} ] ; then
231 case $(md5sum "${EROOT}"${f}) in
232 ${h}*) ;;
233 *) cp -p "${EROOT}"${f} "${ED}"${f};;
234 esac
235 fi
236 done
237 }
238
239 pkg_postinst() {
240 if [[ -e "${ROOT}"/etc/init.d/dhcp ]] ; then
241 ewarn
242 ewarn "WARNING: The dhcp init script has been renamed to dhcpd"
243 ewarn "/etc/init.d/dhcp and /etc/conf.d/dhcp need to be removed and"
244 ewarn "and dhcp should be removed from the default runlevel"
245 ewarn
246 fi
247 }

  ViewVC Help
Powered by ViewVC 1.1.20