/[gentoo-x86]/net-misc/dhcp/dhcp-4.3.1-r2.ebuild
Gentoo

Contents of /net-misc/dhcp/dhcp-4.3.1-r2.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7 - (hide annotations) (download)
Wed Apr 1 08:31:32 2015 UTC (4 years, 9 months ago) by ago
Branch: MAIN
Changes since 1.6: +2 -2 lines
Stable for sparc, wrt bug #539258

(Portage version: 2.2.14/cvs/Linux x86_64, RepoMan options: --include-arches="sparc", signed Manifest commit with key 7194459F)

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

  ViewVC Help
Powered by ViewVC 1.1.20