2 # postinst script for openvswitch-switch
4 # see: dh_installdeb(1)
8 # summary of how this script can be called:
9 # * <postinst> `configure' <most-recently-configured-version>
10 # * <old-postinst> `abort-upgrade' <new version>
11 # * <conflictor's-postinst> `abort-remove' `in-favour' <package>
13 # * <postinst> `abort-remove'
14 # * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
15 # <failed-install-package> <version> `removing'
16 # <conflicting-package> <version>
17 # for details, see http://www.debian.org/doc/debian-policy/ or
18 # the debian-policy package
23 DEFAULT
=/etc
/default
/openvswitch-switch
24 TEMPLATE
=/usr
/share
/openvswitch
/switch
/default.template
25 if ! test -e $DEFAULT; then
28 for var
in $
(awk -F'[ :]' '/^# [_A-Z0-9]+:/{print $2}' $TEMPLATE)
30 if ! grep $var $DEFAULT >/dev
/null
2>&1; then
32 sed -n "/$var:/,/$var=/p" $TEMPLATE >> $DEFAULT
37 if /etc
/init.d
/openvswitch-switch status
>/dev
/null
2>&1; then
39 /etc
/init.d
/openvswitch-switch stop
44 if test ! -e /etc
/openvswitch-switch
/conf
; then
45 # Create configuration database.
46 ovsdb-tool
-vANY:console
:emer \
47 create
/etc
/openvswitch-switch
/conf \
48 /usr
/share
/openvswitch
/vswitch-idl.ovsschema
50 # Initialize configuration database.
51 ovsdb-tool
-vANY:console
:emer \
52 transact
/etc
/openvswitch-switch
/conf \
53 '[{"op": "insert", "table": "Open_vSwitch", "row": {}}]' \
58 /etc
/init.d
/openvswitch-switch start
62 abort-upgrade|abort-remove|abort-deconfigure
)
66 echo "postinst called with unknown argument \`$1'" >&2