ofproto-dpif: Factor out VLAN splinter flow adjustment into new function.
[openvswitch] / debian / openvswitch-controller.postinst
1 #!/bin/sh
2 # postinst script for openvswitch-controller
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         cd /etc/openvswitch-controller
24
25         # If cacert.pem is a symlink to the old location for cacert.pem,
26         # remove it so that we can symlink it to the new location.
27         if test -h cacert.pem && \
28            test X"`readlink cacert.pem`" = X/usr/share/openvswitch/pki/switchca/cacert.pem; then
29             rm -f cacert.pem
30         fi
31
32         if ! test -e cacert.pem; then
33             ln -s /var/lib/openvswitch/pki/switchca/cacert.pem cacert.pem
34         fi
35         if ! test -e privkey.pem || ! test -e cert.pem; then
36             oldumask=$(umask)
37             umask 077
38             ovs-pki req+sign tmp controller >/dev/null
39             mv tmp-privkey.pem privkey.pem
40             mv tmp-cert.pem cert.pem
41             mv tmp-req.pem req.pem
42             chmod go+r cert.pem req.pem
43             umask $oldumask
44         fi
45         ;;
46
47     abort-upgrade|abort-remove|abort-deconfigure)
48         ;;
49
50     *)
51         echo "postinst called with unknown argument \`$1'" >&2
52         exit 1
53         ;;
54 esac
55
56 #DEBHELPER#
57
58 exit 0
59
60