ofproto: Reinterpret meaning of OpenFlow hard timeouts with OFPFC_MODIFY.
[openvswitch] / debian / openvswitch-switch.postinst
1 #!/bin/sh
2 # postinst script for openvswitch-switch
3 #
4 # see: dh_installdeb(1)
5
6 set -e
7
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>
12 #          <new-version>
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
19
20
21 case "$1" in
22     configure)
23         DEFAULT=/etc/default/openvswitch-switch
24         TEMPLATE=/usr/share/openvswitch/switch/default.template
25         if ! test -e $DEFAULT; then
26             cp $TEMPLATE $DEFAULT
27         else
28             for var in $(awk -F'[ :]' '/^# [_A-Z0-9]+:/{print $2}' $TEMPLATE)
29             do
30                 if ! grep $var $DEFAULT >/dev/null 2>&1; then
31                     echo >> $DEFAULT
32                     sed -n "/$var:/,/$var=/p" $TEMPLATE >> $DEFAULT
33                 fi
34             done
35         fi
36         ;;
37
38     abort-upgrade|abort-remove|abort-deconfigure)
39         ;;
40
41     *)
42         echo "postinst called with unknown argument \`$1'" >&2
43         exit 1
44         ;;
45 esac
46
47 HAVE_KMOD="no"
48
49 init_script_error () {
50         if test X"$HAVE_KMOD" = Xno; then
51                 exit 0
52         fi
53         exit 1
54 }
55
56 # Do not fail package installation just because the kernel module
57 # is not available.
58 if test -x /etc/init.d/openvswitch-switch; then
59     if invoke-rc.d openvswitch-switch load-kmod; then
60         HAVE_KMOD="yes"
61     fi
62 fi
63
64 #DEBHELPER#
65
66 exit 0
67
68