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

Contents of /net-misc/dhcp/dhcp-3.0.4-r1.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations) (download)
Fri Aug 11 16:27:45 2006 UTC (13 years, 4 months ago) by uberlord
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +1 -1 lines
FILE REMOVED
Punt old versions
(Portage version: 2.1.1_pre4-r4)

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

  ViewVC Help
Powered by ViewVC 1.1.20