diff options
Diffstat (limited to 'net-misc/dhcp/files/dhcp.rc6')
-rw-r--r-- | net-misc/dhcp/files/dhcp.rc6 | 44 |
1 files changed, 31 insertions, 13 deletions
diff --git a/net-misc/dhcp/files/dhcp.rc6 b/net-misc/dhcp/files/dhcp.rc6 index 6ca4fc057f3a..d9eb3f7cc098 100644 --- a/net-misc/dhcp/files/dhcp.rc6 +++ b/net-misc/dhcp/files/dhcp.rc6 @@ -1,26 +1,44 @@ #!/sbin/runscript +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-misc/dhcp/files/dhcp.rc6,v 1.1.1.1 2005/11/30 09:55:22 chriswhite Exp $ depend() { - need net + need net + use logger dns } checkconfig() { - if [ ! -e /etc/dhcp/dhcpd.conf ] ; then - eerror "You need an /etc/dhcp/dhcpd.conf file to run dhcpd" - eerror "There is a sample conf file in /usr/share/doc/dhcp" - return 1 - fi + if [ ! -f "${CHROOT}/etc/dhcp/dhcpd.conf" ] ; then + eerror "No ${CHROOT}/etc/dhcp/dhcpd.conf file exists!" + return 1 + fi + + if [ ! -f "${CHROOT}/var/lib/dhcp/dhcpd.leases" ] ; then + ebegin "Creating dhcpd.leases" + touch "${CHROOT}/var/lib/dhcp/dhcpd.leases" || return 1 + eend $? + fi + + ebegin "Setting ownership on dhcpd.leases" + chown dhcp:dhcp "${CHROOT}/var/lib/dhcp/dhcpd.leases" || return 1 + eend $? } start() { - checkconfig || return 1 - ebegin "Starting dhcpd" - start-stop-daemon --start --quiet --exec /usr/sbin/dhcpd -- eth0 - eend $? + checkconfig || return 1 + + ebegin "Starting ${CHROOT:+chrooted }dhcpd" + start-stop-daemon --start --quiet --exec /usr/sbin/dhcpd \ + -- -pf /var/run/dhcp/dhcpd.pid \ + -user dhcp -group dhcp ${DHCPD_OPTS} \ + ${CHROOT:+-chroot ${CHROOT}} ${IFACE} + eend $? } stop() { - ebegin "Stopping dhcpd" - start-stop-daemon --stop --quiet --exec /usr/sbin/dhcpd - eend $? + ebegin "Stopping dhcpd" + start-stop-daemon --stop --quiet --pidfile \ + "${CHROOT}/var/run/dhcp/dhcpd.pid" + eend $? } |