net-misc/dhcp: add security fixed versions of dhcp ldap

git-svn-id: https://svn.disconnected-by-peer.at/svn/linamh/trunk/mds@1425 6952d904-891a-0410-993b-d76249ca496b
This commit is contained in:
geos_one 2009-07-29 08:46:26 +00:00
parent 98a1b41212
commit ab30e16159
5 changed files with 764 additions and 1 deletions

View File

@ -2,6 +2,14 @@
# Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2
# $Header: /var/cvsroot/gentoo-x86/net-misc/dhcp/ChangeLog,v 1.154 2009/05/29 23:30:28 vapier Exp $
*dhcp-4.1.0_p1 (29 Jul 2009)
*dhcp-4.0.1_p1 (29 Jul 2009)
*dhcp-3.1.2_p1 (29 Jul 2009)
29 Jul 2009; Mario Fetka <mario.fetka@gmail.com> +dhcp-3.1.2_p1.ebuild,
+dhcp-4.0.1_p1.ebuild, +dhcp-4.1.0_p1.ebuild:
add security fixed versions of dhcp ldap
08 Jul 2009; Mario Fetka <mario.fetka@gmail.com> dhcp-3.1.2.ebuild,
dhcp-4.0.1.ebuild, dhcp-4.1.0.ebuild, files/dhcpd.init:
correct same small bugs

View File

@ -30,13 +30,19 @@ AUX dhcpd.init 2502 RMD160 145e70595121d83596e5eea07b0397023ee37b7f SHA1 27289d2
AUX dhcrelay.conf 421 RMD160 456edbc9bcc8d3a44db5bb6dbf0c3003c3e7419c SHA1 78ecdb000382893fb49d0052ced063955b0ad9cf SHA256 409b895ed489e75c1a08f72961b45d641b93fd9357f528abc78b1fd036b7f730
AUX dhcrelay.init 736 RMD160 04566b87bd6dbb8bb754b26409ca30b878ef3ca3 SHA1 72742b308314b2e1476b27e94212fbf4d179adc4 SHA256 cfdaff3a723be3935d06c14e171d4008f2ad3329bd05ac2e49c19bc0e14bc59c
DIST dhcp-3.1.2.tar.gz 799626 RMD160 026ac48b176ec273397fafa8a834a21fd6331681 SHA1 a60cccec2402a35025ddaafc8ac896595188560e SHA256 80daba1e4ac220a0945778aa3c1c9eb7860c4426645660bebb8ed35a3231a2fb
DIST dhcp-3.1.2p1.tar.gz 792355 RMD160 53434f8404c69e8e113cad030ec975cf13b467cc SHA1 730214fa6e70d187f1492aa3d4f1c2868ffcc8de SHA256 e0cb405e0fef0ecebec7aaed294032a06178ff28be87498596e6069ccda4341e
DIST dhcp-4.0.1.tar.gz 1050570 RMD160 a9764a76d105778362fe4b58e77783331ee3448a SHA1 7d813740ab4a64e474f1c01b1395617987532ed1 SHA256 965d09a7759250eff7d6d06d37425ea085c14edb5b405f8357ef5ec72ded28ef
DIST dhcp-4.0.1p1.tar.gz 1033534 RMD160 a05d66cc689560b6624cdde23e50627ab3f4f42d SHA1 4bcb01c72f3e9ee18e202f0b69bbce8da8ffb6ff SHA256 da57542a6bfb54a2f7fcfa07d275a04c5ca6bdd6fe4e5e6c0e60512bc6ab8bd2
DIST dhcp-4.1.0.tar.gz 1086815 RMD160 bf96fa9d135a65b4d9b27f8caf4f3744f0636c80 SHA1 46e161892140a3b60cd56e62b442f48f51bc605f SHA256 688741e970410efdb177513550f8cd1ee52032eb109313ab316a852f40310914
DIST dhcp-4.1.0p1.tar.gz 1073227 RMD160 ac8472946615e2a45a8e8a64474d437f328d5439 SHA1 71cd106f518283f6af55d3a6006b7e8f34ffe0e0 SHA256 ffcc98bd3b756d1ba8a565cc7bf604755e25da7e193b3c5273f668ca96318946
DIST ldap-for-dhcp-3.1.2-2.tar.gz 39752 RMD160 96d2f469b1349485c0202012697222911b81abe8 SHA1 023d12eeb148ad493e252edbfd112d19c9d0cecd SHA256 afd30a30d72a17a4d8ae1a27c247711f03b30b5e270bdcf9f521695b55b28db7
DIST ldap-for-dhcp-4.0.1-3.tar.gz 39117 RMD160 977ec08ec0213e1a53d0dd5b3b08a234172dbd22 SHA1 8bc692bb2017c1b5ff35d73c10e5a2e4ed44e559 SHA256 161f5cd479ba0789d139ef59d101244fa7c880c3d1c13cbbbbae978004a30a18
DIST ldap-for-dhcp-4.1.0-4.tar.gz 39175 RMD160 a9e31099bb971bdba0e78b80130f539ccc5eed0b SHA1 1c37ebf531b6a0bc358edc6f3e31b57bfe88dd8e SHA256 1088f0c0b2c7d8cc543eb0d34e655690a6efaec7eca85df3e28c06a2c456780b
EBUILD dhcp-3.1.2.ebuild 8466 RMD160 3a49e7318d635a5ef940d2765832cfa133fe77d3 SHA1 9895117cd684d340ef9cdf8a7a924b77ffcfdb64 SHA256 5b2a6adc4c5ba199ba4bf57b2edf98b6788396c5c99587d0607cd4cccb28ca10
EBUILD dhcp-3.1.2_p1.ebuild 8489 RMD160 659d3f81fb9c920d47e65f2870e02eba93577d69 SHA1 fdb52c4412a22a8abb3c622664c58c7282e6db31 SHA256 d4a86105aa84c816c70ee85491131270560073b5f79bbeae8dd15e657075a65b
EBUILD dhcp-4.0.1.ebuild 7618 RMD160 004c49cda2fe8bc65f715748fe6b91d6ef27d9ef SHA1 5119917732b3c9be442085cc757914bb2b7b5f42 SHA256 d44301b743ecfa8edd846bc8ceba53571063c6293dcd188552bc912d4c627687
EBUILD dhcp-4.0.1_p1.ebuild 7641 RMD160 5e18f9ce9e2ea046d5a4075add0451ee6db11337 SHA1 13200a619a95efaf423bb4b31525b78e63f94bdb SHA256 60c5367c063edf9bd2608faa4dd2ffc8b3e916dfeb2eac695d036303596d84be
EBUILD dhcp-4.1.0.ebuild 7546 RMD160 866e84089e01e0af7e3c786eff03a610cf4f0e77 SHA1 747648419e1ba0ce3b9746ee7171209df09be541 SHA256 e253fae73db8f3ecd0530820b97442b5cfee6bc148a297aa36df5f93f8bc6a6d
MISC ChangeLog 28591 RMD160 fddea43ba6ef158494f448ed06895aa1ec03b594 SHA1 9d31a3a1bcf314db8cead4d14297590d3cc05941 SHA256 a426f89766b693a1f7b05c5bf7c640b905fca155090f18ca7373c6fded4242c2
EBUILD dhcp-4.1.0_p1.ebuild 7569 RMD160 a70df04a204179849393d09af0794be9864adfac SHA1 293974e0b82c0c49d5b7d2c79b29bf065a95018f SHA256 478d16d63f5bc01d42497666f2d8211dd3af65384353760a62798afaf099dc9d
MISC ChangeLog 28845 RMD160 d04f2afbbbb55644f830f919863df544605c3bd2 SHA1 23b865ba3a11d6e8bc92dac628deb02cf2cab97c SHA256 e60797edd3d981ec9d030be705ca9f140a003ecf84f1f89a8738d64c9c1ee65f
MISC metadata.xml 358 RMD160 97ecd4b6ee0a24352a71a66d5ad4fd82481156b4 SHA1 d80da2cf7c6892cdad6b681fda29e46472d68871 SHA256 8665f24cdfcc09576b595f8bd257333ff5f9ea7ee0ca2925ba6fb74d90e12415

