~james-page/ubuntu/saucy/openvswitch/1.12-snapshot

« back to all changes in this revision

Viewing changes to debian/openvswitch-switch.init

  • Committer: James Page
  • Date: 2013-08-21 10:16:57 UTC
  • mfrom: (1.1.20)
  • Revision ID: james.page@canonical.com-20130821101657-3o0z0qeiv5zkwlzi
New upstream snapshot

Show diffs side-by-side

added added

removed removed

Lines of Context:
75
75
}
76
76
 
77
77
restart () {
78
 
    # OVS_RESTART_SAVE_FLOWS can be set by package postinst script.
79
 
    if [ "$OVS_RESTART_SAVE_FLOWS" = "yes" ] || \
80
 
       [ "$1" = "--save-flows=yes" ]; then
 
78
    # OVS_FORCE_RELOAD_KMOD can be set by package postinst script.
 
79
    if [ "$1" = "--save-flows=yes" ] || \
 
80
        [ "${OVS_FORCE_RELOAD_KMOD}" = "no" ]; then
81
81
        start restart
 
82
    elif [ "${OVS_FORCE_RELOAD_KMOD}" = "yes" ]; then
 
83
        depmod -a
 
84
 
 
85
        if [ -e /sys/module/openvswitch ]; then
 
86
            LOADED_SRCVERSION=`cat /sys/module/openvswitch/srcversion`
 
87
            LOADED_VERSION=`cat /sys/module/openvswitch/version`
 
88
        elif [ -e /sys/module/openvswitch_mod ]; then
 
89
            LOADED_SRCVERSION=`cat /sys/module/openvswitch_mod/srcversion`
 
90
            LOADED_VERSION=`cat /sys/module/openvswitch_mod/version`
 
91
        fi
 
92
        SRCVERSION=`modinfo -F srcversion openvswitch 2>/dev/null`
 
93
        VERSION=`modinfo -F version openvswitch 2>/dev/null`
 
94
 
 
95
        ovs_ctl_log "Package upgrading:\n"\
 
96
                    "Loaded version: ${LOADED_VERSION} ${LOADED_SRCVERSION}.\n"\
 
97
                    "Version on disk: ${VERSION} ${SRCVERSION}."
 
98
 
 
99
        # If the kernel module was previously loaded and it is different than
 
100
        # the kernel module on disk, then do a 'force-reload-kmod'.
 
101
        if [ -n "${LOADED_SRCVERSION}" ] && [ -n "${SRCVERSION}" ] && \
 
102
            [ "${SRCVERSION}" != "${LOADED_SRCVERSION}" ]; then
 
103
            start force-reload-kmod
 
104
        else
 
105
            start restart
 
106
        fi
82
107
    else
83
108
        stop
84
109
        start