]> git.pld-linux.org Git - packages/dhcp.git/commitdiff
- run checkconfig only once (it trashes syslog no matter what, so do it at least...
authorElan Ruusamäe <glen@pld-linux.org>
Thu, 19 Nov 2009 20:38:47 +0000 (20:38 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    dhcp.init -> 1.25

dhcp.init

index da30605c4f2d18b47dc0d00ff0e65135e443b7a4..064c82a1af08c3e11a4d7e601e03bb3684c76edc 100644 (file)
--- a/dhcp.init
+++ b/dhcp.init
@@ -50,30 +50,37 @@ 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 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 Server"; fail
                        nls 'Configuration test failed. See details with %s "checkconfig"' $0
-                       exit $RETVAL
+                       exit $checkconfig
                fi
        fi
 }
This page took 0.11348 seconds and 4 git commands to generate.