View File

@ -0,0 +1,269 @@
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-misc/dhcp/dhcp-3.1.1.ebuild,v 1.9 2008/11/05 00:41:46 vapier Exp $
inherit eutils flag-o-matic multilib toolchain-funcs
LDAP_PV="3.1.2-2"
MY_PV="${PV//_alpha/a}"
MY_PV="${MY_PV//_beta/b}"
MY_PV="${MY_PV//_rc/rc}"
MY_PV="${MY_PV//_p/p}"
MY_P="${PN}-${MY_PV}"
MY_LDAP_PV="${LDAP_PV//-*/}"
DESCRIPTION="ISC Dynamic Host Configuration Protocol"
HOMEPAGE="http://www.isc.org/products/DHCP"
SRC_URI="ftp://ftp.isc.org/isc/dhcp/${MY_P}.tar.gz
ldap? ( http://cloud.github.com/downloads/dcantrell/ldap-for-dhcp/ldap-for-dhcp-${LDAP_PV}.tar.gz
http://ftp.mars.arge.at/pub/ldap-for-dhcp-${LDAP_PV}.tar.gz )"
LICENSE="isc-dhcp"
SLOT="0"
KEYWORDS="alpha amd64 arm hppa ~mips ppc ppc64 s390 sh sparc ~sparc-fbsd x86 ~x86-fbsd"
IUSE="doc minimal static selinux kernel_linux ldap"
DEPEND="selinux? ( sec-policy/selinux-dhcp )
kernel_linux? ( sys-apps/net-tools )
ldap? ( net-nds/openldap
dev-libs/openssl )"
PROVIDE="virtual/dhcpc"
S="${WORKDIR}/${MY_P}"
src_unpack() {
unpack ${A}
cd "${S}"
# Gentoo patches - these will probably never be accepted upstream
# Enable chroot support
epatch "${FILESDIR}/${PN}"-3.0-paranoia.patch
# Fix some permission issues
epatch "${FILESDIR}/${PN}"-3.0-fix-perms.patch
# Enable dhclient to equery NTP servers
epatch "${FILESDIR}/${PN}"-3.0.3-dhclient-ntp.patch
# resolvconf support in dhclient-script
epatch "${FILESDIR}/${PN}"-3.1.0a1-dhclient-resolvconf.patch
# Fix setting hostnames on Linux
epatch "${FILESDIR}/${PN}"-3.0.3-dhclient-hostname.patch
# Allow mtu settings
epatch "${FILESDIR}/${PN}"-3.0.3-dhclient-mtu.patch
# Allow dhclient to use IF_METRIC to set route metrics
epatch "${FILESDIR}/${PN}"-3.0.3-dhclient-metric.patch
# Stop downing the interface on Linux as that breaks link dameons
# such as wpa_supplicant and netplug
epatch "${FILESDIR}/${PN}"-3.0.3-dhclient-no-down.patch
# Quiet the isc blurb
epatch "${FILESDIR}/${PN}"-3.0.3-no_isc_blurb.patch
# Enable dhclient to get extra configuration from stdin
epatch "${FILESDIR}/${PN}"-3.0.4-dhclient-stdin-conf.patch
# Disable fallback interfaces when using BPF
# This allows more than one dhclient instance on the BSD's
epatch "${FILESDIR}/${PN}"-3.0.5-bpf-nofallback.patch
# General fixes which will probably be accepted upstream eventually
# Install libdst, #75544
epatch "${FILESDIR}/${PN}"-3.0.3-libdst.patch
# Fix building on Gentoo/FreeBSD
epatch "${FILESDIR}/${PN}"-3.0.2-gmake.patch
# NetworkManager support patches
# If they fail to apply to future versions they will be dropped
# Add dbus support to dhclient
epatch "${FILESDIR}/${PN}"-3.0.3-dhclient-dbus.patch
# Ldap patch for dhcp
# buggy build system so don*t patch when no ldap build
use ldap && epatch "${WORKDIR}/ldap-for-dhcp-${LDAP_PV}/dhcp-${MY_LDAP_PV}"-ldap.patch
# Brand the version with Gentoo
# include revision if >0
local newver="${MY_PV}-Gentoo"
[[ ${PR} != "r0" ]] && newver="${newver}-${PR}"
sed -i '/^#define DHCP_VERSION[ \t]\+/ s/'"${MY_PV}/${newver}/g" \
includes/version.h || die
# Change the hook script locations of the scripts
sed -i -e 's,/etc/dhclient-exit-hooks,/etc/dhcp/dhclient-exit-hooks,g' \
-e 's,/etc/dhclient-enter-hooks,/etc/dhcp/dhclient-enter-hooks,g' \
client/scripts/* || die
# No need for the linux script to force bash, #158540.
sed -i -e 's,#!/bin/bash,#!/bin/sh,' client/scripts/linux || die
# Quiet the freebsd logger a little
sed -i -e '/LOGGER=/ s/-s -p user.notice //g' client/scripts/freebsd || die
# Remove these options from the sample config
sed -i -e "/\(script\|host-name\|domain-name\) / d" \
client/dhclient.conf || die
# Build sed man pages as we don't ever support BSD 4.4 and older, #130251.
local x=
for x in Makefile.dist $(ls */Makefile.dist) ; do
sed -i -e 's/$(CATMANPAGES)/$(SEDMANPAGES)/g' "${x}" || die
done
# Only install different man pages if we don't have en
if [[ " ${LINGUAS} " != *" en "* ]]; then
# Install Japanese man pages
if [[ " ${LINGUAS} " == *" ja "* && -d doc/ja_JP.eucJP ]]; then
einfo "Installing Japanese documention"
cp doc/ja_JP.eucJP/dhclient* client
cp doc/ja_JP.eucJP/dhcp* common
fi
fi
# Now remove the non-english docs so there are no errors later
[[ -d doc/ja_JP.eucJP ]] && rm -rf doc/ja_JP.eucJP
}
src_compile() {
use static && append-ldflags -static
cat <<-END >> includes/site.h
#define _PATH_DHCPD_CONF "/etc/dhcp/dhcpd.conf"
#define _PATH_DHCPD_PID "/var/run/dhcp/dhcpd.pid"
#define _PATH_DHCPD_DB "/var/lib/dhcp/dhcpd.leases"
#define _PATH_DHCLIENT_CONF "/etc/dhcp/dhclient.conf"
#define _PATH_DHCLIENT_DB "/var/lib/dhcp/dhclient.leases"
#define _PATH_DHCLIENT_PID "/var/run/dhcp/dhclient.pid"
#define DHCPD_LOG_FACILITY LOG_LOCAL1
END
if use ldap ; then
echo "#define LDAP_CONFIGURATION" >> includes/site.h
echo "#define USE_SSL" >> includes/site.h
fi
cat <<-END > site.conf
CC = $(tc-getCC)
LFLAGS = ${LDFLAGS}
LIBDIR = /usr/$(get_libdir)
INCDIR = /usr/include
ETC = /etc/dhcp
VARDB = /var/lib/dhcp
VARRUN = /var/run/dhcp
ADMMANDIR = /usr/share/man/man8
ADMMANEXT = .8
FFMANDIR = /usr/share/man/man5
FFMANEXT = .5
LIBMANDIR = /usr/share/man/man3
LIBMANEXT = .3
USRMANDIR = /usr/share/man/man1
USRMANEXT = .1
MANCAT = man
END
if use ldap ; then
echo "LDAPLIB = -lldap" >> site.conf
echo "SSLLIB = -lcrypto -lssl" >> site.conf
fi
./configure --copts "-DPARANOIA -DEARLY_CHROOT ${CFLAGS}" \
|| die "configure failed"
# Remove server support from the Makefile
# We still install some extra crud though
if use minimal ; then
sed -i -e 's/\(server\|relay\|dhcpctl\)/ /g' work.*/Makefile || die
fi
emake || die "compile problem"
}
src_install() {
make install DESTDIR="${D}" || die
if use doc; then
dodoc README RELNOTES doc/*
use ldap && dodoc "${WORKDIR}/ldap-for-dhcp-${LDAP_PV}"/*.ldap "${WORKDIR}/ldap-for-dhcp-${LDAP_PV}"/draft-ietf-dhc-ldap-schema-01.txt
fi
insinto /etc/dhcp
newins client/dhclient.conf dhclient.conf.sample
keepdir /var/{lib,run}/dhcp
keepdir /var/lib/dhclient
# Install our server files
if ! use minimal ; then
insinto /etc/dhcp
newins server/dhcpd.conf dhcpd.conf.sample
newinitd "${FILESDIR}"/dhcpd.init dhcpd
newinitd "${FILESDIR}"/dhcrelay.init dhcrelay
newconfd "${FILESDIR}"/dhcpd.conf dhcpd
newconfd "${FILESDIR}"/dhcrelay.conf dhcrelay
# install ldap files
if use ldap; then
insinto /etc/openldap/schema
doins "${WORKDIR}/ldap-for-dhcp-${LDAP_PV}"/dhcp.*
dosbin "${WORKDIR}/ldap-for-dhcp-${LDAP_PV}"/dhcpd-conf-to-ldap
fi
# We never want portage to own this file
rm -f "${D}"/var/lib/dhcp/dhcpd.leases
fi
}
pkg_preinst() {
if ! use minimal ; then
enewgroup dhcp
enewuser dhcp -1 -1 /var/lib/dhcp dhcp
fi
}
pkg_postinst() {
use minimal && return
chown dhcp:dhcp "${ROOT}"/var/{lib,run}/dhcp
if [[ -e "${ROOT}"/etc/init.d/dhcp ]] ; then
ewarn
ewarn "WARNING: The dhcp init script has been renamed to dhcpd"
ewarn "/etc/init.d/dhcp and /etc/conf.d/dhcp need to be removed and"
ewarn "and dhcp should be removed from the default runlevel"
ewarn
fi
einfo "You can edit /etc/conf.d/dhcpd to customize dhcp settings."
einfo
einfo "If you would like to run dhcpd in a chroot, simply configure the"
einfo "DHCPD_CHROOT directory in /etc/conf.d/dhcpd and then run:"
einfo " emerge --config =${PF}"
}
pkg_config() {
if use minimal ; then
eerror "${PN} has not been compiled for server support"
eerror "emerge ${PN} without the minimal USE flag to use dhcp sever"
return 1
fi
local CHROOT="$(
sed -n -e 's/^[[:blank:]]\?DHCPD_CHROOT="*\([^#"]\+\)"*/\1/p' \
"${ROOT}"/etc/conf.d/dhcpd
)"
if [[ -z ${CHROOT} ]]; then
eerror "CHROOT not defined in /etc/conf.d/dhcpd"
return 1
fi
CHROOT="${ROOT}/${CHROOT}"
if [[ -d ${CHROOT} ]] ; then
ewarn "${CHROOT} already exists - aborting"
return 0
fi
ebegin "Setting up the chroot directory"
mkdir -m 0755 -p "${CHROOT}/"{dev,etc,var/lib,var/run/dhcp}
cp /etc/{localtime,resolv.conf} "${CHROOT}"/etc
cp -R /etc/dhcp "${CHROOT}"/etc
cp -R /var/lib/dhcp "${CHROOT}"/var/lib
ln -s ../../var/lib/dhcp "${CHROOT}"/etc/dhcp/lib
chown -R dhcp:dhcp "${CHROOT}"/var/{lib,run}/dhcp
eend 0
local logger="$(best_version virtual/logger)"
einfo "To enable logging from the dhcpd server, configure your"
einfo "logger (${logger}) to listen on ${CHROOT}/dev/log"
}

