aboutsummaryrefslogtreecommitdiffstats
path: root/main/dhcp/dhcpd.initd
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2009-07-31 06:14:49 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2009-07-31 06:23:23 +0000
commitde25f1da2b2c5f49e7917971b2e324cb0773fa30 (patch)
treeb54e128a26a4c6b8c7e08838fefffbdfdef15d87 /main/dhcp/dhcpd.initd
parent37907999d18ebba37db13bfa7415401922eb6141 (diff)
downloadaports-de25f1da2b2c5f49e7917971b2e324cb0773fa30.tar.bz2
aports-de25f1da2b2c5f49e7917971b2e324cb0773fa30.tar.xz
main/dhcp: fix paths to lease files and configs
also * enable paranoia for -user/-group options * fix install scripts * import new init.d script * add missing dirs * move dhclient to a separate subpackage Fixes #110
Diffstat (limited to 'main/dhcp/dhcpd.initd')
-rw-r--r--main/dhcp/dhcpd.initd28
1 files changed, 25 insertions, 3 deletions
diff --git a/main/dhcp/dhcpd.initd b/main/dhcp/dhcpd.initd
index cc9727fc7c..82cb26e779 100644
--- a/main/dhcp/dhcpd.initd
+++ b/main/dhcp/dhcpd.initd
@@ -1,7 +1,9 @@
#!/sbin/runscript
-# Copyright 1999-2006 Gentoo Foundation
+# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/www/viewcvs.gentoo.org/raw_cvs/gentoo-x86/net-misc/dhcp/files/dhcpd.init,v 1.5 2007/04/02 12:34:01 uberlord Exp $
+# $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}
@@ -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
@@ -63,10 +84,11 @@ start() {
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 $?
}
-