X-Git-Url: http://git.pld-linux.org/?a=blobdiff_plain;f=dhcp6.init;h=13820cdca62e5dabee4f76452cf02f0515cc373a;hb=a5aaaa8f2a216f3ecee313322ebfcba4e604dd1c;hp=469171e9a279efd73d4bae7c3fc95ac493b9d3fa;hpb=beb9a290baca41ab32440508d535e2bea7866592;p=packages%2Fdhcp.git diff --git a/dhcp6.init b/dhcp6.init index 469171e..13820cd 100644 --- a/dhcp6.init +++ b/dhcp6.init @@ -10,17 +10,17 @@ # Get network config . /etc/sysconfig/network +# Check that networking is up. +if ! is_yes "${IPV6_NETWORKING}"; then + exit 0 +fi + # Get service config [ -f /etc/sysconfig/dhcpd ] && . /etc/sysconfig/dhcpd -# Check that networking is up. -if is_yes "${NETWORKING}"; then - if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then - msg_network_down "DHCP IPv6 Server" - exit 1 - fi -else - exit 0 +if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then + msg_network_down "DHCP IPv6 Server" + exit 1 fi check_device_up() @@ -36,7 +36,7 @@ check_device_up() # configtest itself configtest() { local rc=0 - /sbin/dhcpd -6 -pf /var/run/dhpcd6.pid -q -t -T || rc=$? + /sbin/dhcpd -6 -pf -cf /etc/dhcpd6.conf /var/run/dhpcd6.pid -q -t -T || rc=$? # check if interfaces specified exist and have addresses for i in $DHCPD_INTERFACES; do @@ -50,61 +50,68 @@ configtest() { } # wrapper for configtest +checkconfig=-1 checkconfig() { local details=${1:-0} + # run checkconfig only once + if [ "$checkconfig" != -1 ]; then + return $checkconfig + fi + if [ $details = 1 ]; then # run config test and display report (status action) show "Checking %s configuration" "DHCP IPv6 Server"; busy local out out=$(configtest 2>&1) - RETVAL=$? - if [ $RETVAL = 0 ]; then + checkconfig=$? + if [ $checkconfig = 0 ]; then ok else fail fi [ "$out" ] && echo >&2 "$out" + RETVAL=$checkconfig else # run config test and abort with nice message if failed # (for actions checking status before action). configtest >/dev/null 2>&1 - RETVAL=$? - if [ $RETVAL != 0 ]; then + checkconfig=$? + if [ $checkconfig != 0 ]; then show "Checking %s configuration" "DHCP IPv6 Server"; fail nls 'Configuration test failed. See details with %s "checkconfig"' $0 - exit $RETVAL + exit $checkconfig fi fi } start() { # Check if the service is already running? - if [ -f /var/lock/subsys/dhcpd ]; then + if [ -f /var/lock/subsys/dhcpd6 ]; then msg_already_running "DHCP IPv6 Server" return fi checkconfig msg_starting "DHCP IPv6 Server" - daemon /sbin/dhcpd -6 -pf /var/run/dhpcd6.pid -q $DHCPD_INTERFACES + daemon /sbin/dhcpd -6 -pf -cf /etc/dhcpd6.conf /var/run/dhpcd6.pid -q $DHCPD_INTERFACES RETVAL=$? - [ $RETVAL -eq 0 ] && touch /var/lock/subsys/dhcpd + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/dhcpd6 } stop() { - if [ ! -f /var/lock/subsys/dhcpd ]; then + if [ ! -f /var/lock/subsys/dhcpd6 ]; then msg_not_running "DHCP IPv6 Server" return fi msg_stopping "DHCP IPv6 Server" killproc --pidfile /var/run/dhcpd6.pid dhcpd - rm -f /var/run/dhcpd6.pid /var/lock/subsys/dhcpd >/dev/null 2>&1 + rm -f /var/run/dhcpd6.pid /var/lock/subsys/dhcpd6 >/dev/null 2>&1 } condrestart() { - if [ ! -f /var/lock/subsys/dhcpd ]; then + if [ ! -f /var/lock/subsys/dhcpd6 ]; then msg_not_running "DHCP IPv6 Server" RETVAL=$1 return @@ -139,7 +146,7 @@ case "$1" in checkconfig 1 ;; status) - status --pidfile /var/run/dhcpd6.pid dhcpd + status --pidfile /var/run/dhcpd6.pid dhcpd6 dhcpd exit $? ;; *)