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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (show annotations) (download)
Thu Jul 19 09:40:48 2007 UTC (12 years, 4 months ago) by uberlord
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +1 -1 lines
FILE REMOVED
Punt old versions
(Portage version: 2.1.3_rc8)

1 # Copyright 1999-2007 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_alpha2.ebuild,v 1.3 2007/04/22 17:27:37 uberlord 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 # Enable eXtended options
66 epatch "${FILESDIR}/${PN}"-3.1.0a1-x-option.patch
67 # Add dbus support to dhclient
68 epatch "${FILESDIR}/${PN}"-3.0.3-dhclient-dbus.patch
69
70 # Brand the version with Gentoo
71 # include revision if >0
72 local newver="${MY_PV}-Gentoo"
73 [[ ${PR} != "r0" ]] && newver="${newver}-${PR}"
74 sed -i '/^#define DHCP_VERSION[ \t]\+/ s/'"${MY_PV}/${newver}/g" \
75 includes/version.h || die
76
77 # Change the hook script locations of the scripts
78 sed -i -e 's,/etc/dhclient-exit-hooks,/etc/dhcp/dhclient-exit-hooks,g' \
79 -e 's,/etc/dhclient-enter-hooks,/etc/dhcp/dhclient-enter-hooks,g' \
80 client/scripts/* || die
81
82 # No need for the linux script to force bash, #158540.
83 sed -i -e 's,#!/bin/bash,#!/bin/sh,' client/scripts/linux || die
84
85 # Quiet the freebsd logger a little
86 sed -i -e '/LOGGER=/ s/-s -p user.notice //g' client/scripts/freebsd || die
87
88 # Remove these options from the sample config
89 sed -i -e "/\(script\|host-name\|domain-name\) / d" \
90 client/dhclient.conf || die
91
92 # Build sed man pages as we don't ever support BSD 4.4 and older, #130251.
93 local x=
94 for x in Makefile.dist $(ls */Makefile.dist) ; do
95 sed -i -e 's/$(CATMANPAGES)/$(SEDMANPAGES)/g' "${x}" || die
96 done
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
108 # Now remove the non-english docs so there are no errors later
109 [[ -d doc/ja_JP.eucJP ]] && rm -rf doc/ja_JP.eucJP
110 }
111
112 src_compile() {
113 use static && append-ldflags -static
114
115 cat <<-END >> includes/site.h
116 #define _PATH_DHCPD_CONF "/etc/dhcp/dhcpd.conf"
117 #define _PATH_DHCPD_PID "/var/run/dhcp/dhcpd.pid"
118 #define _PATH_DHCPD_DB "/var/lib/dhcp/dhcpd.leases"
119 #define _PATH_DHCLIENT_CONF "/etc/dhcp/dhclient.conf"
120 #define _PATH_DHCLIENT_DB "/var/lib/dhcp/dhclient.leases"
121 #define _PATH_DHCLIENT_PID "/var/run/dhcp/dhclient.pid"
122 #define DHCPD_LOG_FACILITY LOG_LOCAL1
123 END
124
125 cat <<-END > site.conf
126 CC = $(tc-getCC)
127 LFLAGS = ${LDFLAGS}
128 LIBDIR = /usr/$(get_libdir)
129 INCDIR = /usr/include
130 ETC = /etc/dhcp
131 VARDB = /var/lib/dhcp
132 VARRUN = /var/run/dhcp
133 ADMMANDIR = /usr/share/man/man8
134 ADMMANEXT = .8
135 FFMANDIR = /usr/share/man/man5
136 FFMANEXT = .5
137 LIBMANDIR = /usr/share/man/man3
138 LIBMANEXT = .3
139 USRMANDIR = /usr/share/man/man1
140 USRMANEXT = .1
141 MANCAT = man
142 END
143
144 ./configure --copts "-DPARANOIA -DEARLY_CHROOT -DEXTENDED_NEW_OPTION_INFO \
145 ${CFLAGS}" || die "configure failed"
146
147 # Remove server support from the Makefile
148 # We still install some extra crud though
149 if use minimal ; then
150 sed -i -e 's/\(server\|relay\|dhcpctl\)/ /g' work.*/Makefile || die
151 fi
152 emake || die "compile problem"
153 }
154
155 src_install() {
156 make install DESTDIR="${D}" || die
157 use doc && dodoc README RELNOTES doc/*
158
159 insinto /etc/dhcp
160 newins client/dhclient.conf dhclient.conf.sample
161 keepdir /var/{lib,run}/dhcp
162
163 # Install our server files
164 if ! use minimal ; then
165 insinto /etc/dhcp
166 newins server/dhcpd.conf dhcpd.conf.sample
167 newinitd "${FILESDIR}"/dhcpd.init dhcpd
168 newinitd "${FILESDIR}"/dhcrelay.init dhcrelay
169 newconfd "${FILESDIR}"/dhcpd.conf dhcpd
170 newconfd "${FILESDIR}"/dhcrelay.conf dhcrelay
171 fi
172 }
173
174 pkg_preinst() {
175 if ! use minimal ; then
176 enewgroup dhcp
177 enewuser dhcp -1 -1 /var/lib/dhcp dhcp
178 fi
179 }
180
181 pkg_postinst() {
182 use minimal && return
183
184 chown dhcp:dhcp "${ROOT}"/var/{lib,run}/dhcp
185
186 if [[ -e "${ROOT}"/etc/init.d/dhcp ]] ; then
187 ewarn
188 ewarn "WARNING: The dhcp init script has been renamed to dhcpd"
189 ewarn "/etc/init.d/dhcp and /etc/conf.d/dhcp need to be removed and"
190 ewarn "and dhcp should be removed from the default runlevel"
191 ewarn
192 fi
193
194 einfo "You can edit /etc/conf.d/dhcpd to customize dhcp settings."
195 einfo
196 einfo "If you would like to run dhcpd in a chroot, simply configure the"
197 einfo "DHCPD_CHROOT directory in /etc/conf.d/dhcpd and then run:"
198 einfo " emerge --config =${PF}"
199 }
200
201 pkg_config() {
202 if use minimal ; then
203 eerror "${PN} has not been compiled for server support"
204 eerror "emerge ${PN} without the minimal USE flag to use dhcp sever"
205 return 1
206 fi
207
208 local CHROOT="$(
209 sed -n -e 's/^[[:blank:]]\?DHCPD_CHROOT="*\([^#"]\+\)"*/\1/p' \
210 "${ROOT}"/etc/conf.d/dhcpd
211 )"
212
213 if [[ -z ${CHROOT} ]]; then
214 eerror "CHROOT not defined in /etc/conf.d/dhcpd"
215 return 1
216 fi
217
218 CHROOT="${ROOT}/${CHROOT}"
219
220 if [[ -d ${CHROOT} ]] ; then
221 ewarn "${CHROOT} already exists - aborting"
222 return 0
223 fi
224
225 ebegin "Setting up the chroot directory"
226 mkdir -m 0755 -p "${CHROOT}/"{dev,etc,var/lib,var/run/dhcp}
227 cp /etc/{localtime,resolv.conf} "${CHROOT}"/etc
228 cp -R /etc/dhcp "${CHROOT}"/etc
229 cp -R /var/lib/dhcp "${CHROOT}"/var/lib
230 ln -s ../../var/lib/dhcp "${CHROOT}"/etc/dhcp/lib
231 chown -R dhcp:dhcp "${CHROOT}"/var/{lib,run}/dhcp
232 eend 0
233
234 local logger="$(best_version virtual/logger)"
235 einfo "To enable logging from the dhcpd server, configure your"
236 einfo "logger (${logger}) to listen on ${CHROOT}/dev/log"
237 }

  ViewVC Help
Powered by ViewVC 1.1.20