/[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.1 - (hide annotations) (download)
Thu May 11 15:05:31 2006 UTC (13 years, 8 months ago) by uberlord
Branch: MAIN
bump to push out the last few fixes
(Portage version: 2.1_pre10-r5)

1 uberlord 1.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.ebuild,v 1.2 2006/05/09 16:09:22 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="static selinux"
18    
19     RDEPEND="selinux? ( sec-policy/selinux-dhcp )
20     kernel_linux? ( sys-apps/net-tools )"
21     DEPEND="selinux? ( sec-policy/selinux-dhcp )
22     >=sys-apps/sed-4"
23    
24     PROVIDE="virtual/dhcpc"
25    
26     S="${WORKDIR}/${MY_P}"
27    
28     src_unpack() {
29     unpack ${A}
30     cd "${S}"
31    
32     # Gentoo patches - these will probably never be accepted upstream
33     # Enable chroot support
34     epatch "${FILESDIR}/${PN}-3.0-paranoia.patch"
35     # Fix some permission issues
36     epatch "${FILESDIR}/${PN}-3.0-fix-perms.patch"
37     # Enable dhclient to equery NTP servers
38     epatch "${FILESDIR}/${PN}-3.0.3-dhclient-ntp.patch"
39     # resolvconf support in dhclient-script
40     epatch "${FILESDIR}/${PN}-3.0.3-dhclient-resolvconf.patch"
41     # Fix setting hostnames on Linux
42     epatch "${FILESDIR}/${PN}-3.0.3-dhclient-hostname.patch"
43     # Allow mtu settings
44     epatch "${FILESDIR}/${PN}-3.0.3-dhclient-mtu.patch"
45     # Allow dhclient to use IF_METRIC to set route metrics
46     epatch "${FILESDIR}/${PN}-3.0.3-dhclient-metric.patch"
47     # Stop downing the interface on Linux as that breaks link dameons
48     # such as wpa_supplicant and netplug
49     epatch "${FILESDIR}/${PN}-3.0.3-dhclient-no-down.patch"
50     # Quiet the isc blurb
51     epatch "${FILESDIR}/${PN}-3.0.3-no_isc_blurb.patch"
52     # Enable dhclient to get extra configuration from stdin
53     epatch "${FILESDIR}/${PN}-3.0.4-dhclient-stdin-conf.patch"
54    
55     # General fixes which will probably be accepted upstream eventually
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    
61     # NetworkManager support patches
62     # If they fail to apply to future versions they will be dropped
63     # Enable eXtended options
64     epatch "${FILESDIR}/${PN}-3.0.3-x-option.patch"
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 -e '/^#define DHCP_VERSION[ \t]\+/ s/'"${MY_PV}/${newver}/g" \
73     includes/version.h
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/*
79    
80     # Remove these options from the sample config
81     sed -i -e "/\(script\|host-name\|domain-name\) / d" client/dhclient.conf
82    
83     # Build sed man pages as we don't ever support BSD 4.4 and older, #130251.
84     local x=
85     for x in Makefile.dist $(ls */Makefile.dist) ; do
86     sed -i -e 's/$(CATMANPAGES)/$(SEDMANPAGES)/g' "${x}"
87     done
88    
89     # Only install different man pages if we don't have en
90     if [[ " ${LINGUAS} " != *" en "* ]]; then
91     # Install Japanese man pages
92     if [[ " ${LINGUAS} " == *" ja "* && -d doc/ja_JP.eucJP ]]; then
93     einfo "Installing Japanese documention"
94     cp doc/ja_JP.eucJP/dhclient* client
95     cp doc/ja_JP.eucJP/dhcp* common
96     fi
97     fi
98    
99     # Now remove the non-english docs so there are no errors later
100     [[ -d doc/ja_JP.eucJP ]] && rm -rf doc/ja_JP.eucJP
101     }
102    
103     src_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
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     emake || die "compile problem"
142     }
143    
144     src_install() {
145     make install DESTDIR="${D}" || die
146    
147     insinto /etc/dhcp
148     newins server/dhcpd.conf dhcpd.conf.sample
149     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
163     }
164    
165     pkg_preinst() {
166     enewgroup dhcp
167     enewuser dhcp -1 -1 /var/lib/dhcp dhcp
168     }
169    
170     pkg_postinst() {
171     chown dhcp:dhcp "${ROOT}"/var/{lib,run}/dhcp
172    
173     if [[ -e "${ROOT}/etc/init.d/dhcp" ]] ; then
174     ewarn
175     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"
177     ewarn "and dhcp should be removed from the default runlevel"
178     ewarn
179     fi
180    
181     einfo "You can edit /etc/conf.d/dhcpd to customize dhcp settings."
182     einfo
183     einfo "If you would like to run dhcpd in a chroot, simply configure the"
184     einfo "DHCPD_CHROOT directory in /etc/conf.d/dhcpd and then run:"
185     einfo " emerge --config =${PF}"
186     }
187    
188     pkg_config() {
189     local CHROOT="$(
190     sed -n 's/^[[:blank:]]\?DHCPD_CHROOT="*\([^#"]\+\)"*/\1/p' \
191     /etc/conf.d/dhcpd
192     )"
193    
194     if [[ -z ${CHROOT} ]]; then
195     eerror "CHROOT not defined in /etc/conf.d/dhcpd"
196     return 1
197     fi
198    
199     if [[ -d ${CHROOT} ]] ; then
200     ewarn "${CHROOT} already exists - aborting"
201     return 0
202     fi
203    
204     ebegin "Setting up the chroot directory"
205     mkdir -m 0755 -p "${CHROOT}/"{dev,etc,var/lib,var/run/dhcp}
206     cp /etc/{localtime,resolv.conf} "${CHROOT}/etc"
207     cp -R /etc/dhcp "${CHROOT}/etc/"
208     cp -R /var/lib/dhcp "${CHROOT}/var/lib"
209     chown -R dhcp:dhcp "${CHROOT}"/var/{lib,run}/dhcp
210     eend
211    
212     local logger="$(best_version virtual/logger)"
213     einfo "To enable logging from the dhcpd server, configure your"
214     einfo "logger (${logger}) to listen on ${CHROOT}/dev/log"
215     }

  ViewVC Help
Powered by ViewVC 1.1.20