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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Wed Dec 7 13:59:32 2005 UTC (14 years ago) by uberlord
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +1 -1 lines
FILE REMOVED
  Split patches out into FILESDIR.
  Stop installing dhclient-script.sample as baselayout has its own.
  chroot creation no longer assumes a default directory.
  We copy resolv.conf and localtime as a real files into the chroot now.
  document resolv.conf in conf.d/dhcp for chroots, #113869.
  init script now parses dhcpd.conf for pidfile and leasefile locations, #89428.
  libdst.a gets installed now, #75544.

(Portage version: 2.0.53)

1 # Copyright 1999-2005 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.ebuild,v 1.1 2005/10/12 16:53:02 uberlord Exp $
4
5 inherit eutils flag-o-matic toolchain-funcs
6
7 PATCHVER=1
8
9 DESCRIPTION="ISC Dynamic Host Configuration Protocol"
10 HOMEPAGE="http://www.isc.org/products/DHCP"
11 SRC_URI="ftp://ftp.isc.org/isc/dhcp/${P}.tar.gz
12 mirror://gentoo/${PN}-3-gentoo-${PATCHVER}.tar.bz2"
13
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
23 DEPEND="${RDEPEND}
24 >=sys-apps/sed-4"
25
26 PROVIDE="virtual/dhcpc"
27
28 PATCHDIR=${WORKDIR}/patch
29
30 src_unpack() {
31 unpack ${A} && cd "${S}"
32
33 export EPATCH_SUFFIX="patch"
34 # 3.0.3 already has this patch
35 rm -f "${PATCHDIR}/003_all_dhcp-3.0.1-fix-invalid-attribute.patch"
36 epatch ${PATCHDIR}
37
38 has noman ${FEATURES} && sed -i 's:nroff:echo:' */Makefile.dist
39
40 # Enable dhclient to equery NTP servers, fixed #63868
41 epatch "${FILESDIR}/dhclient-ntp.patch"
42
43 # Fix token ring compiling
44 epatch "${FILESDIR}/${P}-tr.patch"
45
46 # FreeBSD doesn't like -Werror that is forced on
47 sed -i -e 's:-Werror::' Makefile.conf
48
49 epatch ${FILESDIR}/${PN}-3.0.2-gmake.patch
50 }
51
52 src_compile() {
53 # 01/Mar/2003: Fix for bug #11960 by Jason Wever <weeve@gentoo.org>
54 [ "${ARCH}" == "sparc" ] && filter-flags -O3 -O2 -O
55
56 use static && append-ldflags -static
57
58 cat <<-END >> includes/site.h
59 #define _PATH_DHCPD_CONF "/etc/dhcp/dhcpd.conf"
60 #define _PATH_DHCPD_PID "/var/run/dhcp/dhcpd.pid"
61 #define _PATH_DHCPD_DB "/var/lib/dhcp/dhcpd.leases"
62 #define _PATH_DHCLIENT_DB "/var/lib/dhcp/dhclient.leases"
63 #define DHCPD_LOG_FACILITY LOG_LOCAL1
64 END
65
66 cat <<-END > site.conf
67 CC = $(tc-getCC)
68 LFLAGS = ${LDFLAGS}
69 LIBDIR = /usr/lib
70 INCDIR = /usr/include
71 ETC = /etc/dhcp
72 VARDB = /var/lib/dhcp
73 VARRUN = /var/run/dhcp
74 ADMMANDIR = /usr/share/man/man8
75 FFMANDIR = /usr/share/man/man5
76 LIBMANDIR = /usr/share/man/man3
77 USRMANDIR = /usr/share/man/man1
78 END
79
80 ./configure \
81 --copts "-DPARANOIA -DEARLY_CHROOT ${CFLAGS}" \
82 || die "configure failed"
83
84 emake || die "compile problem"
85 }
86
87 src_install() {
88 make install DESTDIR="${D}" || die
89
90 insinto /etc/dhcp
91 newins server/dhcpd.conf dhcpd.conf.sample
92 newins client/dhclient.conf dhclient.conf.sample
93 dosed "s:/etc/dhclient-script:/etc/dhcp/dhclient-script:" \
94 /etc/dhcp/dhclient.conf.sample
95 mv "${D}/sbin/dhclient-script" "${D}/etc/dhcp/dhclient-script.sample"
96
97 dodoc ANONCVS CHANGES README RELNOTES doc/*
98 newdoc client/dhclient.conf dhclient.conf.sample
99 newdoc client/scripts/linux dhclient-script.sample
100 newdoc server/dhcpd.conf dhcpd.conf.sample
101
102 exeinto /etc/init.d
103 newexe "${FILESDIR}/dhcp.rc6" dhcp
104 newexe "${FILESDIR}/dhcrelay.rc6" dhcrelay
105 insinto /etc/conf.d
106 newins "${FILESDIR}/dhcp.conf" dhcp
107 newins "${FILESDIR}/dhcrelay.conf" dhcrelay
108
109 keepdir /var/{lib,run}/dhcp
110 }
111
112 pkg_preinst() {
113 enewgroup dhcp
114 enewuser dhcp -1 -1 /var/lib/dhcp dhcp
115 }
116
117 pkg_postinst() {
118 chown dhcp:dhcp "${ROOT}/var/lib/dhcp" "${ROOT}/var/run/dhcp"
119
120 einfo "You can edit /etc/conf.d/dhcp to customize dhcp settings"
121 einfo
122 einfo "The DHCP ebuild now includes chroot support."
123 einfo "If you like to run dhcpd in chroot AND this is a new install OR"
124 einfo "your dhcpd doesn't already run in chroot, simply run:"
125 einfo " ebuild /var/db/pkg/${CATEGORY}/${PF}/${PF}.ebuild config"
126 einfo "Before running the above command you might want to change the chroot"
127 einfo "dir in /etc/conf.d/dhcp, otherwise /chroot/dhcp will be used."
128 echo
129 }
130
131 pkg_config() {
132 CHROOT=`sed -n 's/^[[:blank:]]\?CHROOT="\([^"]\+\)"/\1/p' /etc/conf.d/dhcp 2>/dev/null`
133
134 if [ ! -d "${CHROOT:=/chroot/dhcp}" ] ; then
135 ebegin "Setting up the chroot directory"
136 mkdir -m 0755 -p "${CHROOT}/"{dev,etc,var/lib,var/run/dhcp}
137 cp -R /etc/{localtime,dhcp} "${CHROOT}/etc/"
138 cp -R /var/lib/dhcp "${CHROOT}/var/lib"
139 chown -R dhcp:dhcp "${CHROOT}/var/lib" "${CHROOT}/var/run/dhcp"
140 eend
141
142 if [ "`grep '^#[[:blank:]]\?CHROOT' /etc/conf.d/dhcp`" ] ; then
143 sed -e '/^#[[:blank:]]\?CHROOT/s/^#[[:blank:]]\?//' \
144 -i /etc/conf.d/dhcp
145 fi
146
147 einfo "To enable logging from the DHCP server, configure your"
148 einfo "logger (`best_version virtual/logger`) to listen on ${CHROOT}/dev/log"
149 else
150 eerror
151 eerror "${CHROOT} already exists. Quitting."
152 eerror
153 fi
154 }

  ViewVC Help
Powered by ViewVC 1.1.20