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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.1 Revision 1.2
1# Copyright 1999-2006 Gentoo Foundation 1# Copyright 1999-2006 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/net-misc/dhcp/Attic/dhcp-3.0.4-r1.ebuild,v 1.1 2006/05/11 15:05:31 uberlord Exp $ 3# $Header: /var/cvsroot/gentoo-x86/net-misc/dhcp/Attic/dhcp-3.0.4-r1.ebuild,v 1.2 2006/06/09 16:00:39 uberlord Exp $
4 4
5inherit eutils flag-o-matic multilib toolchain-funcs 5inherit eutils flag-o-matic multilib toolchain-funcs
6 6
7MY_PV="${PV//_beta/b}" 7MY_PV="${PV//_beta/b}"
8MY_PV="${MY_PV//_rc/rc}" 8MY_PV="${MY_PV//_rc/rc}"
12SRC_URI="ftp://ftp.isc.org/isc/dhcp/${MY_P}.tar.gz" 12SRC_URI="ftp://ftp.isc.org/isc/dhcp/${MY_P}.tar.gz"
13 13
14LICENSE="isc-dhcp" 14LICENSE="isc-dhcp"
15SLOT="0" 15SLOT="0"
16KEYWORDS="~alpha ~amd64 ~arm ~hppa ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd" 16KEYWORDS="~alpha ~amd64 ~arm ~hppa ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd"
17IUSE="static selinux" 17IUSE="doc minimal static selinux"
18 18
19RDEPEND="selinux? ( sec-policy/selinux-dhcp ) 19DEPEND="selinux? ( sec-policy/selinux-dhcp )
20 kernel_linux? ( sys-apps/net-tools )" 20 kernel_linux? ( sys-apps/net-tools )"
21DEPEND="selinux? ( sec-policy/selinux-dhcp )
22 >=sys-apps/sed-4"
23 21
24PROVIDE="virtual/dhcpc" 22PROVIDE="virtual/dhcpc"
25 23
26S="${WORKDIR}/${MY_P}" 24S="${WORKDIR}/${MY_P}"
27 25
29 unpack ${A} 27 unpack ${A}
30 cd "${S}" 28 cd "${S}"
31 29
32 # Gentoo patches - these will probably never be accepted upstream 30 # Gentoo patches - these will probably never be accepted upstream
33 # Enable chroot support 31 # Enable chroot support
34 epatch "${FILESDIR}/${PN}-3.0-paranoia.patch" 32 epatch "${FILESDIR}/${PN}"-3.0-paranoia.patch
35 # Fix some permission issues 33 # Fix some permission issues
36 epatch "${FILESDIR}/${PN}-3.0-fix-perms.patch" 34 epatch "${FILESDIR}/${PN}"-3.0-fix-perms.patch
37 # Enable dhclient to equery NTP servers 35 # Enable dhclient to equery NTP servers
38 epatch "${FILESDIR}/${PN}-3.0.3-dhclient-ntp.patch" 36 epatch "${FILESDIR}/${PN}"-3.0.3-dhclient-ntp.patch
39 # resolvconf support in dhclient-script 37 # resolvconf support in dhclient-script
40 epatch "${FILESDIR}/${PN}-3.0.3-dhclient-resolvconf.patch" 38 epatch "${FILESDIR}/${PN}"-3.0.3-dhclient-resolvconf.patch
41 # Fix setting hostnames on Linux 39 # Fix setting hostnames on Linux
42 epatch "${FILESDIR}/${PN}-3.0.3-dhclient-hostname.patch" 40 epatch "${FILESDIR}/${PN}"-3.0.3-dhclient-hostname.patch
43 # Allow mtu settings 41 # Allow mtu settings
44 epatch "${FILESDIR}/${PN}-3.0.3-dhclient-mtu.patch" 42 epatch "${FILESDIR}/${PN}"-3.0.3-dhclient-mtu.patch
45 # Allow dhclient to use IF_METRIC to set route metrics 43 # Allow dhclient to use IF_METRIC to set route metrics
46 epatch "${FILESDIR}/${PN}-3.0.3-dhclient-metric.patch" 44 epatch "${FILESDIR}/${PN}"-3.0.3-dhclient-metric.patch
47 # Stop downing the interface on Linux as that breaks link dameons 45 # Stop downing the interface on Linux as that breaks link dameons
48 # such as wpa_supplicant and netplug 46 # such as wpa_supplicant and netplug
49 epatch "${FILESDIR}/${PN}-3.0.3-dhclient-no-down.patch" 47 epatch "${FILESDIR}/${PN}"-3.0.3-dhclient-no-down.patch
50 # Quiet the isc blurb 48 # Quiet the isc blurb
51 epatch "${FILESDIR}/${PN}-3.0.3-no_isc_blurb.patch" 49 epatch "${FILESDIR}/${PN}"-3.0.3-no_isc_blurb.patch
52 # Enable dhclient to get extra configuration from stdin 50 # Enable dhclient to get extra configuration from stdin
53 epatch "${FILESDIR}/${PN}-3.0.4-dhclient-stdin-conf.patch" 51 epatch "${FILESDIR}/${PN}"-3.0.4-dhclient-stdin-conf.patch
54 52
55 # General fixes which will probably be accepted upstream eventually 53 # General fixes which will probably be accepted upstream eventually
56 # Install libdst, #75544 54 # Install libdst, #75544
57 epatch "${FILESDIR}/${PN}-3.0.3-libdst.patch" 55 epatch "${FILESDIR}/${PN}"-3.0.3-libdst.patch
58 # Fix building on Gentoo/FreeBSD 56 # Fix building on Gentoo/FreeBSD
59 epatch "${FILESDIR}/${PN}-3.0.2-gmake.patch" 57 epatch "${FILESDIR}/${PN}"-3.0.2-gmake.patch
60 58
61 # NetworkManager support patches 59 # NetworkManager support patches
62 # If they fail to apply to future versions they will be dropped 60 # If they fail to apply to future versions they will be dropped
63 # Enable eXtended options 61 # Enable eXtended options
64 epatch "${FILESDIR}/${PN}-3.0.3-x-option.patch" 62 epatch "${FILESDIR}/${PN}"-3.0.3-x-option.patch
65 # Add dbus support to dhclient 63 # Add dbus support to dhclient
66 epatch "${FILESDIR}/${PN}-3.0.3-dhclient-dbus.patch" 64 epatch "${FILESDIR}/${PN}"-3.0.3-dhclient-dbus.patch
67 65
68 # Brand the version with Gentoo 66 # Brand the version with Gentoo
69 # include revision if >0 67 # include revision if >0
70 local newver="${MY_PV}-Gentoo" 68 local newver="${MY_PV}-Gentoo"
71 [[ ${PR} != "r0" ]] && newver="${newver}-${PR}" 69 [[ ${PR} != "r0" ]] && newver="${newver}-${PR}"
72 sed -i -e '/^#define DHCP_VERSION[ \t]\+/ s/'"${MY_PV}/${newver}/g" \ 70 sed -i '/^#define DHCP_VERSION[ \t]\+/ s/'"${MY_PV}/${newver}/g" \
73 includes/version.h 71 includes/version.h || die
74 72
75 # Change the hook script locations of the scripts 73 # Change the hook script locations of the scripts
76 sed -i -e 's,/etc/dhclient-exit-hooks,/etc/dhcp/dhclient-exit-hooks,g' \ 74 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' \ 75 -e 's,/etc/dhclient-enter-hooks,/etc/dhcp/dhclient-enter-hooks,g' \
78 client/scripts/* 76 client/scripts/* || die
79 77
80 # Remove these options from the sample config 78 # Remove these options from the sample config
81 sed -i -e "/\(script\|host-name\|domain-name\) / d" client/dhclient.conf 79 sed -i -e "/\(script\|host-name\|domain-name\) / d" \
80 client/dhclient.conf || die
82 81
83 # Build sed man pages as we don't ever support BSD 4.4 and older, #130251. 82 # Build sed man pages as we don't ever support BSD 4.4 and older, #130251.
84 local x= 83 local x=
85 for x in Makefile.dist $(ls */Makefile.dist) ; do 84 for x in Makefile.dist $(ls */Makefile.dist) ; do
86 sed -i -e 's/$(CATMANPAGES)/$(SEDMANPAGES)/g' "${x}" 85 sed -i -e 's/$(CATMANPAGES)/$(SEDMANPAGES)/g' "${x}" || die
87 done 86 done
88 87
89 # Only install different man pages if we don't have en 88 # Only install different man pages if we don't have en
90 if [[ " ${LINGUAS} " != *" en "* ]]; then 89 if [[ " ${LINGUAS} " != *" en "* ]]; then
91 # Install Japanese man pages 90 # Install Japanese man pages
99 # Now remove the non-english docs so there are no errors later 98 # Now remove the non-english docs so there are no errors later
100 [[ -d doc/ja_JP.eucJP ]] && rm -rf doc/ja_JP.eucJP 99 [[ -d doc/ja_JP.eucJP ]] && rm -rf doc/ja_JP.eucJP
101} 100}
102 101
103src_compile() { 102src_compile() {
104 # 01/Mar/2003: Fix for bug #11960 by Jason Wever <weeve@gentoo.org>
105 [[ ${ARCH} == "sparc" ]] && filter-flags -O3 -O2 -O
106
107 use static && append-ldflags -static 103 use static && append-ldflags -static
108 104
109 cat <<-END >> includes/site.h 105 cat <<-END >> includes/site.h
110 #define _PATH_DHCPD_CONF "/etc/dhcp/dhcpd.conf" 106 #define _PATH_DHCPD_CONF "/etc/dhcp/dhcpd.conf"
111 #define _PATH_DHCPD_PID "/var/run/dhcp/dhcpd.pid" 107 #define _PATH_DHCPD_PID "/var/run/dhcp/dhcpd.pid"
136 END 132 END
137 133
138 ./configure --copts "-DPARANOIA -DEARLY_CHROOT -DEXTENDED_NEW_OPTION_INFO \ 134 ./configure --copts "-DPARANOIA -DEARLY_CHROOT -DEXTENDED_NEW_OPTION_INFO \
139 ${CFLAGS}" || die "configure failed" 135 ${CFLAGS}" || die "configure failed"
140 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
141 emake || die "compile problem" 142 emake || die "compile problem"
142} 143}
143 144
144src_install() { 145src_install() {
145 make install DESTDIR="${D}" || die 146 make install DESTDIR="${D}" || die
147 use doc && dodoc README RELNOTES doc/*
146 148
147 insinto /etc/dhcp 149 insinto /etc/dhcp
148 newins server/dhcpd.conf dhcpd.conf.sample
149 newins client/dhclient.conf dhclient.conf.sample 150 newins client/dhclient.conf dhclient.conf.sample
150
151 dodoc README RELNOTES doc/*
152 newdoc client/dhclient.conf dhclient.conf.sample
153 newdoc client/scripts/linux dhclient-script.sample
154 newdoc server/dhcpd.conf dhcpd.conf.sample
155
156 newinitd "${FILESDIR}/dhcpd.init" dhcpd
157 newinitd "${FILESDIR}/dhcrelay.init" dhcrelay
158 insinto /etc/conf.d
159 newins "${FILESDIR}/dhcpd.conf" dhcpd
160 newins "${FILESDIR}/dhcrelay.conf" dhcrelay
161
162 keepdir /var/{lib,run}/dhcp 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} 163}
164 164
165pkg_preinst() { 165pkg_preinst() {
166 if ! use minimal ; then
166 enewgroup dhcp 167 enewgroup dhcp
167 enewuser dhcp -1 -1 /var/lib/dhcp dhcp 168 enewuser dhcp -1 -1 /var/lib/dhcp dhcp
169 fi
168} 170}
169 171
170pkg_postinst() { 172pkg_postinst() {
173 use minimal && return
174
171 chown dhcp:dhcp "${ROOT}"/var/{lib,run}/dhcp 175 chown dhcp:dhcp "${ROOT}"/var/{lib,run}/dhcp
172 176
173 if [[ -e "${ROOT}/etc/init.d/dhcp" ]] ; then 177 if [[ -e "${ROOT}"/etc/init.d/dhcp ]] ; then
174 ewarn 178 ewarn
175 ewarn "WARNING: The dhcp init script has been renamed to dhcpd" 179 ewarn "WARNING: The dhcp init script has been renamed to dhcpd"
176 ewarn "/etc/init.d/dhcp and /etc/conf.d/dhcp need to be removed and" 180 ewarn "/etc/init.d/dhcp and /etc/conf.d/dhcp need to be removed and"
177 ewarn "and dhcp should be removed from the default runlevel" 181 ewarn "and dhcp should be removed from the default runlevel"
178 ewarn 182 ewarn
184 einfo "DHCPD_CHROOT directory in /etc/conf.d/dhcpd and then run:" 188 einfo "DHCPD_CHROOT directory in /etc/conf.d/dhcpd and then run:"
185 einfo " emerge --config =${PF}" 189 einfo " emerge --config =${PF}"
186} 190}
187 191
188pkg_config() { 192pkg_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
189 local CHROOT="$( 199 local CHROOT="$(
190 sed -n 's/^[[:blank:]]\?DHCPD_CHROOT="*\([^#"]\+\)"*/\1/p' \ 200 sed -n -e 's/^[[:blank:]]\?DHCPD_CHROOT="*\([^#"]\+\)"*/\1/p' \
191 /etc/conf.d/dhcpd 201 "${ROOT}"/etc/conf.d/dhcpd
192 )" 202 )"
193 203
194 if [[ -z ${CHROOT} ]]; then 204 if [[ -z ${CHROOT} ]]; then
195 eerror "CHROOT not defined in /etc/conf.d/dhcpd" 205 eerror "CHROOT not defined in /etc/conf.d/dhcpd"
196 return 1 206 return 1
197 fi 207 fi
198 208
209 CHROOT="${ROOT}/${CHROOT}"
210
199 if [[ -d ${CHROOT} ]] ; then 211 if [[ -d ${CHROOT} ]] ; then
200 ewarn "${CHROOT} already exists - aborting" 212 ewarn "${CHROOT} already exists - aborting"
201 return 0 213 return 0
202 fi 214 fi
203 215
204 ebegin "Setting up the chroot directory" 216 ebegin "Setting up the chroot directory"
205 mkdir -m 0755 -p "${CHROOT}/"{dev,etc,var/lib,var/run/dhcp} 217 mkdir -m 0755 -p "${CHROOT}/"{dev,etc,var/lib,var/run/dhcp}
206 cp /etc/{localtime,resolv.conf} "${CHROOT}/etc" 218 cp /etc/{localtime,resolv.conf} "${CHROOT}"/etc
207 cp -R /etc/dhcp "${CHROOT}/etc/" 219 cp -R /etc/dhcp "${CHROOT}"/etc
208 cp -R /var/lib/dhcp "${CHROOT}/var/lib" 220 cp -R /var/lib/dhcp "${CHROOT}"/var/lib
221 ln -s ../../var/lib/dhcp "${CHROOT}"/etc/dhcp/lib
209 chown -R dhcp:dhcp "${CHROOT}"/var/{lib,run}/dhcp 222 chown -R dhcp:dhcp "${CHROOT}"/var/{lib,run}/dhcp
210 eend 223 eend 0
211 224
212 local logger="$(best_version virtual/logger)" 225 local logger="$(best_version virtual/logger)"
213 einfo "To enable logging from the dhcpd server, configure your" 226 einfo "To enable logging from the dhcpd server, configure your"
214 einfo "logger (${logger}) to listen on ${CHROOT}/dev/log" 227 einfo "logger (${logger}) to listen on ${CHROOT}/dev/log"
215} 228}

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

  ViewVC Help
Powered by ViewVC 1.1.20