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

Contents of /net-misc/dhcp/dhcp-3.1.0.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.12 - (show annotations) (download)
Fri May 29 23:30:28 2009 UTC (10 years, 6 months ago) by vapier
Branch: MAIN
CVS Tags: HEAD
Changes since 1.11: +1 -1 lines
FILE REMOVED
Punt old packages vuln to GLSA 200808-05 #271748.
(Portage version: 2.2_rc33/cvs/Linux x86_64)

1 # Copyright 1999-2008 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/net-misc/dhcp/dhcp-3.1.0.ebuild,v 1.11 2008/01/10 09:14:57 vapier Exp $
4
5 inherit eutils flag-o-matic multilib toolchain-funcs
6
7 MY_PV="${PV//_alpha/a}"
8 MY_PV="${MY_PV//_beta/b}"
9 MY_PV="${MY_PV//_rc/rc}"
10 MY_P="${PN}-${MY_PV}"
11 DESCRIPTION="ISC Dynamic Host Configuration Protocol"
12 HOMEPAGE="http://www.isc.org/products/DHCP"
13 SRC_URI="ftp://ftp.isc.org/isc/dhcp/${MY_P}.tar.gz"
14
15 LICENSE="isc-dhcp"
16 SLOT="0"
17 KEYWORDS="alpha amd64 arm hppa mips ppc ppc64 s390 sh sparc ~sparc-fbsd x86 ~x86-fbsd"
18 IUSE="doc minimal static selinux kernel_linux"
19
20 DEPEND="selinux? ( sec-policy/selinux-dhcp )
21 kernel_linux? ( sys-apps/net-tools )"
22
23 PROVIDE="virtual/dhcpc"
24
25 S="${WORKDIR}/${MY_P}"
26
27 src_unpack() {
28 unpack ${A}
29 cd "${S}"
30
31 # Gentoo patches - these will probably never be accepted upstream
32 # Enable chroot support
33 epatch "${FILESDIR}/${PN}"-3.0-paranoia.patch
34 # Fix some permission issues
35 epatch "${FILESDIR}/${PN}"-3.0-fix-perms.patch
36 # Enable dhclient to equery NTP servers
37 epatch "${FILESDIR}/${PN}"-3.0.3-dhclient-ntp.patch
38 # resolvconf support in dhclient-script
39 epatch "${FILESDIR}/${PN}"-3.1.0a1-dhclient-resolvconf.patch
40 # Fix setting hostnames on Linux
41 epatch "${FILESDIR}/${PN}"-3.0.3-dhclient-hostname.patch
42 # Allow mtu settings
43 epatch "${FILESDIR}/${PN}"-3.0.3-dhclient-mtu.patch
44 # Allow dhclient to use IF_METRIC to set route metrics
45 epatch "${FILESDIR}/${PN}"-3.0.3-dhclient-metric.patch
46 # Stop downing the interface on Linux as that breaks link dameons
47 # such as wpa_supplicant and netplug
48 epatch "${FILESDIR}/${PN}"-3.0.3-dhclient-no-down.patch
49 # Quiet the isc blurb
50 epatch "${FILESDIR}/${PN}"-3.0.3-no_isc_blurb.patch
51 # Enable dhclient to get extra configuration from stdin
52 epatch "${FILESDIR}/${PN}"-3.0.4-dhclient-stdin-conf.patch
53 # Disable fallback interfaces when using BPF
54 # This allows more than one dhclient instance on the BSD's
55 epatch "${FILESDIR}/${PN}"-3.0.5-bpf-nofallback.patch
56
57 # General fixes which will probably be accepted upstream eventually
58 # Install libdst, #75544
59 epatch "${FILESDIR}/${PN}"-3.0.3-libdst.patch
60 # Fix building on Gentoo/FreeBSD
61 epatch "${FILESDIR}/${PN}"-3.0.2-gmake.patch
62
63 # NetworkManager support patches
64 # If they fail to apply to future versions they will be dropped
65 # Add dbus support to dhclient
66 epatch "${FILESDIR}/${PN}"-3.0.3-dhclient-dbus.patch
67
68 # Brand the version with Gentoo
69 # include revision if >0
70 local newver="${MY_PV}-Gentoo"
71 [[ ${PR} != "r0" ]] && newver="${newver}-${PR}"
72 sed -i '/^#define DHCP_VERSION[ \t]\+/ s/'"${MY_PV}/${newver}/g" \
73 includes/version.h || die
74
75 # Change the hook script locations of the scripts
76 sed -i -e 's,/etc/dhclient-exit-hooks,/etc/dhcp/dhclient-exit-hooks,g' \
77 -e 's,/etc/dhclient-enter-hooks,/etc/dhcp/dhclient-enter-hooks,g' \
78 client/scripts/* || die
79
80 # No need for the linux script to force bash, #158540.
81 sed -i -e 's,#!/bin/bash,#!/bin/sh,' client/scripts/linux || die
82
83 # Quiet the freebsd logger a little
84 sed -i -e '/LOGGER=/ s/-s -p user.notice //g' client/scripts/freebsd || die
85
86 # Remove these options from the sample config
87 sed -i -e "/\(script\|host-name\|domain-name\) / d" \
88 client/dhclient.conf || die
89
90 # Build sed man pages as we don't ever support BSD 4.4 and older, #130251.
91 local x=
92 for x in Makefile.dist $(ls */Makefile.dist) ; do
93 sed -i -e 's/$(CATMANPAGES)/$(SEDMANPAGES)/g' "${x}" || die
94 done
95
96 # Only install different man pages if we don't have en
97 if [[ " ${LINGUAS} " != *" en "* ]]; then
98 # Install Japanese man pages
99 if [[ " ${LINGUAS} " == *" ja "* && -d doc/ja_JP.eucJP ]]; then
100 einfo "Installing Japanese documention"
101 cp doc/ja_JP.eucJP/dhclient* client
102 cp doc/ja_JP.eucJP/dhcp* common
103 fi
104 fi
105
106 # Now remove the non-english docs so there are no errors later
107 [[ -d doc/ja_JP.eucJP ]] && rm -rf doc/ja_JP.eucJP
108 }
109
110 src_compile() {
111 use static && append-ldflags -static
112
113 cat <<-END >> includes/site.h
114 #define _PATH_DHCPD_CONF "/etc/dhcp/dhcpd.conf"
115 #define _PATH_DHCPD_PID "/var/run/dhcp/dhcpd.pid"
116 #define _PATH_DHCPD_DB "/var/lib/dhcp/dhcpd.leases"
117 #define _PATH_DHCLIENT_CONF "/etc/dhcp/dhclient.conf"
118 #define _PATH_DHCLIENT_DB "/var/lib/dhcp/dhclient.leases"
119 #define _PATH_DHCLIENT_PID "/var/run/dhcp/dhclient.pid"
120 #define DHCPD_LOG_FACILITY LOG_LOCAL1
121 END
122
123 cat <<-END > site.conf
124 CC = $(tc-getCC)
125 LFLAGS = ${LDFLAGS}
126 LIBDIR = /usr/$(get_libdir)
127 INCDIR = /usr/include
128 ETC = /etc/dhcp
129 VARDB = /var/lib/dhcp
130 VARRUN = /var/run/dhcp
131 ADMMANDIR = /usr/share/man/man8
132 ADMMANEXT = .8
133 FFMANDIR = /usr/share/man/man5
134 FFMANEXT = .5
135 LIBMANDIR = /usr/share/man/man3
136 LIBMANEXT = .3
137 USRMANDIR = /usr/share/man/man1
138 USRMANEXT = .1
139 MANCAT = man
140 END
141
142 ./configure --copts "-DPARANOIA -DEARLY_CHROOT ${CFLAGS}" \
143 || die "configure failed"
144
145 # Remove server support from the Makefile
146 # We still install some extra crud though
147 if use minimal ; then
148 sed -i -e 's/\(server\|relay\|dhcpctl\)/ /g' work.*/Makefile || die
149 fi
150 emake || die "compile problem"
151 }
152
153 src_install() {
154 make install DESTDIR="${D}" || die
155 use doc && dodoc README RELNOTES doc/*
156
157 insinto /etc/dhcp
158 newins client/dhclient.conf dhclient.conf.sample
159 keepdir /var/{lib,run}/dhcp
160
161 # Install our server files
162 if ! use minimal ; then
163 insinto /etc/dhcp
164 newins server/dhcpd.conf dhcpd.conf.sample
165 newinitd "${FILESDIR}"/dhcpd.init dhcpd
166 newinitd "${FILESDIR}"/dhcrelay.init dhcrelay
167 newconfd "${FILESDIR}"/dhcpd.conf dhcpd
168 newconfd "${FILESDIR}"/dhcrelay.conf dhcrelay
169
170 # We never want portage to own this file
171 rm -f "${D}"/var/lib/dhcp/dhcpd.leases
172 fi
173 }
174
175 pkg_preinst() {
176 if ! use minimal ; then
177 enewgroup dhcp
178 enewuser dhcp -1 -1 /var/lib/dhcp dhcp
179 fi
180 }
181
182 pkg_postinst() {
183 use minimal && return
184
185 chown dhcp:dhcp "${ROOT}"/var/{lib,run}/dhcp
186
187 if [[ -e "${ROOT}"/etc/init.d/dhcp ]] ; then
188 ewarn
189 ewarn "WARNING: The dhcp init script has been renamed to dhcpd"
190 ewarn "/etc/init.d/dhcp and /etc/conf.d/dhcp need to be removed and"
191 ewarn "and dhcp should be removed from the default runlevel"
192 ewarn
193 fi
194
195 einfo "You can edit /etc/conf.d/dhcpd to customize dhcp settings."
196 einfo
197 einfo "If you would like to run dhcpd in a chroot, simply configure the"
198 einfo "DHCPD_CHROOT directory in /etc/conf.d/dhcpd and then run:"
199 einfo " emerge --config =${PF}"
200 }
201
202 pkg_config() {
203 if use minimal ; then
204 eerror "${PN} has not been compiled for server support"
205 eerror "emerge ${PN} without the minimal USE flag to use dhcp sever"
206 return 1
207 fi
208
209 local CHROOT="$(
210 sed -n -e 's/^[[:blank:]]\?DHCPD_CHROOT="*\([^#"]\+\)"*/\1/p' \
211 "${ROOT}"/etc/conf.d/dhcpd
212 )"
213
214 if [[ -z ${CHROOT} ]]; then
215 eerror "CHROOT not defined in /etc/conf.d/dhcpd"
216 return 1
217 fi
218
219 CHROOT="${ROOT}/${CHROOT}"
220
221 if [[ -d ${CHROOT} ]] ; then
222 ewarn "${CHROOT} already exists - aborting"
223 return 0
224 fi
225
226 ebegin "Setting up the chroot directory"
227 mkdir -m 0755 -p "${CHROOT}/"{dev,etc,var/lib,var/run/dhcp}
228 cp /etc/{localtime,resolv.conf} "${CHROOT}"/etc
229 cp -R /etc/dhcp "${CHROOT}"/etc
230 cp -R /var/lib/dhcp "${CHROOT}"/var/lib
231 ln -s ../../var/lib/dhcp "${CHROOT}"/etc/dhcp/lib
232 chown -R dhcp:dhcp "${CHROOT}"/var/{lib,run}/dhcp
233 eend 0
234
235 local logger="$(best_version virtual/logger)"
236 einfo "To enable logging from the dhcpd server, configure your"
237 einfo "logger (${logger}) to listen on ${CHROOT}/dev/log"
238 }

  ViewVC Help
Powered by ViewVC 1.1.20