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

Contents of /net-misc/dhcp/dhcp-3.0.3-r9.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


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

  ViewVC Help
Powered by ViewVC 1.1.20