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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (show annotations) (download)
Fri Feb 24 12:37:58 2006 UTC (13 years, 9 months ago) by uberlord
Branch: MAIN
CVS Tags: HEAD
Changes since 1.4: +1 -1 lines
FILE REMOVED
Punted old version.
(Portage version: 2.1_pre4-r1)

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_beta2-r1.ebuild,v 1.4 2006/02/23 13:04:07 uberlord Exp $
4
5 inherit eutils flag-o-matic multilib toolchain-funcs
6
7 DESCRIPTION="ISC Dynamic Host Configuration Protocol"
8 HOMEPAGE="http://www.isc.org/products/DHCP"
9
10 MY_PV="${PV//_beta/b}"
11 MY_P="${PN}-${MY_PV}"
12 SRC_URI="ftp://ftp.isc.org/isc/dhcp/${MY_P}.tar.gz"
13 S="${WORKDIR}/${MY_P}"
14
15 LICENSE="isc-dhcp"
16 SLOT="0"
17 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~mips ~ppc ~ppc64 ~sparc ~x86"
18 IUSE="static selinux"
19
20 RDEPEND="virtual/libc
21 selinux? ( sec-policy/selinux-dhcp )"
22 DEPEND="${RDEPEND}
23 >=sys-apps/sed-4"
24
25 PROVIDE="virtual/dhcpc"
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, fixed #63868
37 epatch "${FILESDIR}/${PN}-3.0.3-dhclient-ntp.patch"
38 # Quiet the isc blurb
39 epatch "${FILESDIR}/${PN}-3.0.3-no_isc_blurb.patch"
40
41 # General fixes which will probably be accepted upstream eventually
42 # Fix token ring compiling, #102473
43 epatch "${FILESDIR}/${PN}-3.0.3-libdst.patch"
44 # Fix building on Gentoo/FreeBSD
45 epatch "${FILESDIR}/${PN}-3.0.2-gmake.patch"
46
47 # Brand the version with Gentoo
48 # include revision if >0
49 local newver="${MY_PV}-Gentoo"
50 [[ ${PR} != "r0" ]] && newver="${newver}-${PR}"
51 sed -i -e '/^#define DHCP_VERSION[ \t]\+/ s/'"${MY_PV}/${newver}/g" \
52 includes/version.h
53
54 # Tart up the scripts for Gentoo baselayout
55 local comment="# This script is not called by Gentoo net scripts\n"
56 comment="${comment}# and is inluded purely for reference.\n"
57 comment="${comment}# We do however call /etc/dhcp/dhclient-exit-hooks\n"
58 sed -i -e '1 a '"${comment}" \
59 -e 's,/etc/dhclient-exit-hooks,/etc/dhcp/dhclient-exit-hooks,g' \
60 client/scripts/*
61
62 # Remove these options from the sample config as they conflict
63 # with baselayout network scripts
64 sed -i -e "/\(script\|host-name\|domain-name\) / d" client/dhclient.conf
65
66 # Only install different man pages if we don't have en
67 if [[ " ${LINGUAS} " != *" en "* ]]; then
68 # Install Japanese man pages
69 if [[ " ${LINGUAS} " == *" ja "* && -d doc/ja_JP.eucJP ]]; then
70 einfo "Installing Japanese documention"
71 cp doc/ja_JP.eucJP/dhclient* client
72 cp doc/ja_JP.eucJP/dhcp* common
73 fi
74 fi
75
76 # Now remove the non-english docs so there are no errors later
77 [[ -d doc/ja_JP.eucJP ]] && rm -rf doc/ja_JP.eucJP
78 }
79
80 src_compile() {
81 # 01/Mar/2003: Fix for bug #11960 by Jason Wever <weeve@gentoo.org>
82 [[ ${ARCH} == "sparc" ]] && filter-flags -O3 -O2 -O
83
84 use static && append-ldflags -static
85
86 cat <<-END >> includes/site.h
87 #define _PATH_DHCPD_CONF "/etc/dhcp/dhcpd.conf"
88 #define _PATH_DHCPD_PID "/var/run/dhcp/dhcpd.pid"
89 #define _PATH_DHCPD_DB "/var/lib/dhcp/dhcpd.leases"
90 #define _PATH_DHCLIENT_DB "/var/lib/dhcp/dhclient.leases"
91 #define DHCPD_LOG_FACILITY LOG_LOCAL1
92 END
93
94 cat <<-END > site.conf
95 CC = $(tc-getCC)
96 LFLAGS = ${LDFLAGS}
97 LIBDIR = /usr/$(get_libdir)
98 INCDIR = /usr/include
99 ETC = /etc/dhcp
100 VARDB = /var/lib/dhcp
101 VARRUN = /var/run/dhcp
102 ADMMANDIR = /usr/share/man/man8
103 FFMANDIR = /usr/share/man/man5
104 LIBMANDIR = /usr/share/man/man3
105 USRMANDIR = /usr/share/man/man1
106 END
107
108 ./configure --copts "-DPARANOIA -DEARLY_CHROOT ${CFLAGS}" \
109 || die "configure failed"
110
111 emake || die "compile problem"
112 }
113
114 src_install() {
115 make install DESTDIR="${D}" || die
116
117 insinto /etc/dhcp
118 newins server/dhcpd.conf dhcpd.conf.sample
119 newins client/dhclient.conf dhclient.conf.sample
120
121 dodoc README RELNOTES doc/*
122 newdoc client/dhclient.conf dhclient.conf.sample
123 newdoc client/scripts/linux dhclient-script.sample
124 newdoc server/dhcpd.conf dhcpd.conf.sample
125
126 newinitd "${FILESDIR}/dhcp.init" dhcp
127 newinitd "${FILESDIR}/dhcrelay.init" dhcrelay
128 insinto /etc/conf.d
129 newins "${FILESDIR}/dhcp.conf" dhcp
130 newins "${FILESDIR}/dhcrelay.conf" dhcrelay
131
132 keepdir /var/{lib,run}/dhcp
133 }
134
135 pkg_preinst() {
136 enewgroup dhcp
137 enewuser dhcp -1 -1 /var/lib/dhcp dhcp
138 }
139
140 pkg_postinst() {
141 chown dhcp:dhcp "${ROOT}"/var/{lib,run}/dhcp
142
143 einfo "You can edit /etc/conf.d/dhcp to customize dhcp settings."
144 einfo
145 einfo "The DHCP ebuild now includes chroot support."
146 einfo "If you would like to run dhcpd in a chroot, simply configure the"
147 einfo "CHROOT directory in /etc/conf.d/dhcp and then run:"
148 einfo " emerge --config =${PF}"
149 }
150
151 pkg_config() {
152 CHROOT="$(
153 sed -n 's/^[[:blank:]]\?CHROOT="*\([^#"]\+\)"*/\1/p' \
154 /etc/conf.d/dhcp
155 )"
156
157 if [[ -z ${CHROOT} ]]; then
158 eerror "CHROOT not defined in /etc/conf.d/dhcp"
159 return 1
160 fi
161
162 if [[ -d ${CHROOT} ]] ; then
163 ewarn "${CHROOT} already exists - aborting"
164 return 0
165 fi
166
167 ebegin "Setting up the chroot directory"
168 mkdir -m 0755 -p "${CHROOT}/"{dev,etc,var/lib,var/run/dhcp}
169 cp /etc/{localtime,resolv.conf} "${CHROOT}/etc"
170 cp -R /etc/dhcp "${CHROOT}/etc/"
171 cp -R /var/lib/dhcp "${CHROOT}/var/lib"
172 chown -R dhcp:dhcp "${CHROOT}"/var/{lib,run}/dhcp
173 eend
174
175 local logger="$(best_version virtual/logger)"
176 einfo "To enable logging from the DHCP server, configure your"
177 einfo "logger (${logger}) to listen on ${CHROOT}/dev/log"
178 }

  ViewVC Help
Powered by ViewVC 1.1.20