Revamp build system to make it easier to integrate openflowext.
[sliver-openvswitch.git] / debian / openflow-switch.init
index 74412d9..5d658ed 100755 (executable)
@@ -27,6 +27,7 @@ test -x $DAEMON || exit 0
 
 LOGDIR=/var/log/openflow
 PIDFILE=/var/run/$NAME.pid
+MGMTSOCK=/var/run/$NAME.socket
 DHCLIENT_PIDFILE=/var/run/dhclient.of0.pid
 DODTIME=1                   # Time to wait for the server to die, in seconds
                             # If this value is set too low you might not
@@ -50,8 +51,14 @@ running_pid()
     [ ! -d /proc/$pid ] &&  return 1
     cmd=`cat /proc/$pid/cmdline | tr "\000" "\n"|head -n 1 |cut -d : -f 1`
     # Is this the expected child?
-    [ "$cmd" != "$name" ] &&  return 1
-    return 0
+    case $cmd in
+        $name|*/$name)
+            return 0
+            ;;
+        *)
+            return 1
+            ;;
+    esac
 }
 
 running()
@@ -120,6 +127,9 @@ configure_ssl() {
             echo "$CACERT: CA certificate missing" >&2
         fi
         echo "Run ofp-switch-setup or edit /etc/default/openflow-switch to configure" >&2
+        if test "$MODE" = discovery; then
+            echo "You may also delete or rename $PRIVKEY to disable SSL requirement" >&2
+        fi
         exit 1
     fi
     SSL_OPTS="--private-key=$PRIVKEY --certificate=$CERT --ca-cert=$CACERT"
@@ -200,6 +210,7 @@ case "$1" in
        echo -n "Starting $DESC: "
        start-stop-daemon --start --quiet --pidfile $PIDFILE \
            --exec $DAEMON -- nl:0 $CONTROLLER --detach --pidfile=$PIDFILE \
+            --verbose=ANY:console:emer --listen=punix:$MGMTSOCK \
             $DAEMON_OPTS $SSL_OPTS
         if running; then
             echo "$NAME."