net-misc/dhcp: correct same small bugs

git-svn-id: https://svn.disconnected-by-peer.at/svn/linamh/trunk/mds@1352 6952d904-891a-0410-993b-d76249ca496b
This commit is contained in:
geos_one
2009-07-08 19:44:34 +00:00
parent 6a9cb88d98
commit 48b443a01c
6 changed files with 37 additions and 5 deletions

View File

@@ -3,6 +3,8 @@
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-misc/dhcp/files/dhcpd.init,v 1.5 2007/04/02 12:34:01 uberlord Exp $
opts="configtest"
DHCPD_CONF=${DHCPD_CONF:-/etc/dhcp/dhcpd.conf}
depend() {
@@ -15,6 +17,23 @@ get_var() {
"${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
@@ -32,6 +51,8 @@ start() {
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
@@ -49,6 +70,8 @@ start() {
local pidfile="$(get_var pid-file-name)"
pidfile="${pidfile:-/var/run/dhcp/dhcpd.pid}"
touch "${DHCPD_CHROOT}/${pidfile}"
chown dhcp:dhcp "${DHCPD_CHROOT}/${pidfile}"
ebegin "Starting ${DHCPD_CHROOT:+chrooted }${SVCNAME}"
start-stop-daemon --start --exec /usr/sbin/dhcpd \
@@ -63,6 +86,8 @@ start() {
stop() {
local chroot="$(get_options chroot)"
checkconfig || return 1
ebegin "Stopping ${chroot:+chrooted }${SVCNAME}"
start-stop-daemon --stop --exec /usr/sbin/dhcpd \