packages: dhcp/dhcp.init - silence default startup on errors - add configte...

glen glen at pld-linux.org
Thu Nov 19 14:20:30 CET 2009


Author: glen                         Date: Thu Nov 19 13:20:30 2009 GMT
Module: packages                      Tag: HEAD
---- Log message:
- silence default startup on errors
- add configtest alias

---- Files affected:
packages/dhcp:
   dhcp.init (1.22 -> 1.23) 

---- Diffs:

================================================================
Index: packages/dhcp/dhcp.init
diff -u packages/dhcp/dhcp.init:1.22 packages/dhcp/dhcp.init:1.23
--- packages/dhcp/dhcp.init:1.22	Mon Jun 29 02:16:09 2009
+++ packages/dhcp/dhcp.init	Thu Nov 19 14:20:25 2009
@@ -35,11 +35,8 @@
 
 # configtest itself
 configtest() {
-	local rc out
-	out=`/sbin/dhcpd -t 2>&1`; rc=$?
-	if [ $rc -gt 0 ]; then
-		echo >&2 "$out"
-	fi
+	local rc=0
+	/sbin/dhcpd -q -t -T || rc=$?
 
 	# check if interfaces specified exist and have addresses
 	for i in $DHCPD_INTERFACES; do
@@ -52,15 +49,22 @@
 	return $rc
 }
 
-# wrapper for configtest:
+# wrapper for configtest
 checkconfig() {
 	local details=${1:-0}
 
 	if [ $details = 1 ]; then
 		# run config test and display report (status action)
-		show "Checking %s configuration" "DHCP Server"; busy; echo
-		configtest
+		show "Checking %s configuration" "DHCP Server"; busy
+		local out
+		out=$(configtest 2>&1)
 		RETVAL=$?
+		if [ $RETVAL = 0 ]; then
+			ok
+		else
+			fail
+		fi
+		[ "$out" ] && echo >&2 "$out"
 	else
 		# run config test and abort with nice message if failed
 		# (for actions checking status before action).
@@ -68,7 +72,7 @@
 		RETVAL=$?
 		if [ $RETVAL != 0 ]; then
 			show "Checking %s configuration" "DHCP Server"; fail
-			echo >&2 "Configuration test failed. Run \"$0 checkconfig\" to see errors."
+			nls 'Configuration test failed. See details with %s "checkconfig"' $0
 			exit $RETVAL
 		fi
 	fi
@@ -83,7 +87,7 @@
 
 	checkconfig
 	msg_starting "DHCP Server"
-	daemon /sbin/dhcpd $DHCPD_INTERFACES
+	daemon /sbin/dhcpd -q $DHCPD_INTERFACES
 	RETVAL=$?
 	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/dhcpd
 }
@@ -130,7 +134,7 @@
   force-reload)
 	condrestart 7
 	;;
-  checkconfig)
+  checkconfig|configtest)
 	checkconfig 1
 	;;
   status)
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/dhcp/dhcp.init?r1=1.22&r2=1.23&f=u



More information about the pld-cvs-commit mailing list