View File

@ -0,0 +1,241 @@
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-misc/dhcp/dhcp-4.0.1.ebuild,v 1.1 2009/03/30 13:13:28 chainsaw Exp $
inherit eutils flag-o-matic autotools
LDAP_PV="4.0.1-3"
MY_PV="${PV//_alpha/a}"
MY_PV="${MY_PV//_beta/b}"
MY_PV="${MY_PV//_rc/rc}"
MY_PV="${MY_PV//_p/p}"
MY_P="${PN}-${MY_PV}"
MY_LDAP_PV="${LDAP_PV//-*/}"
DESCRIPTION="ISC Dynamic Host Configuration Protocol"
HOMEPAGE="http://www.isc.org/products/DHCP"
SRC_URI="ftp://ftp.isc.org/isc/dhcp/${MY_P}.tar.gz
http://cloud.github.com/downloads/dcantrell/ldap-for-dhcp/ldap-for-dhcp-${LDAP_PV}.tar.gz
http://ftp.mars.arge.at/pub/ldap-for-dhcp-${LDAP_PV}.tar.gz"
LICENSE="isc-dhcp"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~sparc-fbsd ~x86 ~x86-fbsd"
IUSE="doc ipv6 selinux kernel_linux vim-syntax ldap ssl"
DEPEND="selinux? ( sec-policy/selinux-dhcp )
kernel_linux? ( sys-apps/net-tools )
vim-syntax? ( app-vim/dhcpd-syntax )
ldap? ( net-nds/openldap
ssl? ( dev-libs/openssl ) )"
PROVIDE="virtual/dhcpc"
S="${WORKDIR}/${MY_P}"
src_unpack() {
unpack ${A}
cd "${S}"
# Gentoo patches - these will probably never be accepted upstream
# Enable chroot support
epatch "${FILESDIR}/${PN}"-4.0-paranoia.patch
# Fix some permission issues
epatch "${FILESDIR}/${PN}"-3.0-fix-perms.patch
# Enable dhclient to equery NTP servers
epatch "${FILESDIR}/${PN}"-4.0-dhclient-ntp.patch
# resolvconf support in dhclient-script
epatch "${FILESDIR}/${PN}"-4.0-dhclient-resolvconf.patch
# Fix setting hostnames on Linux
epatch "${FILESDIR}/${PN}"-3.0.3-dhclient-hostname.patch
# Allow mtu settings
epatch "${FILESDIR}/${PN}"-3.0.3-dhclient-mtu.patch
# Allow dhclient to use IF_METRIC to set route metrics
epatch "${FILESDIR}/${PN}"-4.0-dhclient-metric.patch
# Stop downing the interface on Linux as that breaks link daemons
# such as wpa_supplicant and netplug
epatch "${FILESDIR}/${PN}"-3.0.3-dhclient-no-down.patch
# Quiet the isc blurb
epatch "${FILESDIR}/${PN}"-4.0-no_isc_blurb.patch
# Enable dhclient to get extra configuration from stdin
epatch "${FILESDIR}/${PN}"-4.0.1-dhclient-stdin-conf.patch
# Disable fallback interfaces when using BPF
# This allows more than one dhclient instance on the BSD's
epatch "${FILESDIR}/${PN}"-3.0.5-bpf-nofallback.patch
# This allows the software to actually compile on linux
epatch "${FILESDIR}/${PN}"-4.0-linux-ipv6-header.patch
# Consistent style for the if statements, also resolves
# unary operator expected warnings (new style is wrong).
epatch "${FILESDIR}/${PN}"-4.0-dhclient-script-correct-operators.patch
# NetworkManager support patches
# If they fail to apply to future versions they will be dropped
# Add dbus support to dhclient
epatch "${FILESDIR}/${PN}"-3.0.3-dhclient-dbus.patch
# Ldap patch for dhcp
epatch "${WORKDIR}/ldap-for-dhcp-${LDAP_PV}/dhcp-${MY_LDAP_PV}"-ldap.patch
# Brand the version with Gentoo
# include revision if >0
local newver="Gentoo"
[[ ${PR} != "r0" ]] && newver="${newver}-${PR}"
sed -i "/AC_INIT/s/\(\[[0-9]\+\.[0-9]\+\.[0-9]\+\)/\1-${newver}/" \
configure.ac || die
# Change the hook script locations of the scripts
sed -i -e 's,/etc/dhclient-exit-hooks,/etc/dhcp/dhclient-exit-hooks,g' \
-e 's,/etc/dhclient-enter-hooks,/etc/dhcp/dhclient-enter-hooks,g' \
client/scripts/* || die
# No need for the linux script to force bash, #158540.
sed -i -e 's,#!/bin/bash,#!/bin/sh,' client/scripts/linux || die
# Quiet the freebsd logger a little
sed -i -e '/LOGGER=/ s/-s -p user.notice //g' client/scripts/freebsd || die
# Remove these options from the sample config
sed -i -e "/\(script\|host-name\|domain-name\) / d" \
client/dhclient.conf || die
# Only install different man pages if we don't have en
if [[ " ${LINGUAS} " != *" en "* ]]; then
# Install Japanese man pages
if [[ " ${LINGUAS} " == *" ja "* && -d doc/ja_JP.eucJP ]]; then
einfo "Installing Japanese documention"
cp doc/ja_JP.eucJP/dhclient* client
cp doc/ja_JP.eucJP/dhcp* common
fi
fi
# Now remove the non-english docs so there are no errors later
[[ -d doc/ja_JP.eucJP ]] && rm -rf doc/ja_JP.eucJP
eautoreconf
}
src_compile() {
myconf=""
if use ldap; then
myconf="${myconf} --with-ldap"
use ssl && myconf="${myconf} --with-ldapcrypto"
fi
econf \
--enable-paranoia \
--sysconfdir /etc/dhcp \
--with-cli-pid-file=/var/run/dhcp/dhclient.pid \
--with-cli-lease-file=/var/lib/dhcp/dhclient.leases \
--with-srv-pid-file=/var/run/dhcp/dhcpd.pid \
--with-srv-lease-file=/var/lib/dhcp/dhcpd.leases \
--with-relay-pid-file=/var/run/dhcp/dhcrelay.pid \
$(use_enable ipv6 dhcpv6) \
${myconf} \
|| die
emake || die "compile problem"
}
src_install() {
for installdir in includes tests common minires dst omapip client dhcpctl relay server; do
cd "${S}/${installdir}"
if [ "${installdir}" == client ]; then
make install DESTDIR="${D}" exec_prefix="" || die
else
make install DESTDIR="${D}" exec_prefix="/usr" || die
fi
done
cd "${S}"
exeinto /sbin
if use kernel_linux; then
newexe "${S}"/client/scripts/linux dhclient-script
else
newexe "${S}"/client/scripts/freebsd dhclient-script
fi
if use doc; then
dodoc README RELNOTES doc/*
use ldap && dodoc "${WORKDIR}/ldap-for-dhcp-${LDAP_PV}"/*.ldap "${WORKDIR}/ldap-for-dhcp-${LDAP_PV}"/draft-ietf-dhc-ldap-schema-01.txt
fi
insinto /etc/dhcp
newins client/dhclient.conf dhclient.conf.sample
keepdir /var/{lib,run}/dhcp
keepdir /var/lib/dhclient
# Install our server files
insinto /etc/dhcp
newins server/dhcpd.conf dhcpd.conf.sample
newinitd "${FILESDIR}"/dhcpd.init dhcpd
newinitd "${FILESDIR}"/dhcrelay.init dhcrelay
newconfd "${FILESDIR}"/dhcpd.conf dhcpd
newconfd "${FILESDIR}"/dhcrelay.conf dhcrelay
# install ldap files
if use ldap; then
insinto /etc/openldap/schema
doins "${WORKDIR}/ldap-for-dhcp-${LDAP_PV}"/dhcp.*
dosbin "${WORKDIR}/ldap-for-dhcp-${LDAP_PV}"/dhcpd-conf-to-ldap
fi
# We never want portage to own this file
rm -f "${D}"/var/lib/dhcp/dhcpd.leases
}
pkg_preinst() {
enewgroup dhcp
enewuser dhcp -1 -1 /var/lib/dhcp dhcp
}
pkg_postinst() {
chown dhcp:dhcp "${ROOT}"/var/{lib,run}/dhcp
if [[ -e "${ROOT}"/etc/init.d/dhcp ]] ; then
ewarn
ewarn "WARNING: The dhcp init script has been renamed to dhcpd"
ewarn "/etc/init.d/dhcp and /etc/conf.d/dhcp need to be removed and"
ewarn "and dhcp should be removed from the default runlevel"
ewarn
fi
einfo "You can edit /etc/conf.d/dhcpd to customize dhcp settings."
einfo
einfo "If you would like to run dhcpd in a chroot, simply configure the"
einfo "DHCPD_CHROOT directory in /etc/conf.d/dhcpd and then run:"
einfo " emerge --config =${PF}"
}
pkg_config() {
local CHROOT="$(
sed -n -e 's/^[[:blank:]]\?DHCPD_CHROOT="*\([^#"]\+\)"*/\1/p' \
"${ROOT}"/etc/conf.d/dhcpd
)"
if [[ -z ${CHROOT} ]]; then
eerror "CHROOT not defined in /etc/conf.d/dhcpd"
return 1
fi
CHROOT="${ROOT}/${CHROOT}"
if [[ -d ${CHROOT} ]] ; then
ewarn "${CHROOT} already exists - aborting"
return 0
fi
ebegin "Setting up the chroot directory"
mkdir -m 0755 -p "${CHROOT}/"{dev,etc,var/lib,var/run/dhcp}
cp /etc/{localtime,resolv.conf} "${CHROOT}"/etc
cp -R /etc/dhcp "${CHROOT}"/etc
cp -R /var/lib/dhcp "${CHROOT}"/var/lib
ln -s ../../var/lib/dhcp "${CHROOT}"/etc/dhcp/lib
chown -R dhcp:dhcp "${CHROOT}"/var/{lib,run}/dhcp
eend 0
local logger="$(best_version virtual/logger)"
einfo "To enable logging from the dhcpd server, configure your"
einfo "logger (${logger}) to listen on ${CHROOT}/dev/log"
}

