debian: Create the config database if it doesn't exist on startup
[sliver-openvswitch.git] / debian / openvswitch-switch.init
index de8f295..bb2cb1b 100755 (executable)
@@ -201,6 +201,14 @@ case "$1" in
             check_op "Setting core limit to $CORE_LIMIT" ulimit -c "$CORE_LIMIT"
         fi
 
+        # Create an empty configuration database if it doesn't exist.
+        if test ! -e /etc/openvswitch-switch/conf; then
+            # Create configuration database.
+            ovsdb-tool -vANY:console:emer \
+                create /etc/openvswitch-switch/conf \
+                /usr/share/openvswitch/vswitch-idl.ovsschema
+        fi
+
         # Start ovsdb-server.
         set --
         set -- "$@" --verbose=ANY:console:emer --verbose=ANY:syslog:err
@@ -218,6 +226,8 @@ case "$1" in
             echo " ERROR."
         fi
 
+        ovs-vsctl --no-wait init
+
         # Start ovs-vswitchd.
         set --
         set -- "$@" --verbose=ANY:console:emer --verbose=ANY:syslog:err