summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTony Vroon <chainsaw@gentoo.org>2009-07-09 14:45:22 +0000
committerTony Vroon <chainsaw@gentoo.org>2009-07-09 14:45:22 +0000
commitd4d73410374f8543a7b679cd0c3e309c7e0f04f1 (patch)
tree75adfefe7045a47760497f5bcee369b2433b792f /net-misc/dhcp
parentFail. It seems that trunk has --disable-vdpau generic configure option now, s... (diff)
downloadgentoo-2-d4d73410374f8543a7b679cd0c3e309c7e0f04f1.tar.gz
gentoo-2-d4d73410374f8543a7b679cd0c3e309c7e0f04f1.tar.bz2
gentoo-2-d4d73410374f8543a7b679cd0c3e309c7e0f04f1.zip
Version bump to 3.1.2 & 4.1.0 upstream releases, as requested in bug #264809. Create /var/lib/dhclient as per bug #222261. Recursive chown to dhcp:dhcp closes bug #236671. Test config in init-script, apache-style by Arturas from Lithuania in bug #259364. Paranoia/chroot support now upstream in 4.1, dropped patch.
(Portage version: 2.1.6.13/cvs/Linux x86_64)
Diffstat (limited to 'net-misc/dhcp')
-rw-r--r--net-misc/dhcp/ChangeLog14
-rw-r--r--net-misc/dhcp/dhcp-3.1.2.ebuild239
-rw-r--r--net-misc/dhcp/dhcp-4.1.0.ebuild211
-rw-r--r--net-misc/dhcp/files/dhcp-4.1-dhclient-metric.patch189
-rw-r--r--net-misc/dhcp/files/dhcp-4.1-no_isc_blurb.patch96
-rw-r--r--net-misc/dhcp/files/dhcpd.init294
6 files changed, 842 insertions, 1 deletions
diff --git a/net-misc/dhcp/ChangeLog b/net-misc/dhcp/ChangeLog
index 56bc789afd49..27c02bf10764 100644
--- a/net-misc/dhcp/ChangeLog
+++ b/net-misc/dhcp/ChangeLog
@@ -1,6 +1,18 @@
# ChangeLog for net-misc/dhcp
# 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 $
+# $Header: /var/cvsroot/gentoo-x86/net-misc/dhcp/ChangeLog,v 1.155 2009/07/09 14:45:21 chainsaw Exp $
+
+*dhcp-4.1.0 (09 Jul 2009)
+*dhcp-3.1.2 (09 Jul 2009)
+
+ 09 Jul 2009; <chainsaw@gentoo.org> +dhcp-3.1.2.ebuild, +dhcp-4.1.0.ebuild,
+ +files/dhcp-4.1-dhclient-metric.patch, +files/dhcp-4.1-no_isc_blurb.patch,
+ +files/dhcpd.init2:
+ Version bump to 3.1.2 & 4.1.0 upstream releases, as requested in bug
+ #264809. Create /var/lib/dhclient as per bug #222261. Recursive chown to
+ dhcp:dhcp closes bug #236671. Test config in init-script, apache-style by
+ Arturas from Lithuania in bug #259364. Paranoia/chroot support now
+ upstream in 4.1, dropped patch.
29 May 2009; Mike Frysinger <vapier@gentoo.org> -dhcp-3.0.3-r9.ebuild,
-dhcp-3.0.6.ebuild, -dhcp-3.1.0.ebuild:
diff --git a/net-misc/dhcp/dhcp-3.1.2.ebuild b/net-misc/dhcp/dhcp-3.1.2.ebuild
new file mode 100644
index 000000000000..60708d6c5dc6
--- /dev/null
+++ b/net-misc/dhcp/dhcp-3.1.2.ebuild
@@ -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-3.1.2.ebuild,v 1.1 2009/07/09 14:45:21 chainsaw Exp $
+
+inherit eutils flag-o-matic multilib toolchain-funcs
+
+MY_PV="${PV//_alpha/a}"
+MY_PV="${MY_PV//_beta/b}"
+MY_PV="${MY_PV//_rc/rc}"
+MY_P="${PN}-${MY_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"
+
+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"
+
+DEPEND="selinux? ( sec-policy/selinux-dhcp )
+ kernel_linux? ( sys-apps/net-tools )"
+
+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
+
+ # 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
+
+ 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
+
+ ./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
+ use doc && dodoc README RELNOTES doc/*
+
+ 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.init2 dhcpd
+ newinitd "${FILESDIR}"/dhcrelay.init dhcrelay
+ newconfd "${FILESDIR}"/dhcpd.conf dhcpd
+ newconfd "${FILESDIR}"/dhcrelay.conf dhcrelay
+
+ # 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 -R 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"
+}
diff --git a/net-misc/dhcp/dhcp-4.1.0.ebuild b/net-misc/dhcp/dhcp-4.1.0.ebuild
new file mode 100644
index 000000000000..fd621d562d11
--- /dev/null
+++ b/net-misc/dhcp/dhcp-4.1.0.ebuild
@@ -0,0 +1,211 @@
+# 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.1.0.ebuild,v 1.1 2009/07/09 14:45:21 chainsaw Exp $
+
+inherit eutils flag-o-matic autotools
+
+MY_PV="${PV//_alpha/a}"
+MY_PV="${MY_PV//_beta/b}"
+MY_PV="${MY_PV//_rc/rc}"
+MY_P="${PN}-${MY_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"
+
+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"
+
+DEPEND="selinux? ( sec-policy/selinux-dhcp )
+ kernel_linux? ( sys-apps/net-tools )
+ vim-syntax? ( app-vim/dhcpd-syntax )"
+
+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
+
+ # 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() {
+ 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) \
+ || 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
+
+ use doc && dodoc README RELNOTES doc/*
+
+ 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.init2 dhcpd
+ newinitd "${FILESDIR}"/dhcrelay.init dhcrelay
+ newconfd "${FILESDIR}"/dhcpd.conf dhcpd
+ newconfd "${FILESDIR}"/dhcrelay.conf dhcrelay
+
+ # 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 -R 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"
+}
diff --git a/net-misc/dhcp/files/dhcp-4.1-dhclient-metric.patch b/net-misc/dhcp/files/dhcp-4.1-dhclient-metric.patch
new file mode 100644
index 000000000000..3556d974864b
--- /dev/null
+++ b/net-misc/dhcp/files/dhcp-4.1-dhclient-metric.patch
@@ -0,0 +1,189 @@
+diff -uNr dhcp-4.1.0.ORIG/client/scripts/bsdos dhcp-4.1.0/client/scripts/bsdos
+--- dhcp-4.1.0.ORIG/client/scripts/bsdos 2009-07-09 15:16:11.000000000 +0100
++++ dhcp-4.1.0/client/scripts/bsdos 2009-07-09 15:17:41.000000000 +0100
+@@ -102,6 +102,9 @@
+ if [ x$new_interface_mtu != x ]; then
+ mtu_arg="mtu $new_interface_mtu"
+ fi
++if [ x$IF_METRIC != x ]; then
++ metric_arg="metric $IF_METRIC"
++fi
+
+ if [ x$reason = xMEDIUM ]; then
+ eval "ifconfig $interface $medium"
+@@ -163,7 +166,7 @@
+ if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \
+ [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then
+ eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \
+- $new_broadcast_arg $mtu_arg $medium"
++ $new_broadcast_arg $mtu_arg $metric_arg $medium"
+ route add $new_ip_address 127.1 >/dev/null 2>&1
+ for router in $new_routers; do
+ route add default $router >/dev/null 2>&1
+@@ -220,7 +223,7 @@
+ route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1
+ fi
+ eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \
+- $new_broadcast_arg $mtu_arg $medium"
++ $new_broadcast_arg $mtu_arg $metric_arg $medium"
+ sleep 1
+ if [ "$new_routers" != "" ]; then
+ set $new_routers
+diff -uNr dhcp-4.1.0.ORIG/client/scripts/freebsd dhcp-4.1.0/client/scripts/freebsd
+--- dhcp-4.1.0.ORIG/client/scripts/freebsd 2009-07-09 15:16:11.000000000 +0100
++++ dhcp-4.1.0/client/scripts/freebsd 2009-07-09 15:17:41.000000000 +0100
+@@ -112,6 +112,9 @@
+ if [ x$new_interface_mtu != x ]; then
+ mtu_arg="mtu $new_interface_mtu"
+ fi
++if [ x$IF_METRIC != x ]; then
++ metric_arg="metric $IF_METRIC"
++fi
+
+ if [ x$reason = xMEDIUM ]; then
+ eval "ifconfig $interface $medium"
+@@ -173,7 +176,7 @@
+ if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \
+ [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then
+ eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \
+- $new_broadcast_arg $mtu_arg $medium"
++ $new_broadcast_arg $mtu_arg $metric_arg $medium"
+ $LOGGER "New IP Address ($interface): $new_ip_address"
+ $LOGGER "New Subnet Mask ($interface): $new_subnet_mask"
+ $LOGGER "New Broadcast Address ($interface): $new_broadcast_address"
+@@ -243,7 +246,7 @@
+ route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1
+ fi
+ eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \
+- $new_broadcast_arg $mtu_arg $medium"
++ $new_broadcast_arg $mtu_arg $metric_arg $medium"
+ $LOGGER "New IP Address ($interface): $new_ip_address"
+ $LOGGER "New Subnet Mask ($interface): $new_subnet_mask"
+ $LOGGER "New Broadcast Address ($interface): $new_broadcast_address"
+diff -uNr dhcp-4.1.0.ORIG/client/scripts/linux dhcp-4.1.0/client/scripts/linux
+--- dhcp-4.1.0.ORIG/client/scripts/linux 2009-07-09 15:16:11.000000000 +0100
++++ dhcp-4.1.0/client/scripts/linux 2009-07-09 15:20:50.000000000 +0100
+@@ -104,11 +104,6 @@
+ fi
+ fi
+
+-release=`uname -r`
+-release=`expr $release : '\(.*\)\..*'`
+-relminor=`echo $release |sed -e 's/[0-9]*\.\([0-9][0-9]*\)\(\..*\)*$/\1/'`
+-relmajor=`echo $release |sed -e 's/\([0-9][0-9]*\)\..*$/\1/'`
+-
+ ###
+ ### DHCPv4 Handlers
+ ###
+@@ -131,6 +126,9 @@
+ if [ x$new_interface_mtu != x ]; then
+ mtu_arg="mtu $new_interface_mtu"
+ fi
++if [ x$IF_METRIC != x ]; then
++ metric_arg="metric $IF_METRIC"
++fi
+
+ if [ x$reason = xMEDIUM ]; then
+ # Linux doesn't do mediums (ok, ok, media).
+@@ -142,15 +140,7 @@
+ # Bring down alias interface. Its routes will disappear too.
+ ifconfig $interface:0- inet 0
+ fi
+- if [ $relmajor -lt 2 ] || ( [ $relmajor -eq 2 ] && [ $relminor -eq 0 ] )
+- then
+- ifconfig $interface inet 0.0.0.0 netmask 0.0.0.0 \
+- broadcast 255.255.255.255 up
+- # Add route to make broadcast work. Do not omit netmask.
+- route add default dev $interface netmask 0.0.0.0
+- else
+- ifconfig $interface 0 up
+- fi
++ ifconfig $interface 0 up
+
+ # We need to give the kernel some time to get the interface up.
+ sleep 1
+@@ -192,15 +182,17 @@
+ ifconfig $interface inet $new_ip_address $new_subnet_arg \
+ $new_broadcast_arg $mtu_arg
+ # Add a network route to the computed network address.
+- if [ $relmajor -lt 2 ] || \
+- ( [ $relmajor -eq 2 ] && [ $relminor -eq 0 ] ); then
+- route add -net $new_network_number $new_subnet_arg dev $interface
++ if [ x$IF_METRIC != x ] && [ x$IF_METRIC != x0 ]; then
++ route del -net $new_network_number $new_subnet_arg \
++ dev $interface
++ route add -net $new_network_number $new_subnet_arg $metric_arg \
++ dev $interface
+ fi
+ for router in $new_routers; do
+ if [ "x$new_subnet_mask" = "x255.255.255.255" ] ; then
+- route add -host $router dev $interface
++ route add -host $router $metric_arg dev $interface
+ fi
+- route add default gw $router
++ route add default gw $router $metric_arg dev $interface
+ done
+ fi
+ if [ x$new_ip_address != x$alias_ip_address ] && [ x$alias_ip_address != x ];
+diff -uNr dhcp-4.1.0.ORIG/client/scripts/netbsd dhcp-4.1.0/client/scripts/netbsd
+--- dhcp-4.1.0.ORIG/client/scripts/netbsd 2009-07-09 15:16:11.000000000 +0100
++++ dhcp-4.1.0/client/scripts/netbsd 2009-07-09 15:17:41.000000000 +0100
+@@ -102,6 +102,9 @@
+ if [ x$new_interface_mtu != x ]; then
+ mtu_arg="mtu $new_interface_mtu"
+ fi
++if [ x$IF_METRIC != x ]; then
++ metric_arg="metric $IF_METRIC"
++fi
+
+ if [ x$reason = xMEDIUM ]; then
+ eval "ifconfig $interface $medium"
+@@ -163,7 +166,7 @@
+ if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \
+ [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then
+ eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \
+- $new_broadcast_arg $mtu_arg $medium"
++ $new_broadcast_arg $mtu_arg $metric_arg $medium"
+ route add $new_ip_address 127.1 >/dev/null 2>&1
+ for router in $new_routers; do
+ route add default $router >/dev/null 2>&1
+@@ -220,7 +223,7 @@
+ route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1
+ fi
+ eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \
+- $new_broadcast_arg $mtu_arg $medium"
++ $new_broadcast_arg $mtu_arg $metric_arg $medium"
+ sleep 1
+ if [ "$new_routers" != "" ]; then
+ set $new_routers
+diff -uNr dhcp-4.1.0.ORIG/client/scripts/solaris dhcp-4.1.0/client/scripts/solaris
+--- dhcp-4.1.0.ORIG/client/scripts/solaris 2009-07-09 15:16:11.000000000 +0100
++++ dhcp-4.1.0/client/scripts/solaris 2009-07-09 15:17:41.000000000 +0100
+@@ -97,6 +97,9 @@
+ if [ x$new_interface_mtu != x ]; then
+ mtu_arg="mtu $new_interface_mtu"
+ fi
++if [ x$IF_METRIC != x ]; then
++ metric_arg="metric $IF_METRIC"
++fi
+
+ ifconfig=/sbin/ifconfig
+
+@@ -159,7 +162,7 @@
+ if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \
+ [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then
+ eval "$ifconfig $interface inet $new_ip_address $new_netmask_arg \
+- $new_broadcast_arg $mtu_arg $medium"
++ $new_broadcast_arg $mtu_arg $metric_arg $medium"
+ route add $new_ip_address 127.1 1 >/dev/null 2>&1
+ for router in $new_routers; do
+ route add default $router 1 >/dev/null 2>&1
+@@ -200,7 +203,7 @@
+ route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1
+ fi
+ eval "$ifconfig $interface inet $new_ip_address $new_netmask_arg \
+- $new_broadcast_arg $mtu_arg $medium"
++ $new_broadcast_arg $mtu_arg $metric_arg $medium"
+ sleep 1
+ set $new_routers
+ if ping -s -n -I 1 $1 64 1; then
diff --git a/net-misc/dhcp/files/dhcp-4.1-no_isc_blurb.patch b/net-misc/dhcp/files/dhcp-4.1-no_isc_blurb.patch
new file mode 100644
index 000000000000..1afdf21a934e
--- /dev/null
+++ b/net-misc/dhcp/files/dhcp-4.1-no_isc_blurb.patch
@@ -0,0 +1,96 @@
+diff -uNr dhcp-4.1.0.ORIG/client/dhclient.c dhcp-4.1.0/client/dhclient.c
+--- dhcp-4.1.0.ORIG/client/dhclient.c 2009-07-09 15:29:40.000000000 +0100
++++ dhcp-4.1.0/client/dhclient.c 2009-07-09 15:30:19.000000000 +0100
+@@ -87,6 +87,8 @@
+
+ static isc_result_t write_duid(struct data_string *duid);
+
++extern int log_isc_blurb;
++
+ int
+ main(int argc, char **argv) {
+ int fd;
+@@ -385,6 +387,7 @@
+ log_info("%s", "");
+ } else {
+ log_perror = 0;
++ log_isc_blurb = 0;
+ quiet_interface_discovery = 1;
+ }
+
+diff -uNr dhcp-4.1.0.ORIG/omapip/errwarn.c dhcp-4.1.0/omapip/errwarn.c
+--- dhcp-4.1.0.ORIG/omapip/errwarn.c 2009-07-09 15:29:40.000000000 +0100
++++ dhcp-4.1.0/omapip/errwarn.c 2009-07-09 15:29:52.000000000 +0100
+@@ -43,6 +43,8 @@
+ int log_perror = 1;
+ #endif
+ int log_priority;
++int log_isc_blurb=1;
++
+ void (*log_cleanup) (void);
+
+ #define CVT_BUF_MAX 1023
+@@ -74,7 +76,9 @@
+ write (STDERR_FILENO, "\n", 1);
+ }
+
+-#if !defined (NOMINUM)
++#if !defined(NOMINUM)
++ if ( log_isc_blurb )
++ {
+ log_error ("%s", "");
+ log_error ("If you did not get this software from ftp.isc.org, please");
+ log_error ("get the latest from ftp.isc.org and install that before");
+@@ -92,7 +96,12 @@
+ log_error ("the README file.");
+ log_error ("%s", "");
+ log_error ("exiting.");
++ }else
++ {
++ log_error ("exiting.");
++ }
+ #endif
++
+ if (log_cleanup)
+ (*log_cleanup) ();
+ exit (1);
+diff -uNr dhcp-4.1.0.ORIG/relay/dhcrelay.c dhcp-4.1.0/relay/dhcrelay.c
+--- dhcp-4.1.0.ORIG/relay/dhcrelay.c 2009-07-09 15:29:40.000000000 +0100
++++ dhcp-4.1.0/relay/dhcrelay.c 2009-07-09 15:31:53.000000000 +0100
+@@ -130,6 +130,7 @@
+ static char arr[] = "All rights reserved.";
+ static char message[] = "Internet Systems Consortium DHCP Relay Agent";
+ static char url[] = "For info, please visit http://www.isc.org/sw/dhcp/";
++extern int log_isc_blurb;
+
+ #ifdef DHCPv6
+ #define DHCRELAY_USAGE \
+@@ -219,6 +220,7 @@
+ } else if (!strcmp(argv[i], "-q")) {
+ quiet = 1;
+ quiet_interface_discovery = 1;
++ log_isc_blurb = 0;
+ } else if (!strcmp(argv[i], "-p")) {
+ if (++i == argc)
+ usage();
+diff -uNr dhcp-4.1.0.ORIG/server/dhcpd.c dhcp-4.1.0/server/dhcpd.c
+--- dhcp-4.1.0.ORIG/server/dhcpd.c 2009-07-09 15:29:40.000000000 +0100
++++ dhcp-4.1.0/server/dhcpd.c 2009-07-09 15:29:52.000000000 +0100
+@@ -62,6 +62,9 @@
+ struct iaddr server_identifier;
+ int server_identifier_matched;
+
++
++extern int log_isc_blurb;
++
+ #if defined (NSUPDATE)
+
+ /* This stuff is always executed to figure the default values for certain
+@@ -367,6 +370,7 @@
+ lftest = 1;
+ log_perror = -1;
+ } else if (!strcmp (argv [i], "-q")) {
++ log_isc_blurb = 0;
+ quiet = 1;
+ quiet_interface_discovery = 1;
+ #ifdef DHCPv6
diff --git a/net-misc/dhcp/files/dhcpd.init2 b/net-misc/dhcp/files/dhcpd.init2
new file mode 100644
index 000000000000..82cb26e77901
--- /dev/null
+++ b/net-misc/dhcp/files/dhcpd.init2
@@ -0,0 +1,94 @@
+#!/sbin/runscript
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/dhcp/files/dhcpd.init2,v 1.1 2009/07/09 14:45:22 chainsaw Exp $
+
+opts="configtest"
+
+DHCPD_CONF=${DHCPD_CONF:-/etc/dhcp/dhcpd.conf}
+
+depend() {
+ need net
+ use logger dns
+}
+
+get_var() {
+ sed -n 's/^[[:blank:]]\?'"$1"' "*\([^#";]\+\).*/\1/p' \
+ "${DHCPD_CHROOT}/${DHCPD_CONF}"
+}
+
+checkconfig() {
+ /usr/sbin/dhcpd -cf ${DHCPD_CHROOT}/${DHCPD_CONF} -t 1>/dev/null 2>&1
+ ret=$?
+ if [ $ret -ne 0 ]; then
+ eerror "${SVCNAME} has detected a syntax error in your configuration files:"
+ /usr/sbin/dhcpd -cf ${DHCPD_CHROOT}/${DHCPD_CONF} -t
+ fi
+
+ return $ret
+}
+
+configtest() {
+ ebegin "Checking ${SVCNAME} configuration"
+ checkconfig
+ eend $?
+}
+
+start() {
+ # Work out our cffile if it's on our DHCPD_OPTS
+ case " ${DHCPD_OPTS} " in
+ *" -cf "*)
+ DHCPD_CONF=" ${DHCPD_OPTS} "
+ DHCPD_CONF="${DHCPD_CONF##* -cf }"
+ DHCPD_CONF="${DHCPD_CONF%% *}"
+ ;;
+ *) DHCPD_OPTS="${DHCPD_OPTS} -cf ${DHCPD_CONF}"
+ ;;
+ esac
+
+ if [ ! -f "${DHCPD_CHROOT}/${DHCPD_CONF}" ] ; then
+ eerror "${DHCPD_CHROOT}/${DHCPD_CONF} does not exist"
+ return 1
+ fi
+
+ checkconfig || return 1
+
+ local leasefile="$(get_var lease-file-name)"
+ leasefile="${DHCPD_CHROOT}/${leasefile:-/var/lib/dhcp/dhcpd.leases}"
+ if [ ! -f "${leasefile}" ] ; then
+ ebegin "Creating ${leasefile}"
+ touch "${leasefile}"
+ chown dhcp:dhcp "${leasefile}"
+ eend $? || return 1
+ fi
+
+ # Setup LD_PRELOAD so name resolution works in our chroot.
+ if [ -n "${DHCPD_CHROOT}" ] ; then
+ LD_PRELOAD="${LD_PRELOAD} /usr/lib/libresolv.so"
+ export LD_PRELOAD="${LD_PRELOAD} /usr/lib/libnss_dns.so"
+ fi
+
+ local pidfile="$(get_var pid-file-name)"
+ pidfile="${pidfile:-/var/run/dhcp/dhcpd.pid}"
+
+ ebegin "Starting ${DHCPD_CHROOT:+chrooted }${SVCNAME}"
+ start-stop-daemon --start --exec /usr/sbin/dhcpd \
+ --pidfile "${DHCPD_CHROOT}/${pidfile}" \
+ -- ${DHCPD_OPTS} -q -pf "${pidfile}" \
+ -user dhcp -group dhcp \
+ ${DHCPD_CHROOT:+-chroot} ${DHCPD_CHROOT} ${DHCPD_IFACE}
+ eend $? \
+ && save_options chroot "${DHCPD_CHROOT}" \
+ && save_options pidfile "${pidfile}"
+}
+
+stop() {
+ local chroot="$(get_options chroot)"
+
+ checkconfig || return 1
+
+ ebegin "Stopping ${chroot:+chrooted }${SVCNAME}"
+ start-stop-daemon --stop --exec /usr/sbin/dhcpd \
+ --pidfile "${chroot}/$(get_options pidfile)"
+ eend $?
+}