View File

@ -0,0 +1,239 @@
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-misc/dhcp/dhcp-4.0.1.ebuild,v 1.1 2009/03/30 13:13:28 chainsaw Exp $
inherit eutils flag-o-matic autotools
LDAP_PV="4.1.0-4"
MY_PV="${PV//_alpha/a}"
MY_PV="${MY_PV//_beta/b}"
MY_PV="${MY_PV//_rc/rc}"
MY_PV="${MY_PV//_p/p}"
MY_P="${PN}-${MY_PV}"
MY_LDAP_PV="${LDAP_PV//-*/}"
DESCRIPTION="ISC Dynamic Host Configuration Protocol"
HOMEPAGE="http://www.isc.org/products/DHCP"
SRC_URI="ftp://ftp.isc.org/isc/dhcp/${MY_P}.tar.gz
http://cloud.github.com/downloads/dcantrell/ldap-for-dhcp/ldap-for-dhcp-${LDAP_PV}.tar.gz
http://ftp.mars.arge.at/pub/ldap-for-dhcp-${LDAP_PV}.tar.gz"
LICENSE="isc-dhcp"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~sparc-fbsd ~x86 ~x86-fbsd"
IUSE="doc ipv6 selinux kernel_linux vim-syntax ldap ssl"
DEPEND="selinux? ( sec-policy/selinux-dhcp )
kernel_linux? ( sys-apps/net-tools )
vim-syntax? ( app-vim/dhcpd-syntax )
ldap? ( net-nds/openldap
ssl? ( dev-libs/openssl ) )"
PROVIDE="virtual/dhcpc"
S="${WORKDIR}/${MY_P}"
src_unpack() {
unpack ${A}
cd "${S}"
# Gentoo patches - these will probably never be accepted upstream
# Fix some permission issues
epatch "${FILESDIR}/${PN}"-3.0-fix-perms.patch
# Enable dhclient to equery NTP servers
epatch "${FILESDIR}/${PN}"-4.0-dhclient-ntp.patch
# resolvconf support in dhclient-script
epatch "${FILESDIR}/${PN}"-4.0-dhclient-resolvconf.patch
# Fix setting hostnames on Linux
epatch "${FILESDIR}/${PN}"-3.0.3-dhclient-hostname.patch
# Allow mtu settings
epatch "${FILESDIR}/${PN}"-3.0.3-dhclient-mtu.patch
# Allow dhclient to use IF_METRIC to set route metrics
epatch "${FILESDIR}/${PN}"-4.1-dhclient-metric.patch
# Stop downing the interface on Linux as that breaks link daemons
# such as wpa_supplicant and netplug
epatch "${FILESDIR}/${PN}"-3.0.3-dhclient-no-down.patch
# Quiet the isc blurb
epatch "${FILESDIR}/${PN}"-4.1-no_isc_blurb.patch
# Enable dhclient to get extra configuration from stdin
epatch "${FILESDIR}/${PN}"-4.0.1-dhclient-stdin-conf.patch
# Disable fallback interfaces when using BPF
# This allows more than one dhclient instance on the BSD's
epatch "${FILESDIR}/${PN}"-3.0.5-bpf-nofallback.patch
# This allows the software to actually compile on linux
epatch "${FILESDIR}/${PN}"-4.0-linux-ipv6-header.patch
# Consistent style for the if statements, also resolves
# unary operator expected warnings (new style is wrong).
epatch "${FILESDIR}/${PN}"-4.0-dhclient-script-correct-operators.patch
# NetworkManager support patches
# If they fail to apply to future versions they will be dropped
# Add dbus support to dhclient
epatch "${FILESDIR}/${PN}"-3.0.3-dhclient-dbus.patch
# Ldap patch for dhcp
epatch "${WORKDIR}/ldap-for-dhcp-${LDAP_PV}/dhcp-${MY_LDAP_PV}"-ldap.patch
# Brand the version with Gentoo
# include revision if >0
local newver="Gentoo"
[[ ${PR} != "r0" ]] && newver="${newver}-${PR}"
sed -i "/AC_INIT/s/\(\[[0-9]\+\.[0-9]\+\.[0-9]\+\)/\1-${newver}/" \
configure.ac || die
# Change the hook script locations of the scripts
sed -i -e 's,/etc/dhclient-exit-hooks,/etc/dhcp/dhclient-exit-hooks,g' \
-e 's,/etc/dhclient-enter-hooks,/etc/dhcp/dhclient-enter-hooks,g' \
client/scripts/* || die
# No need for the linux script to force bash, #158540.
sed -i -e 's,#!/bin/bash,#!/bin/sh,' client/scripts/linux || die
# Quiet the freebsd logger a little
sed -i -e '/LOGGER=/ s/-s -p user.notice //g' client/scripts/freebsd || die
# Remove these options from the sample config
sed -i -e "/\(script\|host-name\|domain-name\) / d" \
client/dhclient.conf || die
# Only install different man pages if we don't have en
if [[ " ${LINGUAS} " != *" en "* ]]; then
# Install Japanese man pages
if [[ " ${LINGUAS} " == *" ja "* && -d doc/ja_JP.eucJP ]]; then
einfo "Installing Japanese documention"
cp doc/ja_JP.eucJP/dhclient* client
cp doc/ja_JP.eucJP/dhcp* common
fi
fi
# Now remove the non-english docs so there are no errors later
[[ -d doc/ja_JP.eucJP ]] && rm -rf doc/ja_JP.eucJP
eautoreconf
}
src_compile() {
myconf=""
if use ldap; then
myconf="${myconf} --with-ldap"
use ssl && myconf="${myconf} --with-ldapcrypto"
fi
econf \
--enable-paranoia \
--sysconfdir /etc/dhcp \
--with-cli-pid-file=/var/run/dhcp/dhclient.pid \
--with-cli-lease-file=/var/lib/dhcp/dhclient.leases \
--with-srv-pid-file=/var/run/dhcp/dhcpd.pid \
--with-srv-lease-file=/var/lib/dhcp/dhcpd.leases \
--with-relay-pid-file=/var/run/dhcp/dhcrelay.pid \
$(use_enable ipv6 dhcpv6) \
${myconf} \
|| die
emake || die "compile problem"
}
src_install() {
for installdir in includes tests common minires dst omapip client dhcpctl relay server; do
cd "${S}/${installdir}"
if [ "${installdir}" == client ]; then
make install DESTDIR="${D}" exec_prefix="" || die
else
make install DESTDIR="${D}" exec_prefix="/usr" || die
fi
done
cd "${S}"
exeinto /sbin
if use kernel_linux; then
newexe "${S}"/client/scripts/linux dhclient-script
else
newexe "${S}"/client/scripts/freebsd dhclient-script
fi
if use doc; then
dodoc README RELNOTES doc/*
use ldap && dodoc "${WORKDIR}/ldap-for-dhcp-${LDAP_PV}"/*.ldap "${WORKDIR}/ldap-for-dhcp-${LDAP_PV}"/draft-ietf-dhc-ldap-schema-01.txt
fi
insinto /etc/dhcp
newins client/dhclient.conf dhclient.conf.sample
keepdir /var/{lib,run}/dhcp
keepdir /var/lib/dhclient
# Install our server files
insinto /etc/dhcp
newins server/dhcpd.conf dhcpd.conf.sample
newinitd "${FILESDIR}"/dhcpd.init dhcpd
newinitd "${FILESDIR}"/dhcrelay.init dhcrelay
newconfd "${FILESDIR}"/dhcpd.conf dhcpd
newconfd "${FILESDIR}"/dhcrelay.conf dhcrelay
# install ldap files
if use ldap; then
insinto /etc/openldap/schema
doins "${WORKDIR}/ldap-for-dhcp-${LDAP_PV}"/dhcp.*
dosbin "${WORKDIR}/ldap-for-dhcp-${LDAP_PV}"/dhcpd-conf-to-ldap
fi
# We never want portage to own this file
rm -f "${D}"/var/lib/dhcp/dhcpd.leases
}
pkg_preinst() {
enewgroup dhcp
enewuser dhcp -1 -1 /var/lib/dhcp dhcp
}
pkg_postinst() {
chown dhcp:dhcp "${ROOT}"/var/{lib,run}/dhcp
if [[ -e "${ROOT}"/etc/init.d/dhcp ]] ; then
ewarn
ewarn "WARNING: The dhcp init script has been renamed to dhcpd"
ewarn "/etc/init.d/dhcp and /etc/conf.d/dhcp need to be removed and"
ewarn "and dhcp should be removed from the default runlevel"
ewarn
fi
einfo "You can edit /etc/conf.d/dhcpd to customize dhcp settings."
einfo
einfo "If you would like to run dhcpd in a chroot, simply configure the"
einfo "DHCPD_CHROOT directory in /etc/conf.d/dhcpd and then run:"
einfo " emerge --config =${PF}"
}
pkg_config() {
local CHROOT="$(
sed -n -e 's/^[[:blank:]]\?DHCPD_CHROOT="*\([^#"]\+\)"*/\1/p' \
"${ROOT}"/etc/conf.d/dhcpd
)"
if [[ -z ${CHROOT} ]]; then
eerror "CHROOT not defined in /etc/conf.d/dhcpd"
return 1
fi
CHROOT="${ROOT}/${CHROOT}"
if [[ -d ${CHROOT} ]] ; then
ewarn "${CHROOT} already exists - aborting"
return 0
fi
ebegin "Setting up the chroot directory"
mkdir -m 0755 -p "${CHROOT}/"{dev,etc,var/lib,var/run/dhcp}
cp /etc/{localtime,resolv.conf} "${CHROOT}"/etc
cp -R /etc/dhcp "${CHROOT}"/etc
cp -R /var/lib/dhcp "${CHROOT}"/var/lib
ln -s ../../var/lib/dhcp "${CHROOT}"/etc/dhcp/lib
chown -R dhcp:dhcp "${CHROOT}"/var/{lib,run}/dhcp
eend 0
local logger="$(best_version virtual/logger)"
einfo "To enable logging from the dhcpd server, configure your"
einfo "logger (${logger}) to listen on ${CHROOT}/dev/log"
}