summaryrefslogtreecommitdiff
path: root/debian/openvswitch-switch.postinst
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2009-12-15 13:11:24 -0800
committerBen Pfaff <blp@nicira.com>2009-12-15 13:12:00 -0800
commitb3a43165749f80d7f3eda34e2e2b07f7a349e298 (patch)
treed0682415a325d96e9d92181d480923d8b2ca337d /debian/openvswitch-switch.postinst
parent77ce847d0be64ac3781ac112044dde5ddcbc30bf (diff)
downloadopenvswitch-b3a43165749f80d7f3eda34e2e2b07f7a349e298.tar.gz
debian: Change openvswitch-switch deb to use ovsdb-server and ovs-vswitchd.
This appears to work in that it creates the database on installation, starts and stops the programs and loads and unloads the kernel modules at the right times, but it has not been tested beyond that.
Diffstat (limited to 'debian/openvswitch-switch.postinst')
-rwxr-xr-xdebian/openvswitch-switch.postinst24
1 files changed, 24 insertions, 0 deletions
diff --git a/debian/openvswitch-switch.postinst b/debian/openvswitch-switch.postinst
index 74b52ba90..39b2de461 100755
--- a/debian/openvswitch-switch.postinst
+++ b/debian/openvswitch-switch.postinst
@@ -33,6 +33,30 @@ case "$1" in
fi
done
fi
+
+ if /etc/init.d/openvswitch-switch status >/dev/null 2>&1; then
+ running=true
+ /etc/init.d/openvswitch-switch stop
+ else
+ running=false
+ fi
+
+ 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
+
+ # Initialize configuration database.
+ ovsdb-tool -vANY:console:emer \
+ transact /etc/openvswitch-switch/conf \
+ '[{"op": "insert", "table": "Open_vSwitch", "row": {}}]' \
+ > /dev/null
+ fi
+
+ if $running; then
+ /etc/init.d/openvswitch-switch start
+ fi
;;
abort-upgrade|abort-remove|abort-deconfigure)