kiorky@khalia ~ $ cat /etc/conf.d/dhcp
# /etc/conf.d/dhcp: config file for /etc/init.d/dhcp
# Configure which interface or interfaces to for dhcp to listen on
# list all interfaces space separated. If this is not specified then
# we listen on all interfaces.
#IFACE=""
# Insert any other dhcp options - see the man page for a full list.
#DHCPD_OPTS=""
# If you wish to run dhcp in a chroot, run:
# ebuild /var/db/pkg/net-misc/<dhcp version>/<dhcp-version>.ebuild config
# and un-comment the following line.
# You can specify a different chroot directory but MAKE SURE it's empty.
#CHROOT="/chroot/dhcp"
# If you need name resolution under a chroot, you need to ensure that
# you have a working /etc/resolv.conf in your chroot and you
# uncomment the following:
#export LD_PRELOAD="/usr/lib/libresolv.so /usr/lib/libnss_dns.so"
kiorky@khalia ~ $
kiorky@khalia ~ $ cat /etc/init.d/dhcp
#!/sbin/runscript
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-misc/dhcp/files/dhcp.init,v 1.6 2006/02/23 16:21:24 uberlord Exp $
depend() {
need net
use logger dns
}
get_var() {
sed -n 's/^[[:blank:]]\?'"$1"' "*\([^#";]\+\).*/\1/p' \
"${CHROOT}/etc/dhcp/dhcpd.conf"
}
start() {
if [[ ! -f "${CHROOT}/etc/dhcp/dhcpd.conf" ]] ; then
eerror "${CHROOT}/etc/dhcp/dhcpd.conf does not exist"
return 1
fi
local leasefile="$(get_var lease-file-name)"
leasefile="${CHROOT}/${leasefile:-/var/lib/dhcp/dhcpd.leases}"
if [[ ! -f ${leasefile} ]] ; then
ebegin "Creating ${leasefile}"
touch "${leasefile}"
chown dhcp:dhcp "${leasefile}"
eend $? || return 1
fi
# Ensure that LD_PRELOAD is really exported
[[ -n ${LD_PRELOAD} ]] && export LD_PRELOAD="${LD_PRELOAD}"
local pidfile="$(get_var pid-file-name)"
pidfile="${pidfile:-/var/run/dhcp/dhcpd.pid}"
ebegin "Starting ${CHROOT:+chrooted }dhcpd"
start-stop-daemon --start --exec /usr/sbin/dhcpd \
--pidfile "${CHROOT}/${pidfile}" \
-- -q -pf "${pidfile}" \
-user dhcp -group dhcp ${DHCPD_OPTS} \
${CHROOT:+-chroot} ${CHROOT} ${IFACE}
eend $? && save_options pidfile "${CHROOT}/${pidfile}"
}
stop() {
local pidfile="$(get_options pidfile)" chrooted=""
[[ ${pidfile} != //var/run/dhcp/dhcpd.pid ]] && chrooted="chrooted "
ebegin "Stopping ${chrooted}dhcpd"
start-stop-daemon --stop --exec /usr/sbin/dhcpd \
--pidfile "${pidfile}"
eend $?
}