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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.14 - (show annotations) (download)
Wed Feb 22 13:12:20 2006 UTC (13 years, 9 months ago) by uberlord
Branch: MAIN
CVS Tags: HEAD
Changes since 1.13: +1 -1 lines
FILE REMOVED
Punt old version
(Portage version: 2.1_pre4-r1)

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.1-r1.ebuild,v 1.13 2005/12/21 14:18:30 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 LICENSE="isc-dhcp"
15 SLOT="0"
16 KEYWORDS="alpha amd64 arm hppa ~mips ppc ppc64 sparc x86"
17 IUSE="static selinux"
18
19 RDEPEND="virtual/libc
20 selinux? ( sec-policy/selinux-dhcp )"
21
22 DEPEND="${RDEPEND}
23 >=sys-apps/sed-4"
24
25 PROVIDE="virtual/dhcpc"
26
27 PATCHDIR=${WORKDIR}/patch
28
29 src_unpack() {
30 unpack ${A} && cd "${S}"
31
32 EPATCH_SUFFIX="patch" epatch ${PATCHDIR}
33 has noman ${FEATURES} && sed -i 's:nroff:echo:' */Makefile.dist
34 }
35
36 src_compile() {
37 # 01/Mar/2003: Fix for bug #11960 by Jason Wever <weeve@gentoo.org>
38 [ "${ARCH}" == "sparc" ] && filter-flags -O3 -O2 -O
39
40 use static && append-ldflags -static
41
42 cat <<-END >> includes/site.h
43 #define _PATH_DHCPD_CONF "/etc/dhcp/dhcpd.conf"
44 #define _PATH_DHCPD_PID "/var/run/dhcp/dhcpd.pid"
45 #define _PATH_DHCPD_DB "/var/lib/dhcp/dhcpd.leases"
46 #define _PATH_DHCLIENT_DB "/var/lib/dhcp/dhclient.leases"
47 #define DHCPD_LOG_FACILITY LOG_LOCAL1
48 END
49
50 cat <<-END > site.conf
51 CC = $(tc-getCC)
52 LFLAGS = ${LDFLAGS}
53 LIBDIR = /usr/lib
54 INCDIR = /usr/include
55 ETC = /etc/dhcp
56 VARDB = /var/lib/dhcp
57 VARRUN = /var/run/dhcp
58 ADMMANDIR = /usr/share/man/man8
59 FFMANDIR = /usr/share/man/man5
60 LIBMANDIR = /usr/share/man/man3
61 USRMANDIR = /usr/share/man/man1
62 END
63
64 ./configure \
65 --copts "-DPARANOIA -DEARLY_CHROOT ${CFLAGS}" \
66 || die "configure failed"
67
68 emake || die "compile problem"
69 }
70
71 src_install() {
72 make install DESTDIR="${D}" || die
73
74 insinto /etc/dhcp
75 newins server/dhcpd.conf dhcpd.conf.sample
76 newins client/dhclient.conf dhclient.conf.sample
77 dosed "s:/etc/dhclient-script:/etc/dhcp/dhclient-script:" \
78 /etc/dhcp/dhclient.conf.sample
79 mv "${D}/sbin/dhclient-script" "${D}/etc/dhcp/dhclient-script.sample"
80
81 dodoc ANONCVS CHANGES README RELNOTES doc/*
82 newdoc client/dhclient.conf dhclient.conf.sample
83 newdoc client/scripts/linux dhclient-script.sample
84 newdoc server/dhcpd.conf dhcpd.conf.sample
85
86 exeinto /etc/init.d
87 newexe "${FILESDIR}/dhcp.rc6" dhcp
88 newexe "${FILESDIR}/dhcrelay.rc6" dhcrelay
89 insinto /etc/conf.d
90 newins "${FILESDIR}/dhcp.conf" dhcp
91 newins "${FILESDIR}/dhcrelay.conf" dhcrelay
92
93 keepdir /var/{lib,run}/dhcp
94 }
95
96 pkg_preinst() {
97 enewgroup dhcp
98 enewuser dhcp -1 -1 /var/lib/dhcp dhcp
99 }
100
101 pkg_postinst() {
102 chown dhcp:dhcp "${ROOT}/var/lib/dhcp" "${ROOT}/var/run/dhcp"
103
104 einfo "You can edit /etc/conf.d/dhcp to customize dhcp settings"
105 einfo
106 einfo "The DHCP ebuild now includes chroot support."
107 einfo "If you like to run dhcpd in chroot AND this is a new install OR"
108 einfo "your dhcpd doesn't already run in chroot, simply run:"
109 einfo " emerge --config =${PF}"
110 einfo "Before running the above command you might want to change the chroot"
111 einfo "dir in /etc/conf.d/dhcp, otherwise /chroot/dhcp will be used."
112 echo
113 }
114
115 pkg_config() {
116 CHROOT=`sed -n 's/^[[:blank:]]\?CHROOT="\([^"]\+\)"/\1/p' /etc/conf.d/dhcp 2>/dev/null`
117
118 if [ ! -d "${CHROOT:=/chroot/dhcp}" ] ; then
119 ebegin "Setting up the chroot directory"
120 mkdir -m 0755 -p "${CHROOT}/"{dev,etc,var/lib,var/run/dhcp}
121 cp -R /etc/{localtime,dhcp} "${CHROOT}/etc/"
122 cp -R /var/lib/dhcp "${CHROOT}/var/lib"
123 chown -R dhcp:dhcp "${CHROOT}/var/lib" "${CHROOT}/var/run/dhcp"
124 eend
125
126 if [ "`grep '^#[[:blank:]]\?CHROOT' /etc/conf.d/dhcp`" ] ; then
127 sed -e '/^#[[:blank:]]\?CHROOT/s/^#[[:blank:]]\?//' \
128 -i /etc/conf.d/dhcp
129 fi
130
131 einfo "To enable logging from the DHCP server, configure your"
132 einfo "logger (`best_version virtual/logger`) to listen on ${CHROOT}/dev/log"
133 else
134 eerror
135 eerror "${CHROOT} already exists. Quitting."
136 eerror
137 fi
138 }

  ViewVC Help
Powered by ViewVC 1.1.20