/[gentoo-x86]/net-misc/dhcp/dhcp-4.2.2-r3.ebuild
Gentoo

Contents of /net-misc/dhcp/dhcp-4.2.2-r3.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (show annotations) (download)
Mon Jan 6 21:44:16 2014 UTC (5 years, 11 months ago) by pinkbyte
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +1 -1 lines
FILE REMOVED
Security cleanup, wrt bug #463848, acked by Tony Vroon

(Portage version: 2.2.7/cvs/Linux x86_64, signed Manifest commit with key 0x1F357D42)

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

  ViewVC Help
Powered by ViewVC 1.1.20